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