The Gaudi Framework
master (bdbe7744)
Toggle main menu visibility
Loading...
Searching...
No Matches
gaudiComponentHelp.py
Go to the documentation of this file.
1
#!/usr/bin/env python3
2
12
"""
13
Print help messages for gaudi components
14
"""
15
16
import
os
17
import
sys
18
19
import
Configurables
20
21
from
Gaudi
import
Configuration
22
23
if
__name__ ==
"__main__"
:
24
from
optparse
import
OptionParser
25
26
parser = OptionParser(prog=os.path.basename(sys.argv[0]), usage=
"%prog [options] "
)
27
parser.add_option(
28
"-l"
,
29
"--list"
,
30
action=
"store_true"
,
31
dest=
"list"
,
32
default=
False
,
33
help=
"list all available components."
,
34
)
35
parser.add_option(
36
"-n"
,
37
"--name"
,
38
action=
"store"
,
39
dest=
"name"
,
40
help=
"dump all info about component of given name."
,
41
)
42
parser.set_defaults(root=os.path.join(
".."
,
"python"
))
43
opts, args = parser.parse_args()
44
45
if
len(args) != 0:
46
parser.print_help()
47
sys.exit(1)
48
49
cfgDb = Configuration.cfgDb
50
if
opts.list:
51
print(
"Available components:\n%s"
% (21 *
"="
))
52
for
item
in
sorted(cfgDb):
53
print(
" {} (from {})"
.
format
(item, cfgDb[item][
"lib"
]))
54
sys.exit()
55
elif
opts.name:
56
name = opts.name
57
if
name
not
in
cfgDb:
58
print(f
"Component {name} not found."
)
59
sys.exit()
60
print(
61
"\nDumping component information for {}:\n{}"
.
format
(
62
name, (35 + len(name)) *
"="
63
)
64
)
65
print(
" Library: {}"
.
format
(cfgDb[name][
"lib"
]))
66
print(
" Package: {}"
.
format
(cfgDb[name][
"package"
]))
67
print(
"\nProperties:\n%s"
% (11 *
"-"
))
68
try
:
69
properties = getattr(Configurables, name)().getPropertiesWithDescription()
70
except
AttributeError:
71
print(
" Not a configurable component. No properties to show."
)
72
sys.exit()
73
for
label, (value, desc)
in
sorted(properties.items()):
74
print(
75
(
76
" {}\t : {}\t ({}) "
.
format
(
77
label, value, str(desc).replace(
"None"
,
" no description "
)
78
)
79
).expandtabs(30)
80
)
81
sys.exit()
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition
MsgStream.cpp:93
GaudiKernel
scripts
gaudiComponentHelp.py
Generated on
for The Gaudi Framework by
1.17.0