122 """Helper function to load all ConfigurableDb files (modules) holding
123 informations about Configurables
127 from itertools
import chain
128 from os.path
import join
as path_join
130 from GaudiPluginService.cpluginsvc
import GAUDI_DEFAULT_PLUGIN_PATH
132 log.debug(
"loading confDb files...")
135 [
"GAUDI_PLUGIN_PATH",
"DYLD_LIBRARY_PATH"]
136 if sys.platform ==
"darwin"
137 else [
"GAUDI_PLUGIN_PATH",
"LD_LIBRARY_PATH"]
139 ignored_files = set(os.environ.get(
"CONFIGURABLE_DB_IGNORE",
"").split(
","))
141 [GAUDI_DEFAULT_PLUGIN_PATH],
142 *[os.getenv(pv,
"").split(os.pathsep)
for pv
in pathvars],
144 if not path
or not os.path.isdir(path):
146 log.debug(
"walking in [%s]...", path)
150 path_join(path, f)
for f
in os.listdir(path)
if f.endswith(
".confdb")
152 if os.path.isfile(f)
and f
not in ignored_files
155 mergedConfDbFiles = [f
for f
in confDbFiles
if f.endswith(
"_merged.confdb")]
156 if mergedConfDbFiles:
158 confDbFiles = mergedConfDbFiles
160 for confDb
in confDbFiles:
161 log.debug(
"\t-loading [%s]...", confDb)
163 cfgDb._loadModule(confDb)
164 except Exception
as err:
165 log.warning(
"Could not load file [%s] !", confDb)
166 log.warning(
"Reason: %s", err)
168 log.debug(
"loading confDb files... [DONE]")
169 nPkgs = len(set([k[
"package"]
for k
in cfgDb.values()]))
170 log.debug(
"loaded %i confDb packages", nPkgs)
175 confClass = className
181 confClassInfo = cfgDb.get(confClass)
182 if not confClassInfo:
183 confClassInfo = cfgDb.get(confClass)
185 confMod = confClassInfo
and confClassInfo.get(
"module")
187 log.warning(
"%s: Class %s not in database", requester, className)
191 mod = __import__(confMod, globals(), locals(), confClass)
194 "%s: Module %s not found (needed for configurable %s)",
202 confClass = getattr(mod, confClass)
203 except AttributeError:
205 "%s: Configurable %s not found in module %s", requester, confClass, confMod
209 log.debug(
"%s: Found configurable %s in module %s", requester, confClass, confMod)