3 Print help messages for gaudi components 5 from Gaudi
import Configuration
10 if __name__ ==
"__main__":
11 from optparse
import OptionParser
12 parser = OptionParser(prog=os.path.basename(
13 sys.argv[0]), usage=
"%prog [options] ")
14 parser.add_option(
"-l",
"--list", action=
"store_true", dest=
"list",
15 default=
False, help=
"list all available components.")
16 parser.add_option(
"-n",
"--name", action=
"store", dest=
"name",
17 help=
"dump all info about component of given name.")
18 parser.set_defaults(root=os.path.join(
"..",
"python"))
19 opts, args = parser.parse_args()
25 cfgDb = Configuration.cfgDb
27 print "Available components:\n%s" % (21 *
"=")
28 for item
in sorted(cfgDb):
29 print " %s (from %s)" % (item, cfgDb[item][
"lib"])
34 print "Component %s not found." % (name)
36 print "\nDumping component information for %s:\n%s" % (
37 name, (35 + len(name)) *
"=")
38 print " Library: %s" % (cfgDb[name][
"lib"])
39 print " Package: %s" % (cfgDb[name][
"package"])
40 print "\nProperties:\n%s" % (11 *
"-")
42 properties = getattr(Configurables, name)(
43 ).getPropertiesWithDescription()
44 except AttributeError:
45 print " Not a configurable component. No properties to show." 47 for label, (value, desc)
in sorted(properties.iteritems()):
48 print (
" %s\t : %s\t (%s) " % (label, value, str(
49 desc).replace(
"None",
" no description "))).expandtabs(30)