Skip to content
Snippets Groups Projects
Commit e53e1b1d authored by Robert Rosca's avatar Robert Rosca
Browse files

Use importlib to check if XFELDetAna is installed

parent 0b61184d
No related branches found
No related tags found
1 merge request!437Fix/requirements into setuppy
import importlib
import sys
from distutils.command.build import build
from distutils.extension import Extension
......@@ -28,20 +29,15 @@ class PostInstallCommand(install):
python_path = sys.executable
if "karabo" in python_path:
print("Karabo installation detected, checking for PyDetLib installation")
try:
import XFELDetAna
print("...found!")
return
except ImportError:
"No PyDetLib installation found, attempting to install"
if importlib.util.find_spec("XFELDetAna") is None:
print("No PyDetLib installation found, attempting to install")
check_call(
"karabo -g https://in.xfel.eu/gitlab install pyDetLib master".split()
)
else:
print(
"Python environment seems to not be a Karabo environment. "
+ "Please install PyDetLib manually."
"Python environment seems to not be a Karabo environment. Please"
"install PyDetLib manually."
)
......@@ -92,7 +88,8 @@ setup(
"bin/*.sh",
"titlepage.tmpl",
"xfel.pdf",
] + data_files
]
+ data_files
},
entry_points={
"console_scripts": [
......@@ -164,7 +161,7 @@ setup(
"dev": [
"nbqa[toolchain]",
"pre-commit",
]
],
},
python_requires=">=3.6",
classifiers=[
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment