10 from __future__
import print_function
12 __author__ =
"Sebastien Binet"
16 from PyUtils
import Dso
19 'TMath' : (
'libCore.so',
'libMathCore.so'),
20 'string': (
'libGaudiKernelDict.so',
22 'liblcg_PyCoolDict.so',
24 'vector<vector<double> >': (
'libMathCore.so',
25 'libAtlasSTLAddReflexDict.so'),
26 'RooStats': (
'libHistFactory.so',
28 'vector<unsigned int>': (
'libSTLRflx.so',
30 'vector<double>': (
'libSTLRflx.so',
35 return os.environ.get(
'AtlasProject')
39 if detailedDump : fct =
lambda x: x
40 else: fct = os.path.basename
41 keys =
list(db.keys())
51 if __name__ ==
"__main__":
53 from optparse
import OptionParser
54 parser = OptionParser(usage=
"usage: %prog [options]")
57 dest =
"capabilities",
59 help =
"Dump the capabilities of a given library (ex: libAthenaServices.so)"
65 help =
"Check if there is any duplicates among dictionaries for a given library"
70 action =
"store_true",
72 help =
"Dump the content of all the known plugins (dicts. and components)"
77 action =
"store_true",
79 help =
"Dump all the dsomap/rootmap files known to the Dso repository"
84 action =
"store_true",
86 help =
"Dump all the libraries known to the Dso repository"
90 action =
"store_true",
92 dest =
"checkDictDuplicates",
93 help =
"Check if there is any duplicates among dictionaries"
97 action =
"store_true",
99 dest =
"checkPfDuplicates",
100 help =
"Check if there is any duplicates among components declared to the PluginSvc"
104 dest =
"checkAllDuplicates",
105 action =
"store_true",
107 help =
"Check dictionaries *and* components"
111 action =
"store_true",
112 dest =
"detailedDump",
114 help =
"Performs a detailed dump if duplicates are found"
118 action =
"store_true",
121 help =
"Pedantic mode: if a component is found in 2 libraries which have the same name (usual case of a developer working on a (set of) package(s)), it is still being reported as being duplicated"
128 help =
"Logging level (aka verbosity)"
131 (options, args) = parser.parse_args()
134 print (
"::: checkPlugins :::")
138 if len(args) > 0
and args[0][0] !=
"-":
139 options.capabilities = args[0]
142 if options.capabilities:
143 libName = options.capabilities
145 capabilities = dsoDb.capabilities(libName)
146 print (
"::: capabilities of [%s]" % libName)
147 print (os.linesep.join( [
" "+
str(c)
for c
in capabilities ] ))
152 if options.checkDups:
153 libName = options.checkDups
155 print (
"::: checking duplicates for [%s]..." % libName)
156 dups = dsoDb.duplicates(libName, pedantic = options.isPedantic)
159 print (os.linesep.join( [
" "+
str(v)
for v
in dups[k] ] ))
160 if len(dups.keys())>0: sc = 1
165 if options.dumpContent:
166 print (
"::: dumping content of all known plugins...")
167 entries = dsoDb.content( pedantic = options.isPedantic )
168 printDb(entries, options.detailedDump)
169 print (
"::: known entries:",len(entries.keys()))
172 print (
"::: dumping all known libraries...")
173 libs = dsoDb.libs(options.detailedDump)
176 print (
"::: known libs:",len(libs))
179 print (
"::: dumping all known dsomap/rootmap files...")
180 dsoFiles = [ dso
for dso
in dsoDb.dsoFiles]
182 for dsoFile
in dsoFiles:
183 if not options.detailedDump: dsoFile = os.path.basename(dsoFile)
185 print (
"::: known dsos:",len(dsoFiles))
187 if options.checkDictDuplicates
or options.checkAllDuplicates:
188 print (
":: checking dict. duplicates...")
189 dups = dsoDb.dictDuplicates( pedantic = options.isPedantic )
205 if k
in _suppression_dct:
206 suppressed = [os.path.basename(ii)
in _suppression_dct[k]
209 msg =
"---> ignoring [%s]" % k
210 suppression_log.append(k[:])
220 printDb(dups, options.detailedDump)
221 if len(suppression_log):
223 print (
"## ignoring the following dups':")
224 for k
in suppression_log:
227 print (
"## all dups:",len(dups.keys()))
228 print (
"## dups:",len(dups.keys())-len(suppression_log))
229 if options.checkPfDuplicates
or options.checkAllDuplicates:
230 print (
":: checking (plugin factories) components duplicates...")
231 dups = dsoDb.pfDuplicates( pedantic = options.isPedantic )
232 if len(dups.keys()) > 0: sc = 1
233 printDb(dups, options.detailedDump)
234 print (
"## dups:",len(dups.keys()))
236 if sc != 0:
print (
":: ERROR !!")
237 else:
print (
":: All good.")