The Gaudi Framework  master (37c0b60a)
root_map_dump.py
Go to the documentation of this file.
1 #!/usr/bin/env python3
2 
12 
13 
14 import os.path
15 
16 from GaudiKernel.RootMap import checkDict, getMaps, printKeys, printMaps, shortPrintMaps
17 
18 
19 def _help(argv):
20  print(
21  """
22  %s [-h] [-s|-e|-c] [-r] [-p pattern] [listofpath]
23 
24  -h: dump this Help
25  -s: Short format print
26  -e: print Entry names only
27  -c: only Checks duplication of entries
28  -r: print also $ROOTSYS/etc/system.rootmap
29  -p: print only pattern matching (Python style) entries
30 
31  dump rootmap dictionaries informations. If no path is given, the
32  LD_LIBRARY_PATH is used. By default, prints the name of the entry,
33  its corresponding library and its block definition inside the
34  rootmap file(s) on separate lines. The output is sorted according to
35  the name of the entry. A Warning is issued if an entry appears
36  several times.
37  """
38  % os.path.basename(argv[0])
39  )
40 
41 
42 if __name__ == "__main__":
43  import getopt
44  import sys
45 
46  printFunc = printMaps
47  sysrtmap = False
48  pattern = None
49  try:
50  opts, args = getopt.getopt(sys.argv[1:], "hsecrp:")
51  except getopt.GetoptError:
52  _help(sys.argv)
53  sys.exit(2)
54  for op, ar in opts:
55  if op == "-h":
56  _help(sys.argv)
57  sys.exit(0)
58  if op == "-s":
59  printFunc = shortPrintMaps
60  if op == "-e":
61  printFunc = printKeys
62  if op == "-c":
63  printFunc = checkDict
64  if op == "-r":
65  sysrtmap = True
66  if op == "-p":
67  import re
68 
69  pattern = re.compile(ar)
70  if args:
71  for p in args:
72  maps = getMaps(p, sysrtmap)
73  printFunc(maps, pattern)
74  else:
75  maps = getMaps("", sysrtmap)
76  printFunc(maps, pattern)
root_map_dump._help
def _help(argv)
Definition: root_map_dump.py:19
root_map_dump.printFunc
printFunc
Definition: root_map_dump.py:46
GaudiKernel.RootMap
Definition: RootMap.py:1
GaudiKernel.RootMap.getMaps
def getMaps(pathstring="", sysrtmap=False)
Definition: RootMap.py:89