| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

CommonGaudiConfigurables.py
Go to the documentation of this file.
1 # File: Gaudi/CommonGaudiConfigurables.py
2 # Author: Pere Mato (pere.mato@cern.ch)
3
4 """
5 This module would scan all known Gaudi configurable modules for
6 'Configurable' classes and fill __all__ such that it can be imported
7 by any module requiring it.
8 """
9
10 from GaudiKernel.Configurable import Configurable
11 from GaudiKernel.ConfigurableMeta import ConfigurableMeta
12 __all__ = []
13
14 packages = ['GaudiCoreSvc', 'GaudiCommonSvc', 'GaudiSvc', 'GaudiAlg',
15 'GaudiAud', 'GaudiPoolDb', 'RootHistCnv', 'GaudiUtils',
16 'RootCnv']
17
18 #--Loop open all listed packages and populate __all__ with the names and
19 # the local scope with the Configurable classes
20 for package in packages:
21 try:
22 mod = __import__('%s.%sConf' % (package, package),
23 globals(), locals(), ['%sConf' % package])
24 for nam in dir(mod):
25 cls = getattr(mod, nam)
26 if type(cls) is ConfigurableMeta and issubclass(cls, Configurable):
27 globals()[nam] = cls
28 __all__.append(nam)
29 except ImportError:
30 # ignore the configurables from missing packages.
31 pass
32
33 #--Fix some of the name idiosyncrasies in Gaudi
34 aliases = {
35 'EventDataSvc': 'EvtDataSvc',
36 'DetectorDataSvc': 'DetDataSvc',
37 'HistogramDataSvc': 'HistogramSvc',
38 'HbookHistSvc': 'HbookCnv__PersSvc',
39 'RootHistSvc': 'RootHistCnv__PersSvc',
40 'EventPersistencySvc': 'EvtPersistencySvc',
41 'DetectorPersistencySvc': 'DetPersistencySvc',
42 'HistogramPersistencySvc': 'HistogramPersistencySvc',
43 'FileRecordPersistencySvc': 'PersistencySvc',
44
45 'FileCatalog': 'Gaudi__MultiFileCatalog',
46 'IODataManager': 'Gaudi__IODataManager',
47
48 'RootCnvSvc': 'Gaudi__RootCnvSvc',
49 'RootEvtSelector': 'Gaudi__RootEvtSelector',
50 }
51
52 _gbl = globals() # optimization
53 # This would be nicer with dict comprehension (http://www.python.org/dev/peps/pep-0274)
54 # but it is available only in Python 2.7
55 aliases = dict([(new, _gbl[old])
56 for new, old in aliases.items()
57 if old in _gbl]) # do the aliasing only if the original is available
58 # change the default name
59 for new in aliases:
60 aliases[new].DefaultedName = new
61 # update globals and __all__
62 _gbl.update(aliases)
63 __all__.extend(aliases)
64 # remove temporaries
65 del _gbl, new
GaudiKernel.ConfigurableMeta
Definition: ConfigurableMeta.py:1
gaudirun.type
type
Definition: gaudirun.py:133
GaudiKernel.Configurable
Definition: Configurable.py:1