ATLAS Offline Software
Functions | Variables
python.scripts.check_reflex Namespace Reference

Functions

def main (args)
 

Variables

 __doc__
 
 __author__
 
 name
 
 nargs
 
 default
 
 help
 
 dest
 
 action
 

Function Documentation

◆ main()

def python.scripts.check_reflex.main (   args)
a script to check the definitions of (reflex) plugins
across multiple so-called 'rootmap' files

Definition at line 80 of file check_reflex.py.

80 def main(args):
81  """a script to check the definitions of (reflex) plugins
82  across multiple so-called 'rootmap' files
83  """
84  exitcode = 0
85 
86  print (":"*80)
87  print ("::: chk-rflx :::")
88 
89  import os
90  import PyUtils.Dso as Dso
91 
92  _suppression_dct = {
93  'TMath' : ('libCore.so', 'libMathCore.so'),
94  'string': ('libGaudiKernelDict.so',
95  'libCore.so',
96  'liblcg_PyCoolDict.so',
97  'libSTLAddRflx.so'),
98  '__pf__::CNV_71_9631': ('libDataModelTestDataReadCnvPoolCnv.so',
99  'libDataModelTestDataWriteCnvPoolCnv.so',),
100  '__pf__::CNV_71_9632': ('libDataModelTestDataReadCnvPoolCnv.so',
101  'libDataModelTestDataWriteCnvPoolCnv.so',),
102  '__pf__::CNV_71_9633': ('libDataModelTestDataReadCnvPoolCnv.so',
103  'libDataModelTestDataWriteCnvPoolCnv.so',),
104  '__pf__::CNV_71_9634': ('libDataModelTestDataReadCnvPoolCnv.so',
105  'libDataModelTestDataWriteCnvPoolCnv.so',),
106  '__pf__::CNV_71_9639': ('libDataModelTestDataReadCnvPoolCnv.so',
107  'libDataModelTestDataWriteCnvPoolCnv.so',),
108 
109  '__pf__::RootCollection': ('liblcg_RootCollection.so',
110  'libAthAnalysisTools.so',),
111 
112 
113  }
114 
115 
116  def print_db( db, detailedDump = False ):
117  if detailedDump : fct = lambda x: x
118  else: fct = os.path.basename
119  keys = db.keys()
120  keys.sort()
121  for k in keys:
122  print ("%s:" % k)
123  libs = db[k]
124  libs.sort()
125  for lib in libs:
126  print (" ",fct(lib))
127  return
128 
129  dsodb = Dso.DsoDb()
130 
131  if args.capabilities:
132  libname = args.capabilities
133  try:
134  capabilities = dsodb.capabilities(libname)
135  print ("::: capabilities of [%s]" % (libname,))
136  print (os.linesep.join([" %s"%c for c in capabilities]))
137  except ValueError:
138  exitcode = 1
139  pass
140 
141  if args.chk_dups:
142  libname = args.chk_dups
143  try:
144  print ("::: checking duplicates for [%s]..." % (libname,))
145  dups = dsodb.duplicates(libname, pedantic=args.pedantic)
146  for k in dups:
147  print (" -",k)
148  print (os.linesep.join([" %s"%v for v in dups[k]]))
149  if len(dups.keys())>0:
150  exitcode = 1
151  except ValueError:
152  exitcode = 1
153  pass
154 
155  if args.dump_content:
156  print ("::: dumping content of all known plugins...")
157  entries = dsodb.content(pedantic=args.pedantic)
158  print_db(entries, args.detailed_dump)
159  print ("::: known entries:",len(entries.keys()))
160 
161  if args.dump_libs:
162  print ("::: dumping all known libraries...")
163  libs = dsodb.libs(detailedDump=args.detailed_dump)
164  for lib in libs:
165  print (" -",lib)
166  print ("::: known libs:",len(libs))
167 
168  if args.dump_dso:
169  print ("::: dumping all known dso/rootmap files...")
170  dso_files = [dso for dso in dsodb.dsoFiles]
171  dso_files.sort()
172  for dso_file in dso_files:
173  if not args.detailed_dump:
174  dso_file = os.path.basename(dso_file)
175  print (" -",dso_file)
176  print ("::: known dsos:",len(dso_files))
177 
178  if args.check_dict_dups:
179  print (":: checking dict. duplicates...")
180  dups = dsodb.dictDuplicates(pedantic=args.pedantic)
181  suppression_log = []
182  for k in dups:
183  v = dups[k]
184  # mark as error only if it isn't a known dup'
185  if k in _suppression_dct:
186  suppressed = [os.path.basename(ii) in _suppression_dct[k]
187  for ii in v]
188  if all(suppressed):
189  suppression_log.append(k[:])
190  pass
191  else:
192  # that's a new one !!
193  exitcode = 1
194  else:
195  # that's a new one !!
196  exitcode = 1
197  # print ("---> NOT ignoring [%s]" % (k,))
198  print_db(dups, args.detailed_dump)
199  if len(suppression_log):
200  print ("-"*40)
201  print ("## ignoring the following dups':")
202  for k in suppression_log:
203  print (" -",k)
204  print ("-"*40)
205  print ("## all dups:",len(dups.keys()))
206  print ("## dups:",len(dups.keys())-len(suppression_log))
207 
208  if args.check_pf_dups:
209  print ("::: checking (plugin factories) components dups...")
210  dups = dsodb.pfDuplicates(pedantic=args.pedantic)
211  suppression_log = []
212  for k in dups:
213  v = dups[k]
214  # mark as error only if it isn't a known dup'
215  if k in _suppression_dct:
216  suppressed = [os.path.basename(ii) in _suppression_dct[k]
217  for ii in v]
218  if all(suppressed):
219  suppression_log.append(k[:])
220  pass
221  else:
222  # that's a new one !!
223  exitcode = 1
224  else:
225  # that's a new one !!
226  exitcode = 1
227  # print ("---> NOT ignoring [%s]" % (k,))
228  print_db(dups, args.detailed_dump)
229  if len(suppression_log):
230  print ("-"*40)
231  print ("## ignoring the following dups':")
232  for k in suppression_log:
233  print (" -",k)
234  print ("-"*40)
235  print ("## all dups:",len(dups.keys()))
236  print ("## dups:",len(dups.keys())-len(suppression_log))
237 
238  if args.check_all_dups:
239  print ("::: checking all components dups...")
240  dups = dsodb.pfDuplicates(pedantic=args.pedantic)
241  dups.update(dsodb.dictDuplicates(pedantic=args.pedantic))
242 
243  suppression_log = []
244  for k in dups:
245  v = dups[k]
246  # mark as error only if it isn't a known dup'
247  if k in _suppression_dct:
248  suppressed = [os.path.basename(ii) in _suppression_dct[k]
249  for ii in v]
250  if all(suppressed):
251  suppression_log.append(k[:])
252  pass
253  else:
254  # that's a new one !!
255  exitcode = 1
256  else:
257  # that's a new one !!
258  exitcode = 1
259  # print ("---> NOT ignoring [%s]" % (k,))
260  print_db(dups, args.detailed_dump)
261  if len(suppression_log):
262  print ("-"*40)
263  print ("## ignoring the following dups':")
264  for k in suppression_log:
265  print (" -",k)
266  print ("-"*40)
267  print ("## all dups:",len(dups.keys()))
268  print ("## dups:",len(dups.keys())-len(suppression_log))
269 
270  if exitcode:
271  print ("::: ERROR !!")
272  else:
273  print ("::: All good.")
274 
275  print (":"*80)
276  return exitcode

Variable Documentation

◆ __author__

python.scripts.check_reflex.__author__
private

Definition at line 14 of file check_reflex.py.

◆ __doc__

python.scripts.check_reflex.__doc__
private

Definition at line 11 of file check_reflex.py.

◆ action

python.scripts.check_reflex.action

Definition at line 33 of file check_reflex.py.

◆ default

python.scripts.check_reflex.default

Definition at line 24 of file check_reflex.py.

◆ dest

python.scripts.check_reflex.dest

Definition at line 28 of file check_reflex.py.

◆ help

python.scripts.check_reflex.help

Definition at line 25 of file check_reflex.py.

◆ name

python.scripts.check_reflex.name

Definition at line 20 of file check_reflex.py.

◆ nargs

python.scripts.check_reflex.nargs

Definition at line 23 of file check_reflex.py.

python.AthDsoLogger.fct
fct
Definition: AthDsoLogger.py:43
python.scripts.check_reflex.main
def main(args)
Definition: check_reflex.py:80
Cut::all
@ all
Definition: SUSYToolsAlg.cxx:67