Skip to content

Commit edf7584

Browse files
committed
[build] Catch exception thrown by non-pip ROOT install
1 parent af2beb7 commit edf7584

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

bindings/pyroot/pythonizations/python/ROOT/__init__.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from importlib.abc import Loader, MetaPathFinder
2020
from importlib.machinery import ModuleSpec
2121
from importlib.metadata import version
22+
from importlib.metadata import PackageNotFoundError
2223

2324
from . import _asan # noqa: F401 # imported for side effects for setup specific to AddressSanitizer environments
2425
from ._facade import ROOTFacade
@@ -192,17 +193,19 @@ def find_spec(self, fullname: str, path, target=None) -> ModuleSpec:
192193
# from . import JsMVA
193194

194195
# Print a warning for users of the ROOT wheel alpha distribution
195-
if "a" in version("ROOT"):
196-
import warnings
197-
198-
warnings.warn(
199-
"This distribution of ROOT is in alpha stage. Feedback is welcome and appreciated. "
200-
"Feel free to reach out to the user forum for questions and general feedback at "
201-
"https://github.com/root-project/root/issues. "
202-
"Do not rely on this distribution for production purposes.",
203-
stacklevel=2, # emit the warning in the caller
204-
)
205-
196+
try:
197+
if "a" in version("ROOT"):
198+
import warnings
199+
200+
warnings.warn(
201+
"This distribution of ROOT is in alpha stage. Feedback is welcome and appreciated. "
202+
"Feel free to reach out to the user forum for questions and general feedback at "
203+
"https://github.com/root-project/root/issues. "
204+
"Do not rely on this distribution for production purposes.",
205+
stacklevel=2, # emit the warning in the caller
206+
)
207+
except:
208+
pass
206209

207210
def _cleanup():
208211
# Delete TBrowser instances while the GUI event loop is still alive,

0 commit comments

Comments
 (0)