109 from ctypes
import (PyDLL, util, c_void_p, c_bool, c_char_p, c_int,
115 class IInterface_p(c_void_p):
117 return "IInterface_p(0x%x)" % (0
if self.value
is None else
120 self.log = logging.getLogger(
'BootstrapHelper')
121 libname = util.find_library(
'GaudiKernel')
or 'libGaudiKernel.so'
122 self.log.debug(
'loading GaudiKernel (%s)', libname)
126 self.lib = gkl = PyDLL(libname, mode=RTLD_GLOBAL)
129 (
'createApplicationMgr', IInterface_p, []),
130 (
'getService', IInterface_p, [IInterface_p, c_char_p]),
131 (
'setProperty', c_bool, [IInterface_p, c_char_p, c_char_p]),
132 (
'getProperty', c_char_p, [IInterface_p, c_char_p]),
133 (
'setOption',
None, [IInterface_p, c_char_p, c_char_p]),
134 (
'ROOT_VERSION_CODE', c_int, []),
137 for name, restype, argtypes
in functions:
138 f = getattr(gkl,
'py_bootstrap_%s' % name)
139 f.restype, f.argtypes = restype, argtypes
142 if name
not in self.__class__.__dict__:
143 setattr(self, name, f)
145 for name
in (
'configure',
'initialize',
'start',
'stop',
'finalize',
147 f = getattr(gkl,
'py_bootstrap_fsm_%s' % name)
148 f.restype, f.argtypes = c_bool, [IInterface_p]
149 gkl.py_bootstrap_app_run.restype = c_bool
150 gkl.py_bootstrap_app_run.argtypes = [IInterface_p, c_int]
152 gkl.py_helper_printAlgsSequences.restype =
None
153 gkl.py_helper_printAlgsSequences.argtypes = [IInterface_p]