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