15 __configurables_module_fullname__ = __name__ +
".Configurables"
16 __ignore_missing_configurables__ =
False
32 self.
__name__ = __configurables_module_fullname__
45 elif name ==
"__spec__":
48 retval = importlib.machinery.ModuleSpec(
49 name=__configurables_module_fullname__,
52 elif name ==
"__package__":
54 elif name ==
"__path__":
55 raise AttributeError(
"'module' object has no attribute '__path__'")
56 elif name
in cfgDb.keys():
57 retval = confDbGetConfigurable(name)
59 retval = aliases[name]
63 logging.getLogger(__configurables_module_fullname__).warning(
64 "Configurable class %s not in database", name
70 "module '%s' does not have attribute '%s'"
71 % (__configurables_module_fullname__, name)
77 Configurables = _ConfigurablesModule()
78 sys.modules[__configurables_module_fullname__] = Configurables
80 _GaudiKernelLib =
None
84 _fields_ = [(
"key", ctypes.c_char_p), (
"value", ctypes.c_char_p)]
88 def __init__(self, opts, appType="Gaudi::Application
"):
89 global _GaudiKernelLib
90 if _GaudiKernelLib
is None:
94 if sys.platform ==
"darwin":
97 _libpaths = os.environ.get(
"GAUDI_PLUGIN_PATH")
99 print(
"WARNING: GAUDI_PLUGIN_PATH is empty!")
100 for _path
in _libpaths.split(
":"):
101 _lib = os.path.join(_path,
"libGaudiKernel.dylib")
102 if os.path.isfile(_lib):
103 gkl = _GaudiKernelLib = ctypes.CDLL(
105 mode=ctypes.RTLD_GLOBAL,
108 gkl = _GaudiKernelLib = ctypes.CDLL(
110 mode=ctypes.RTLD_GLOBAL,
112 gkl._py_Gaudi__Application__create.restype = ctypes.c_void_p
113 gkl._py_Gaudi__Application__run.argtypes = [ctypes.c_void_p]
114 gkl._py_Gaudi__Application__run.restype = ctypes.c_int
115 gkl._py_Gaudi__Application__delete.argtypes = [ctypes.c_void_p]
117 c_opts = (c_opt_t * len(opts))()
118 for idx, item
in enumerate(opts.items()):
119 c_opts[idx].key = item[0].encode(
"ascii")
120 c_opts[idx].value = item[1].encode(
"ascii")
122 self.
_impl = _GaudiKernelLib._py_Gaudi__Application__create(
123 appType.encode(
"ascii"), c_opts, ctypes.c_ulong(len(c_opts))
128 return cls(opts, appType=appType)
131 return _GaudiKernelLib._py_Gaudi__Application__run(self.
_impl)
134 _GaudiKernelLib._py_Gaudi__Application__delete(self.
_impl)