/usr/lib/python2.7/dist-packages/pyramid/scripts/pdistreport.py is in python-pyramid 1.6+dfsg-1.
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 | import sys
import platform
import pkg_resources
import optparse
from operator import itemgetter
def out(*args): # pragma: no cover
for arg in args:
sys.stdout.write(arg)
sys.stdout.write(' ')
sys.stdout.write('\n')
def main(argv=sys.argv, pkg_resources=pkg_resources, platform=platform.platform,
out=out):
# all args except argv are for unit testing purposes only
description = "Show Python distribution versions and locations in use"
usage = "usage: %prog"
parser = optparse.OptionParser(usage, description=description)
parser.parse_args(argv[1:])
packages = []
for distribution in pkg_resources.working_set:
name = distribution.project_name
packages.append(
{'version': distribution.version,
'lowername': name.lower(),
'name': name,
'location':distribution.location}
)
packages = sorted(packages, key=itemgetter('lowername'))
pyramid_version = pkg_resources.get_distribution('pyramid').version
plat = platform()
out('Pyramid version:', pyramid_version)
out('Platform:', plat)
out('Packages:')
for package in packages:
out(' ', package['name'], package['version'])
out(' ', package['location'])
if __name__ == '__main__': # pragma: no cover
sys.exit(main() or 0)
|