-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
32 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,33 @@ | ||
"""Python module for the podio EDM toolkit and its utilities""" | ||
from .__version__ import __version__ | ||
|
||
import ROOT # pylint: disable=wrong-import-order | ||
|
||
# Track whether we were able to dynamially load the library that is built by | ||
# podio and enable certain features of the bindings only if they are actually | ||
# available. | ||
_DYNAMIC_LIBS_LOADED = False | ||
|
||
# Check if we can locate the dictionary wthout loading it as this allows us to | ||
# silence any ouptput. If we can find it, we can also safely load it | ||
if ROOT.gSystem.DynamicPathName("libpodioDict.so", True): | ||
ROOT.gSystem.Load("libpodioDict.so") | ||
# Try to load podio, this is equivalent to trying to load libpodio.so and will | ||
# error if libpodio.so is not found but work if it's found | ||
try: | ||
from ROOT import podio # noqa: F401 | ||
|
||
_DYNAMIC_LIBS_LOADED = True | ||
|
||
if _DYNAMIC_LIBS_LOADED: | ||
from .frame import Frame | ||
from . import root_io, reading | ||
|
||
try: | ||
# We try to import the sio bindings which may fail if ROOT is not able to | ||
# load the dictionary in this case they have most likely not been built and | ||
# we just move on | ||
from . import sio_io | ||
except ImportError: | ||
pass | ||
|
||
from . import EventStore | ||
|
||
__all__ = [ | ||
"__version__", | ||
"Frame", | ||
"root_io", | ||
"sio_io", | ||
"reading", | ||
"EventStore" | ||
] | ||
except ImportError: | ||
print('Unable to load podio, make sure that libpodio.so is in LD_LIBRARY_PATH') | ||
raise | ||
|
||
from .frame import Frame | ||
from . import root_io, reading | ||
|
||
try: | ||
# We try to import the sio bindings which may fail if ROOT is not able to | ||
# load the dictionary. In this case they have most likely not been built and | ||
# we just move on | ||
from . import sio_io | ||
except ImportError: | ||
pass | ||
|
||
from . import EventStore | ||
|
||
|
||
__all__ = [ | ||
"__version__", | ||
"Frame", | ||
"root_io", | ||
"sio_io", | ||
"reading", | ||
"EventStore" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters