/usr/lib/python2.7/dist-packages/autopilot/_info.py is in python-autopilot 1.4.1+17.04.20170305-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
#
# Autopilot Functional Test Tool
# Copyright (C) 2012-2013 Canonical
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""Provide version and package availibility information for autopilot."""
import subprocess
__all__ = [
'get_version_string',
'have_vis',
'version',
]
version = '1.4.0'
def have_vis():
"""Return true if the vis package is installed."""
try:
from autopilot.vis import vis_main # flake8: noqa
return True
except ImportError:
return False
def get_version_string():
"""Return the autopilot source and package versions."""
version_string = "Autopilot Source Version: " + _get_source_version()
pkg_version = _get_package_version()
if pkg_version:
version_string += "\nAutopilot Package Version: " + pkg_version
return version_string
def _get_source_version():
return version
def _get_package_version():
"""Get the version of the currently installed package version, or None.
Only returns the package version if the package is installed, *and* we seem
to be running the system-wide installed code.
"""
if _running_in_system():
return _get_package_installed_version()
return None
def _running_in_system():
"""Return True if we're running autopilot from the system installation
dir."""
return __file__.startswith('/usr/')
def _get_package_installed_version():
"""Get the version string of the system-wide installed package, or None if
it is not installed.
"""
try:
return subprocess.check_output(
[
"dpkg-query",
"--showformat",
"${Version}",
"--show",
"python-autopilot",
],
universal_newlines=True
).strip()
except subprocess.CalledProcessError:
return None
|