/usr/share/pyshared/tp/netlib/version.py is in python-tp-netlib 0.2.5-3.
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 | version = (0, 2, 5)
# Add the git version if in a git tree...
import os, os.path
__path__ = os.path.realpath(os.path.dirname(__file__))
installpath = os.path.split(os.path.split(__path__)[0])[0]
# Get the git version this tree is based on
if os.path.exists(os.path.join(installpath, '.git')):
# Read in git's 'HEAD' file which points to the correct reff to look at
h = open(os.path.join(installpath, '.git', 'HEAD')).readline().strip()
try:
# Read in the ref
ref = h.split(': ', 1)[1]
# This file has the SHA1
p = open(os.path.join(installpath, '.git', ref))
del ref
version_git = p.read().strip()
except IndexError:
version_git = h
# What version are we trying to get too?
import time
if version[2] >= 99:
version_target = (version[0], version[1]+1, 0)
else:
version_target = (version[0], version[1], version[2]+1)
version_target_str = "%i.%i.%i" % version_target
version_str = "%i.%i.%i" % version[:3]
if __name__ == "__main__":
import sys
if len(sys.argv) > 1 and sys.argv[1] == '--fix':
print """
import os, os.path
__path__ = os.path.realpath(os.path.dirname(__file__))
installpath = os.path.split(os.path.split(__path__)[0])[0]
"""
for value in dir():
if value.startswith('__') or value in ('installpath',):
continue
if isinstance(eval(value), (tuple, str, unicode)):
exec("print '%s =', repr(%s)" % (value, value))
print """
try:
print version_str+'+'+version_target_str, "(git %s)" % version_git, "(installed at %s)" % installpath
except ValueError:
print version_str, "(installed at %s)" % installpath
"""
sys.exit(0)
if os.path.exists(os.path.join(installpath, '.git')):
print version_str+'+'+version_target_str, "(git %s)" % version_git, "(installed at %s)" % installpath
else:
print version_str, "(installed at %s)" % installpath
|