# change dl flags to load dictionaries from pre-linked .so's dlflags = sys.getdlopenflags() sys.setdlopenflags(0x100 | 0x2) # RTLD_GLOBAL | RTLD_NOW import libPyROOT as _backend # reset dl flags if needed if needsGlobal: sys.setdlopenflags(dlflags) del needsGlobal # PyCintex tests rely on this, but they should not: sys.modules[__name__].libPyROOT = _backend if not _builtin_cppyy: _backend.SetMemoryPolicy(_backend.kMemoryStrict) #--- Enable Autoloading ignoring possible error for the time being try: _backend.gInterpreter.EnableAutoLoading() except: pass ### template support ------------------------------------------------------------ if not _builtin_cppyy: class Template: def __init__(self, name): self.__name__ = name def __call__(self, *args):
for c in value: if not callable(c): raise ValueError('"%s" is not callable' % str(c)) self._gts = value def __getGTS(self): return self._gts GUIThreadScheduleOnce = property(__getGTS, __setGTS) PyConfig = _Configuration() del _Configuration ### choose interactive-favored policies ----------------------------------------- _root.SetMemoryPolicy(_root.kMemoryHeuristics) _root.SetSignalPolicy(_root.kSignalSafe) ### data ________________________________________________________________________ __pseudo__all__ = [ 'gROOT', 'gSystem', 'gInterpreter', 'AddressOf', 'MakeNullPointer', 'Template', 'std' ] __all__ = [] # purposedly empty _orig_ehook = sys.excepthook ## for setting memory and speed policies; not exported _memPolicyAPI = [ 'SetMemoryPolicy', 'SetOwnership', 'kMemoryHeuristics', 'kMemoryStrict' ]
## load PyROOT C++ extension module, special case for linux and Sun needsGlobal = ( 0 <= string.find( sys.platform, 'linux' ) ) or\ ( 0 <= string.find( sys.platform, 'sunos' ) ) if needsGlobal: # change dl flags to load dictionaries from pre-linked .so's dlflags = sys.getdlopenflags() sys.setdlopenflags(0x100 | 0x2) # RTLD_GLOBAL | RTLD_NOW import libPyROOT # reset dl flags if needed if needsGlobal: sys.setdlopenflags(dlflags) del needsGlobal libPyROOT.SetMemoryPolicy(libPyROOT.kMemoryStrict) libPyROOT.MakeRootClass('PyROOT::TPyROOTApplication').InitCINTMessageCallback() #--- Enable Autoloading ignoring possible error for the time being try: libPyROOT.gInterpreter.EnableAutoLoading() except: pass #--- Load CINT dictionaries for STL classes first before other "Reflex" dictionaries # are loaded. The Reflex once are protected against the class being there #libPyROOT.gROOT.ProcessLine('int sav = gErrorIgnoreLevel; gErrorIgnoreLevel = 2001;') #for c in ('vector', 'list', 'set', 'deque') : # if libPyROOT.gSystem.Load('lib%sDict' % c ) == -1 : # warnings.warn('CINT dictionary for STL class %s could not be loaded' % c ) #libPyROOT.gROOT.ProcessLine('gErrorIgnoreLevel = sav;')