| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

gaudiComponentHelp.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 """
3 Print help messages for gaudi components
4 """
5 from Gaudi import Configuration
6 import Configurables
7 import os, sys
8
9 if __name__ == "__main__":
10 from optparse import OptionParser
11 parser = OptionParser(prog = os.path.basename(sys.argv[0]), usage = "%prog [options] ")
12 parser.add_option("-l", "--list", action="store_true", dest="list", default = False, help="list all available components.")
13 parser.add_option("-n", "--name", action="store", dest="name", help="dump all info about component of given name.")
14 parser.set_defaults(root = os.path.join("..","python"))
15 opts, args = parser.parse_args()
16
17 if len(args)!=0 :
18 parser.print_help()
19 sys.exit(1)
20
21 cfgDb = Configuration.cfgDb
22 if opts.list:
23 print "Available components:\n%s" %(21*"=")
24 for item in sorted(cfgDb):
25 print " %s (from %s)" %(item, cfgDb[item]["lib"])
26 sys.exit()
27 elif opts.name:
28 name = opts.name
29 if name not in cfgDb:
30 print "Component %s not found." %(name)
31 sys.exit()
32 print "\nDumping component information for %s:\n%s" %(name, (35 + len(name))*"=")
33 print " Library: %s" %(cfgDb[name]["lib"])
34 print " Package: %s" %(cfgDb[name]["package"])
35 print "\nProperties:\n%s" %(11*"-")
36 try:
37 properties = getattr(Configurables,name)().getPropertiesWithDescription()
38 except AttributeError:
39 print " Not a configurable component. No properties to show."
40 sys.exit()
41 for label, (value, desc) in sorted(properties.iteritems()):
42 print (" %s\t : %s\t (%s) " %(label, value, str(desc).replace("None", " no description ") )).expandtabs(30)
43 sys.exit()