/usr/share/doc/python-pmw-doc/examples/DemoVersion.py is in python-pmw-doc 1.3.2-6build1.
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 | # Set the version of Pmw to use for the demonstrations based on the
# directory name.
import imp
import os
import string
def expandLinks(path):
if not os.path.isabs(path):
path = os.path.join(os.getcwd(), path)
while 1:
if not os.path.islink(path):
break
dir = os.path.dirname(path)
path = os.path.join(dir, os.readlink(path))
return path
def setPmwVersion():
file = imp.find_module(__name__)[1]
file = os.path.normpath(file)
file = expandLinks(file)
dir = os.path.dirname(file)
dir = expandLinks(dir)
dir = os.path.dirname(dir)
dir = expandLinks(dir)
dir = os.path.basename(dir)
version = string.replace(dir[4:], '_', '.')
import Pmw
if version in Pmw.installedversions():
Pmw.setversion(version)
else:
print 'No such Pmw version', `version` + '.',
print 'Using default version', `Pmw.version()`
|