10 __author__ =
"Sebastien Binet"
14 from PyUtils
import Dso
17 'TMath' : (
'libCore.so',
'libMathCore.so'),
18 'string': (
'libGaudiKernelDict.so',
20 'liblcg_PyCoolDict.so',
22 'vector<vector<double> >': (
'libMathCore.so',
23 'libAtlasSTLAddReflexDict.so'),
24 'RooStats': (
'libHistFactory.so',
26 'vector<unsigned int>': (
'libSTLRflx.so',
28 'vector<double>': (
'libSTLRflx.so',
33 return os.environ.get(
'AtlasProject')
37 if detailedDump : fct =
lambda x: x
38 else: fct = os.path.basename
39 keys =
list(db.keys())
49 if __name__ ==
"__main__":
51 from optparse
import OptionParser
52 parser = OptionParser(usage=
"usage: %prog [options]")
55 dest =
"capabilities",
57 help =
"Dump the capabilities of a given library (ex: libAthenaServices.so)"
63 help =
"Check if there is any duplicates among dictionaries for a given library"
68 action =
"store_true",
70 help =
"Dump the content of all the known plugins (dicts. and components)"
75 action =
"store_true",
77 help =
"Dump all the dsomap/rootmap files known to the Dso repository"
82 action =
"store_true",
84 help =
"Dump all the libraries known to the Dso repository"
88 action =
"store_true",
90 dest =
"checkDictDuplicates",
91 help =
"Check if there is any duplicates among dictionaries"
95 action =
"store_true",
97 dest =
"checkPfDuplicates",
98 help =
"Check if there is any duplicates among components declared to the PluginSvc"
102 dest =
"checkAllDuplicates",
103 action =
"store_true",
105 help =
"Check dictionaries *and* components"
109 action =
"store_true",
110 dest =
"detailedDump",
112 help =
"Performs a detailed dump if duplicates are found"
116 action =
"store_true",
119 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"
126 help =
"Logging level (aka verbosity)"
129 (options, args) = parser.parse_args()
132 print (
"::: checkPlugins :::")
136 if len(args) > 0
and args[0][0] !=
"-":
137 options.capabilities = args[0]
140 if options.capabilities:
141 libName = options.capabilities
143 capabilities = dsoDb.capabilities(libName)
144 print (
"::: capabilities of [%s]" % libName)
145 print (os.linesep.join( [
" "+
str(c)
for c
in capabilities ] ))
150 if options.checkDups:
151 libName = options.checkDups
153 print (
"::: checking duplicates for [%s]..." % libName)
154 dups = dsoDb.duplicates(libName, pedantic = options.isPedantic)
157 print (os.linesep.join( [
" "+
str(v)
for v
in dups[k] ] ))
158 if len(dups.keys())>0: sc = 1
163 if options.dumpContent:
164 print (
"::: dumping content of all known plugins...")
165 entries = dsoDb.content( pedantic = options.isPedantic )
166 printDb(entries, options.detailedDump)
167 print (
"::: known entries:",len(entries.keys()))
170 print (
"::: dumping all known libraries...")
171 libs = dsoDb.libs(options.detailedDump)
174 print (
"::: known libs:",len(libs))
177 print (
"::: dumping all known dsomap/rootmap files...")
178 dsoFiles = [ dso
for dso
in dsoDb.dsoFiles]
180 for dsoFile
in dsoFiles:
181 if not options.detailedDump: dsoFile = os.path.basename(dsoFile)
183 print (
"::: known dsos:",len(dsoFiles))
185 if options.checkDictDuplicates
or options.checkAllDuplicates:
186 print (
":: checking dict. duplicates...")
187 dups = dsoDb.dictDuplicates( pedantic = options.isPedantic )
203 if k
in _suppression_dct:
204 suppressed = [os.path.basename(ii)
in _suppression_dct[k]
207 msg =
"---> ignoring [%s]" % k
208 suppression_log.append(k[:])
218 printDb(dups, options.detailedDump)
219 if len(suppression_log):
221 print (
"## ignoring the following dups':")
222 for k
in suppression_log:
225 print (
"## all dups:",len(dups.keys()))
226 print (
"## dups:",len(dups.keys())-len(suppression_log))
227 if options.checkPfDuplicates
or options.checkAllDuplicates:
228 print (
":: checking (plugin factories) components duplicates...")
229 dups = dsoDb.pfDuplicates( pedantic = options.isPedantic )
230 if len(dups.keys()) > 0: sc = 1
231 printDb(dups, options.detailedDump)
232 print (
"## dups:",len(dups.keys()))
234 if sc != 0:
print (
":: ERROR !!")
235 else:
print (
":: All good.")