| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

# CommonGaudiConfigurables.py

Go to the documentation of this file.

    00001 # File: Gaudi/CommonGaudiConfigurables.py
    00002 # Author: Pere Mato (pere.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 = ['GaudiCoreSvc', 'GaudiCommonSvc', 'GaudiSvc', 'GaudiAlg',
    00015             'GaudiAud', 'GaudiPoolDb', 'RootHistCnv', 'GaudiUtils',
    00016             'RootCnv']
    00017
    00018 #--Loop open all listed packages and populate __all__ with the names and
    00019 #  the local scope with the Configurable classes
    00020 for package in packages :
    00021     try:
    00022         mod = __import__( '%s.%sConf'%(package,package), globals(), locals(), ['%sConf'%package] )
    00023         for nam in dir(mod) :
    00024             cls = getattr(mod, nam)
    00025             if type(cls) is ConfigurableMeta and issubclass(cls, Configurable) :
    00026                 globals()[nam]  =  cls
    00027                 __all__.append(nam)
    00028     except ImportError:
    00029         # ignore the configurables from missing packages.
    00030         pass
    00031
    00032 #--Fix some of the name idiosyncrasies in Gaudi
    00033 aliases = {
    00034            'EventDataSvc':             'EvtDataSvc',
    00035            'DetectorDataSvc':          'DetDataSvc',
    00036            'HistogramDataSvc':         'HistogramSvc',
    00037            'HbookHistSvc':             'HbookCnv__PersSvc',
    00038            'RootHistSvc':              'RootHistCnv__PersSvc',
    00039            'EventPersistencySvc':      'EvtPersistencySvc',
    00040            'DetectorPersistencySvc':   'DetPersistencySvc',
    00041            'HistogramPersistencySvc':  'HistogramPersistencySvc',
    00042            'FileRecordPersistencySvc': 'PersistencySvc',
    00043
    00044            'FileCatalog':              'Gaudi__MultiFileCatalog',
    00045            'IODataManager':            'Gaudi__IODataManager',
    00046
    00047            'RootCnvSvc':               'Gaudi__RootCnvSvc',
    00048            'RootEvtSelector':          'Gaudi__RootEvtSelector',
    00049            }
    00050
    00051 _gbl = globals() # optimization
    00052 # This would be nicer with dict comprehension (http://www.python.org/dev/peps/pep-0274)
    00053 # but it is available only in Python 2.7
    00054 aliases = dict([(new, _gbl[old])
    00055                 for new, old in aliases.items()
    00056                 if old in _gbl]) # do the aliasing only if the original is available
    00057 # change the default name
    00058 for new in aliases:
    00059     aliases[new].DefaultedName = new
    00060 # update globals and __all__
    00061 _gbl.update(aliases)
    00062 __all__.extend(aliases)
    00063 # remove temporaries
    00064 del _gbl, new

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines