1 """Commands for listing TurboGears default and extension packages info"""
2
3 try:
4 from email.parser import Parser
5 except ImportError:
6 from email.Parser import Parser
7
8 import pkg_resources
9
10 entrypoints = {
11 'tg-admin Commands' : 'turbogears.command',
12 'Template Engines' : 'python.templating.engines',
13 'Widget Packages' : 'turbogears.widgets',
14 'TurboGears Extensions' : 'turbogears.extensions',
15 'Identity Providers' : 'turbogears.identity.provider',
16 'Visit Managers' : 'turbogears.visit.manager',
17 'Toolbox Gadgets' : 'turbogears.toolboxcommand'}
18
19 parsestr = Parser().parsestr
20
22 """Retrieve parsed package info from distribution."""
23 return parsestr(distribution.get_metadata('PKG-INFO'))
24
25
27 """Retrieve URL from distribution."""
28 try:
29 info = retrieve_pkg_info(distribution)
30 except Exception:
31 url = None
32 else:
33 url = info['Home-page'] or info['Url'] or info['Download-Url']
34 return url
35
36
46
47
59
60
62 """Shows version info for debugging."""
63
64 desc = "Show version info"
65
68
70 print """TurboGears Complete Version Information
71
72 TurboGears requires:
73 """
74 packages, plugins = retrieve_info()
75 seen_packages = set()
76 for p in packages:
77 if p not in seen_packages:
78 print '*', p
79 seen_packages.add(p)
80 for name, pluginlist in plugins.items():
81 print '\n', name, '\n'
82 for plugin in pluginlist:
83 print '*', plugin
84