3 Print help messages for gaudi components 5 from Gaudi
import Configuration
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()
21 cfgDb = Configuration.cfgDb
23 print "Available components:\n%s" %(21*
"=")
24 for item
in sorted(cfgDb):
25 print " %s (from %s)" %(item, cfgDb[item][
"lib"])
30 print "Component %s not found." %(name)
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*
"-")
37 properties = getattr(Configurables,name)().getPropertiesWithDescription()
38 except AttributeError:
39 print " Not a configurable component. No properties to show." 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)