The Gaudi Framework  master (37c0b60a)
GaudiKernel.RootMap Namespace Reference

Functions

def _getPath (pathstring="")
 
def _getEntry (line)
 
def _getBlock (line)
 
def _procRootMap (rtmpfile, rtmapdict)
 
def _procSysRootMap (rtmapdict)
 
def _isRootMap (filename)
 
def getMaps (pathstring="", sysrtmap=False)
 
def _getLongestEntry (maps)
 
def printMaps (maps, recomp=None)
 
def shortPrintMaps (maps, recomp=None)
 
def printKeys (maps, recomp=None)
 
def checkDict (maps, recomp=None)
 

Function Documentation

◆ _getBlock()

def GaudiKernel.RootMap._getBlock (   line)
private

Definition at line 40 of file RootMap.py.

40 def _getBlock(line):
41  if line.find("Begin"):
42  block = line.split()[-1]
43  return block
44 
45 

◆ _getEntry()

def GaudiKernel.RootMap._getEntry (   line)
private

Definition at line 29 of file RootMap.py.

29 def _getEntry(line):
30  ll = line.split()
31  entry = ll[0]
32  entry = entry.replace("Library.", "")
33  entry = entry.replace(":", "")
34  entry = entry.replace("@", ":")
35  entry = entry.replace("-", " ")
36  lib = ll[1]
37  return entry, lib
38 
39 

◆ _getLongestEntry()

def GaudiKernel.RootMap._getLongestEntry (   maps)
private

Definition at line 105 of file RootMap.py.

105 def _getLongestEntry(maps):
106  sz = 0
107  for k in maps.keys():
108  if len(k) > sz:
109  sz = len(k)
110  return sz
111 
112 

◆ _getPath()

def GaudiKernel.RootMap._getPath (   pathstring = "")
private

Definition at line 18 of file RootMap.py.

18 def _getPath(pathstring=""):
19  pthlist = []
20  if pathstring == "":
21  if sys.platform == "linux2":
22  pathstring = os.environ["LD_LIBRARY_PATH"]
23  else:
24  pathstring = os.environ["PATH"]
25  pthlist += pathstring.split(os.pathsep)
26  return pthlist
27 
28 

◆ _isRootMap()

def GaudiKernel.RootMap._isRootMap (   filename)
private

Definition at line 82 of file RootMap.py.

82 def _isRootMap(filename):
83  # The file must begin with "rootmap"
84  if filename.find("rootmap") == 0:
85  return True
86  return False
87 
88 

◆ _procRootMap()

def GaudiKernel.RootMap._procRootMap (   rtmpfile,
  rtmapdict 
)
private

Definition at line 46 of file RootMap.py.

46 def _procRootMap(rtmpfile, rtmapdict):
47  block = ""
48  for line in open(rtmpfile, "r"):
49  line = line[:-1]
50  if line:
51  if line[0] != "#":
52  entry, lib = _getEntry(line)
53  if entry not in rtmapdict:
54  rtmapdict[entry] = []
55  rtmapdict[entry].append(
56  (os.path.join(os.path.dirname(rtmpfile), lib), block)
57  )
58  else:
59  block = _getBlock(line)
60 
61 

◆ _procSysRootMap()

def GaudiKernel.RootMap._procSysRootMap (   rtmapdict)
private

Definition at line 62 of file RootMap.py.

62 def _procSysRootMap(rtmapdict):
63  if "ROOTSYS" in os.environ:
64  rtmpfile = os.path.join(os.environ["ROOTSYS"], "etc", "system.rootmap")
65  block = ""
66  for line in open(rtmpfile, "r"):
67  line = line[:-1]
68  if line:
69  if line[0] != "#":
70  entry, lib = _getEntry(line)
71  if entry not in rtmapdict:
72  rtmapdict[entry] = []
73  rtmapdict[entry].append(
74  (os.path.join(os.environ["ROOTSYS"], "lib", lib), block)
75  )
76  else:
77  block = _getBlock(line)
78  else:
79  print("WARNING: No ROOTSYS defined!")
80 
81 

◆ checkDict()

def GaudiKernel.RootMap.checkDict (   maps,
  recomp = None 
)

Definition at line 161 of file RootMap.py.

