![]() |
|
|
Generated: 8 Jan 2009 |
00001 # File: Gaudi/CommonGaudiConfigurables.py 00002 # Author: Pere Mato (per.mato@cern.ch) 00003 00004 """ 00005 This module would scan all known Gaudi configurable modules for 00006 'Configurable' classes and fill __all__ such that it can be imported 00007 by any module requiring it. 00008 """ 00009 00010 from GaudiKernel.Configurable import Configurable 00011 from GaudiKernel.ConfigurableMeta import ConfigurableMeta 00012 __all__ = [] 00013 00014 packages = ['GaudiSvc', 'GaudiAlg', 'GaudiAud', 'GaudiPoolDb', 'RootHistCnv', 00015 'GaudiUtils' ] 00016 00017 #--Loop open all listed packages and populate __all__ with the names and 00018 # the local scope with the Configurable classes 00019 for package in packages : 00020 try: 00021 mod = __import__( '%s.%sConf'%(package,package), globals(), locals(), ['%sConf'%package] ) 00022 for nam in dir(mod) : 00023 cls = getattr(mod, nam) 00024 if type(cls) is ConfigurableMeta and issubclass(cls, Configurable) : 00025 globals()[nam] = cls 00026 __all__.append(nam) 00027 except ImportError: 00028 # ignore the configurables from missing packages. 00029 pass 00030 00031 #--Fix some of the name idiosyncrasies in Gaudi 00032 def addConfigurableAs(ori, new) : 00033 gbl = globals() 00034 if ori in gbl: # do the aliasing only if the original is available 00035 gbl[new] = gbl[ori] 00036 __all__.append(new) 00037 gbl[new].DefaultedName = new 00038 00039 addConfigurableAs('EvtDataSvc','EventDataSvc') 00040 addConfigurableAs('DetDataSvc','DetectorDataSvc') 00041 addConfigurableAs('HistogramSvc','HistogramDataSvc') 00042 addConfigurableAs('HbookCnv__PersSvc','HbookHistSvc') 00043 addConfigurableAs('RootHistCnv__PersSvc','RootHistSvc') 00044 addConfigurableAs('EvtPersistencySvc','EventPersistencySvc') 00045 addConfigurableAs('DetPersistencySvc','DetectorPersistencySvc') 00046 addConfigurableAs('HistogramPersistencySvc','HistogramPersistencySvc') 00047 00048 addConfigurableAs('Gaudi__MultiFileCatalog','FileCatalog') 00049 addConfigurableAs('Gaudi__IODataManager','IODataManager')