From 15dbc7051bd9706b1805112fad2e7761afb23c55 Mon Sep 17 00:00:00 2001 From: Alain Klotz Date: Sun, 15 Oct 2023 17:50:12 +0200 Subject: [PATCH] Some minor bugs fixed --- src/guitastro_device_flipro/component_detector_shutter_flipro.py | 2 +- src/guitastro_device_flipro/component_sensor_detector_flipro.py | 9 ++++++++- src/wrapper_flipro/setup.py | 37 +++++++++++++++++++++++++++++++++---- 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/src/guitastro_device_flipro/component_detector_shutter_flipro.py b/src/guitastro_device_flipro/component_detector_shutter_flipro.py index 1aa1749..e036c5c 100644 --- a/src/guitastro_device_flipro/component_detector_shutter_flipro.py +++ b/src/guitastro_device_flipro/component_detector_shutter_flipro.py @@ -113,7 +113,7 @@ if __name__ == "__main__": Basic example. Only simulation """ comp = ComponentDetectorShutterFlipro("IRIS", name="test") - comp.init("IRIS", name="Shutter", manufacturer="FLI") + comp.init("IRIS", name="Shutter", manufacturer="FLIPRO") comp.verbose = 1 res = comp.command("DO", "CLOSE") res = comp.command("GET", "state") diff --git a/src/guitastro_device_flipro/component_sensor_detector_flipro.py b/src/guitastro_device_flipro/component_sensor_detector_flipro.py index 62f2ac8..d21f882 100644 --- a/src/guitastro_device_flipro/component_sensor_detector_flipro.py +++ b/src/guitastro_device_flipro/component_sensor_detector_flipro.py @@ -123,6 +123,13 @@ class ComponentSensorDetectorFlipro(ComponentSensorDetector): self._wrapper_flipro = kwargs['wrapper_flipro'] self._image = [] + SENSOR_STATE_UNKNOWN = -1 + SENSOR_STATE_STOPED = 0 + SENSOR_STATE_IDLE = 1 + SENSOR_STATE_EXPOSING = 2 + SENSOR_STATE_READING = 3 + + # ------------ del def __del__(self): @@ -243,7 +250,7 @@ if __name__ == "__main__": Basic example. Only simulation """ comp = ComponentSensorDetectorFlipro("Z", name="test") - comp.init("Z", name="Camera", manufacturer="FLI") + comp.init("Z", name="Camera", manufacturer="FLIPRO") param = {} param["exptime"] = 1.0 # inc/s param["binning"] = (1,1) diff --git a/src/wrapper_flipro/setup.py b/src/wrapper_flipro/setup.py index b3856be..5cb25dd 100644 --- a/src/wrapper_flipro/setup.py +++ b/src/wrapper_flipro/setup.py @@ -23,15 +23,36 @@ elif psystem == "Darwin": distro_name = psystem distro_version = distribution[0] elif psystem == "Linux": - release = platform.release + release = platform.release() if "microsoft" in release: # release = '5.10.16.3-microsoft-standard-WSL2' distro_name = release.split("-")[3] distro_version = release.split("-")[0] else: - distribution = platform.freedesktop_os_release() - distro_name = distribution['NAME'] - distro_version = distribution['VERSION_ID'] + try: + # --- Python >= 3.10 + distribution = platform.freedesktop_os_release() + distro_name = distribution['NAME'] + distro_version = distribution['VERSION_ID'] + except: + try: + # --- Python <= 3.7 + # platform.linux_distribution() + # ('Red Hat Enterprise Linux', '8.8', 'Ootpa') + dist = platform.dist() + # ('redhat', '8.8', 'Ootpa') + distro_name = dist[0] + distro_version = dist[1] + except: + # --- Python == 3.8 or 3.9 + uname = platform.uname() + # uname_result(system='Linux', node='ceres', release='6.2.0-33-generic', version='#33~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 7 10:33:52 UTC 2', machine='x86_64') + version = uname[3] + vs = version.split() + vvs = vs[0].split("-") + distro_name = vvs[-1] + distro_version = '?' + print(f"\n{distro_name=}") print(f"\n{distro_version=}") @@ -50,6 +71,8 @@ if distro_name == "Windows": path_manufacturer = "libflipro-Version-1.12.59-Windows" elif distro_name == "Ubuntu" or distro_name == "Fedora": path_manufacturer = "libflipro-Version-2.0.5-" +elif distro_name == "redhat" : + path_manufacturer = "libflipro-Version-1.12.59-CentOSLinux" # ===================================================== # === Copy manufacturer resources (libraires, etc.) === @@ -64,6 +87,10 @@ elif distro_name == "Ubuntu" or distro_name == "Fedora": library_dirs = [os.path.join(path_external, path_manufacturer + distro_name)] for library_dir in library_dirs: srcs.extend( glob.glob(os.path.join(library_dir, "*.so*")) ) +elif distro_name == "redhat": + library_dirs = [os.path.join(path_external, path_manufacturer)] + for library_dir in library_dirs: + srcs.extend( glob.glob(os.path.join(library_dir, "*.so*")) ) else: raise("No compilation found for your distribution") # --- Copy the resource files into the current working directory @@ -95,6 +122,8 @@ elif distro_name == "Ubuntu" or distro_name == "Fedora": #extra_link_args.append("-lm") extra_link_args.append("-lusb-1.0") #extra_link_args.append("-lstdc++") +elif distro_name == "redhat": + extra_link_args.append("-lusb-1.0") # --- Any platform includes include_dirs.append(numpy.get_include()) # numpy include_dirs.append(os.path.join("audela", "src","include")) # sysexp.h -- libgit2 0.21.2