161 def checkDict(maps, recomp=None):
162  kys = maps.keys()
163  kys.sort()
164  if recomp:
165  kys = filter(recomp.search, kys)
166  for k in kys:
167  if len(maps[k]) > 1:
168  print("!!!!!!!!!!!! WARNING - More than one entry !!!!!!!!!!")
169  print(k)
170  for l in maps[k]:
171  for m in l:
172  print("\t%s" % m, end=" ")
173  print(" ")
174  return

◆ getMaps()

def GaudiKernel.RootMap.getMaps (   pathstring = "",
  sysrtmap = False 
)

Definition at line 89 of file RootMap.py.

89 def getMaps(pathstring="", sysrtmap=False):
90  rtmapdict = dict()
91  pthlist = _getPath(pathstring)
92  if sysrtmap:
93  _procSysRootMap(rtmapdict)
94  for p in pthlist:
95  try:
96  for f in filter(_isRootMap, os.listdir(p)):
97  rtmpfile = os.path.join(p, f)
98  if os.path.exists(rtmpfile):
99  _procRootMap(rtmpfile, rtmapdict)
100  except Exception:
101  pass
102  return rtmapdict
103 
104 

◆ printKeys()

def GaudiKernel.RootMap.printKeys (   maps,
  recomp = None 
)

Definition at line 148 of file RootMap.py.

148 def printKeys(maps, recomp=None):
149  kys = maps.keys()
150  kys.sort()
151  if recomp:
152  kys = filter(recomp.search, kys)
153  for k in kys:
154  if len(maps[k]) > 1:
155  print("!!!!!!!!!!!! WARNING - More than one entry !!!!!!!!!!")
156  for l in maps[k]:
157  print(k)
158  return
159 
160 

◆ printMaps()

def GaudiKernel.RootMap.printMaps (   maps,
  recomp = None 
)

Definition at line 113 of file RootMap.py.

113 def printMaps(maps, recomp=None):
114  linelen = _getLongestEntry(maps)
115  frmat = r"%-" + str(linelen) + "s\t"
116  kys = maps.keys()
117  kys.sort()
118  if recomp:
119  kys = filter(recomp.search, kys)
120  for k in kys:
121  if len(maps[k]) > 1:
122  print("!!!!!!!!!!!! WARNING - More than one entry !!!!!!!!!!")
123  for l in maps[k]:
124  print(frmat % k, end=" ")
125  for m in l:
126  print(m, end=" ")
127  print(" ")
128  return
129 
130 

◆ shortPrintMaps()

def GaudiKernel.RootMap.shortPrintMaps (   maps,
  recomp = None 
)

Definition at line 131 of file RootMap.py.

131 def shortPrintMaps(maps, recomp=None):
132  kys = maps.keys()
133  kys.sort()
134  if recomp:
135  kys = filter(recomp.search, kys)
136  for k in kys:
137  if len(maps[k]) > 1:
138  print(k, "!!!!!!!!!!!! WARNING - More than one entry !!!!!!!!!!")
139  else:
140  print(k)
141  for l in maps[k]:
142  for m in l:
143  print("\t%s" % m, end=" ")
144  print(" ")
145  return
146 
147 
GaudiKernel.RootMap._getEntry
def _getEntry(line)
Definition: RootMap.py:29
GaudiKernel.RootMap._procRootMap
def _procRootMap(rtmpfile, rtmapdict)
Definition: RootMap.py:46
GaudiKernel.RootMap._procSysRootMap
def _procSysRootMap(rtmapdict)
Definition: RootMap.py:62
GaudiKernel.RootMap._isRootMap
def _isRootMap(filename)
Definition: RootMap.py:82
GaudiKernel.RootMap.shortPrintMaps
def shortPrintMaps(maps, recomp=None)
Definition: RootMap.py:131
GaudiKernel.RootMap.printKeys
def printKeys(maps, recomp=None)
Definition: RootMap.py:148
GaudiKernel.RootMap.checkDict
def checkDict(maps, recomp=None)
Definition: RootMap.py:161
GaudiKernel.RootMap._getBlock
def _getBlock(line)
Definition: RootMap.py:40
GaudiKernel.RootMap.getMaps
def getMaps(pathstring="", sysrtmap=False)
Definition: RootMap.py:89
GaudiKernel.RootMap._getPath
def _getPath(pathstring="")
Definition: RootMap.py:18
GaudiKernel.RootMap._getLongestEntry
def _getLongestEntry(maps)
Definition: RootMap.py:105
GaudiKernel.RootMap.printMaps
def printMaps(maps, recomp=None)
Definition: RootMap.py:113