3 Print help messages for gaudi components 5 from __future__
import print_function
6 from Gaudi
import Configuration
11 if __name__ ==
"__main__":
12 from optparse
import OptionParser
13 parser = OptionParser(
14 prog=os.path.basename(sys.argv[0]), usage=
"%prog [options] ")
21 help=
"list all available components.")
27 help=
"dump all info about component of given name.")
28 parser.set_defaults(root=os.path.join(
"..",
"python"))
29 opts, args = parser.parse_args()
35 cfgDb = Configuration.cfgDb
37 print(
"Available components:\n%s" % (21 *
"="))
38 for item
in sorted(cfgDb):
39 print(
" %s (from %s)" % (item, cfgDb[item][
"lib"]))
44 print(
"Component %s not found." % (name))
46 print(
"\nDumping component information for %s:\n%s" %
47 (name, (35 + len(name)) *
"="))
48 print(
" Library: %s" % (cfgDb[name][
"lib"]))
49 print(
" Package: %s" % (cfgDb[name][
"package"]))
50 print(
"\nProperties:\n%s" % (11 *
"-"))
52 properties = getattr(Configurables,
53 name)().getPropertiesWithDescription()
54 except AttributeError:
55 print(
" Not a configurable component. No properties to show.")
57 for label, (value, desc)
in sorted(properties.iteritems()):
58 print((
" %s\t : %s\t (%s) " % (label, value, str(desc).replace(
59 "None",
" no description "))).expandtabs(30))