/usr/lib/python2.7/dist-packages/curtin/version.py is in python-curtin 18.1-5-g572ae5d6-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 | # This file is part of curtin. See LICENSE file for copyright and license info.
from curtin import __version__ as old_version
import os
import subprocess
_PACKAGED_VERSION = '18.1-5-g572ae5d6-0ubuntu1'
_PACKED_VERSION = '@@PACKED_VERSION@@'
def version_string():
""" Extract a version string from curtin source or version file"""
if not _PACKAGED_VERSION.startswith('@@'):
return _PACKAGED_VERSION
if not _PACKED_VERSION.startswith('@@'):
return _PACKED_VERSION
version = old_version
gitdir = os.path.abspath(os.path.join(__file__, '..', '..', '.git'))
if os.path.exists(gitdir):
try:
out = subprocess.check_output(
['git', 'describe', '--long', '--abbrev=8',
"--match=[0-9][0-9]*"],
cwd=os.path.dirname(gitdir))
version = out.decode('utf-8').strip()
except subprocess.CalledProcessError:
pass
return version
# vi: ts=4 expandtab syntax=python
|