diff --git a/pyproject.toml b/pyproject.toml index e626be8c0..df5a2a852 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["scikit-build-core>=0.10", "pybind11", "numpy"] build-backend = "scikit_build_core.build" [project] -name = "slsDetectorPackage" +name = "slsdet" version = "2025.2.18" @@ -14,9 +14,11 @@ install.components = ["python"] [tool.scikit-build.cmake.define] +#Only build the control software and python ext SLS_USE_RECEIVER = "OFF" SLS_USE_RECEIVER_BINARIES = "OFF" SLS_USE_TEXTCLIENT = "OFF" +SLS_BUILD_SHARED_LIBRARIES = "OFF" + SLS_USE_PYTHON = "ON" -SLS_INSTALL_PYTHONEXT = "ON" -SLS_BUILD_SHARED_LIBRARIES = "OFF" \ No newline at end of file +SLS_INSTALL_PYTHONEXT = "ON" \ No newline at end of file diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index afb7267a7..2e6a485e7 100755 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -20,7 +20,7 @@ target_link_libraries(_slsdet PUBLIC set_target_properties(_slsdet PROPERTIES - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/slsdet ) #Copy Python code diff --git a/python/slsdet/__init__.py b/python/slsdet/__init__.py index 96a734ff9..85a147db6 100755 --- a/python/slsdet/__init__.py +++ b/python/slsdet/__init__.py @@ -14,7 +14,7 @@ from .moench import Moench from .pattern import Pattern, patternParameters from .gaincaps import Mythen3GainCapsWrapper -import _slsdet +from . import _slsdet xy = _slsdet.xy defs = _slsdet.slsDetectorDefs diff --git a/python/slsdet/ctb.py b/python/slsdet/ctb.py index ad671a93e..1295af9cb 100644 --- a/python/slsdet/ctb.py +++ b/python/slsdet/ctb.py @@ -4,7 +4,7 @@ from .detector import Detector, freeze from .utils import element_if_equal from .dacs import DetectorDacs, NamedDacs from .powers import DetectorPowers, NamedPowers -import _slsdet +from . import _slsdet dacIndex = _slsdet.slsDetectorDefs.dacIndex from .detector_property import DetectorProperty diff --git a/python/slsdet/dacs.py b/python/slsdet/dacs.py index 961d0bebe..547a43277 100755 --- a/python/slsdet/dacs.py +++ b/python/slsdet/dacs.py @@ -3,7 +3,7 @@ from .detector_property import DetectorProperty from functools import partial import numpy as np -import _slsdet +from . import _slsdet from .detector import freeze dacIndex = _slsdet.slsDetectorDefs.dacIndex class Dac(DetectorProperty): diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index 5a070b011..da2901ed6 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -1,8 +1,8 @@ # SPDX-License-Identifier: LGPL-3.0-or-other # Copyright (C) 2021 Contributors to the SLS Detector Package -from _slsdet import CppDetectorApi -from _slsdet import slsDetectorDefs -from _slsdet import IpAddr, MacAddr +from ._slsdet import CppDetectorApi +from ._slsdet import slsDetectorDefs +from ._slsdet import IpAddr, MacAddr runStatus = slsDetectorDefs.runStatus timingMode = slsDetectorDefs.timingMode @@ -15,7 +15,7 @@ defs = slsDetectorDefs from .utils import element_if_equal, all_equal, get_set_bits, list_to_bitmask from .utils import Geometry, to_geo, element, reduce_time, is_iterable, hostname_list -from _slsdet import xy +from ._slsdet import xy from .gaincaps import Mythen3GainCapsWrapper from . import utils as ut from .proxy import JsonProxy, SlowAdcProxy, ClkDivProxy, MaxPhaseProxy, ClkFreqProxy, PatLoopProxy, PatNLoopProxy, PatWaitProxy, PatWaitTimeProxy diff --git a/python/slsdet/eiger.py b/python/slsdet/eiger.py index a65532677..db12b7909 100755 --- a/python/slsdet/eiger.py +++ b/python/slsdet/eiger.py @@ -11,7 +11,7 @@ Created on Wed Dec 6 11:51:18 2017 from .detector import Detector from .temperature import Temperature, DetectorTemperature from .dacs import DetectorDacs -import _slsdet +from . import _slsdet dacIndex = _slsdet.slsDetectorDefs.dacIndex from .detector_property import DetectorProperty diff --git a/python/slsdet/enums.py b/python/slsdet/enums.py index 02e3c5126..41dcd5dec 100644 --- a/python/slsdet/enums.py +++ b/python/slsdet/enums.py @@ -15,8 +15,8 @@ if dt === detectorType.EIGER: """ -import _slsdet +from . import _slsdet for name, cls in _slsdet.slsDetectorDefs.__dict__.items(): if isinstance(cls, type): - exec(f'{name} = {cls.__module__}.{cls.__qualname__}') + exec(f'{name} = _slsdet.{cls.__qualname__}') diff --git a/python/slsdet/gaincaps.py b/python/slsdet/gaincaps.py index ab3acd381..900503624 100644 --- a/python/slsdet/gaincaps.py +++ b/python/slsdet/gaincaps.py @@ -1,6 +1,6 @@ -import _slsdet +from . import _slsdet gc = _slsdet.slsDetectorDefs.M3_GainCaps diff --git a/python/slsdet/gotthard2.py b/python/slsdet/gotthard2.py index bdb36097f..fb2786faf 100644 --- a/python/slsdet/gotthard2.py +++ b/python/slsdet/gotthard2.py @@ -11,7 +11,7 @@ from .detector import Detector, freeze # from .adcs import Adc, DetectorAdcs from .dacs import DetectorDacs -import _slsdet +from . import _slsdet dacIndex = _slsdet.slsDetectorDefs.dacIndex from .detector_property import DetectorProperty diff --git a/python/slsdet/jungfrau.py b/python/slsdet/jungfrau.py index c8e3f43f9..1021a55f1 100644 --- a/python/slsdet/jungfrau.py +++ b/python/slsdet/jungfrau.py @@ -11,7 +11,7 @@ from .detector import Detector, freeze # from .adcs import Adc, DetectorAdcs from .dacs import DetectorDacs -import _slsdet +from . import _slsdet dacIndex = _slsdet.slsDetectorDefs.dacIndex from .detector_property import DetectorProperty diff --git a/python/slsdet/moench.py b/python/slsdet/moench.py index 6ed49a43d..7e93bee65 100644 --- a/python/slsdet/moench.py +++ b/python/slsdet/moench.py @@ -9,7 +9,7 @@ This file contains the specialization for the Moench detector from .detector import Detector, freeze from .dacs import DetectorDacs -import _slsdet +from . import _slsdet dacIndex = _slsdet.slsDetectorDefs.dacIndex from .detector_property import DetectorProperty diff --git a/python/slsdet/mythen3.py b/python/slsdet/mythen3.py index 369d6ac99..14e1294ea 100644 --- a/python/slsdet/mythen3.py +++ b/python/slsdet/mythen3.py @@ -11,7 +11,7 @@ from .detector import Detector, freeze # from .adcs import Adc, DetectorAdcs from .dacs import DetectorDacs -import _slsdet +from . import _slsdet dacIndex = _slsdet.slsDetectorDefs.dacIndex gc_enums = _slsdet.slsDetectorDefs.M3_GainCaps from .detector_property import DetectorProperty diff --git a/python/slsdet/pattern.py b/python/slsdet/pattern.py index a2d80fdfe..273865c65 100644 --- a/python/slsdet/pattern.py +++ b/python/slsdet/pattern.py @@ -1,8 +1,8 @@ # SPDX-License-Identifier: LGPL-3.0-or-other # Copyright (C) 2021 Contributors to the SLS Detector Package -import _slsdet +from . import _slsdet -from _slsdet import Pattern +from ._slsdet import Pattern class patternParameters(_slsdet.patternParameters): diff --git a/python/slsdet/powers.py b/python/slsdet/powers.py index 8de1781c7..a513eedbe 100755 --- a/python/slsdet/powers.py +++ b/python/slsdet/powers.py @@ -3,7 +3,7 @@ from .detector_property import DetectorProperty from functools import partial import numpy as np -import _slsdet +from . import _slsdet from .detector import freeze dacIndex = _slsdet.slsDetectorDefs.dacIndex class Power(DetectorProperty): diff --git a/python/slsdet/proxy.py b/python/slsdet/proxy.py index cd10cb38a..316c1dbe3 100644 --- a/python/slsdet/proxy.py +++ b/python/slsdet/proxy.py @@ -3,7 +3,7 @@ from .utils import element_if_equal from .enums import dacIndex from .defines import M3_MAX_PATTERN_LEVELS, MAX_PATTERN_LEVELS -from _slsdet import slsDetectorDefs +from ._slsdet import slsDetectorDefs detectorType = slsDetectorDefs.detectorType diff --git a/python/slsdet/utils.py b/python/slsdet/utils.py index 89a7651bc..4648abd5a 100755 --- a/python/slsdet/utils.py +++ b/python/slsdet/utils.py @@ -6,7 +6,7 @@ but not directly used in controlling the detector """ from collections import namedtuple -import _slsdet #C++ lib +from . import _slsdet #C++ lib import functools import datetime as dt import pathlib