Commit 15dbc7051bd9706b1805112fad2e7761afb23c55

Authored by Alain Klotz
1 parent 7957f9e5
Exists in master

Some minor bugs fixed

src/guitastro_device_flipro/component_detector_shutter_flipro.py
... ... @@ -113,7 +113,7 @@ if __name__ == "__main__":
113 113 Basic example. Only simulation
114 114 """
115 115 comp = ComponentDetectorShutterFlipro("IRIS", name="test")
116   - comp.init("IRIS", name="Shutter", manufacturer="FLI")
  116 + comp.init("IRIS", name="Shutter", manufacturer="FLIPRO")
117 117 comp.verbose = 1
118 118 res = comp.command("DO", "CLOSE")
119 119 res = comp.command("GET", "state")
... ...
src/guitastro_device_flipro/component_sensor_detector_flipro.py
... ... @@ -123,6 +123,13 @@ class ComponentSensorDetectorFlipro(ComponentSensorDetector):
123 123 self._wrapper_flipro = kwargs['wrapper_flipro']
124 124 self._image = []
125 125  
  126 + SENSOR_STATE_UNKNOWN = -1
  127 + SENSOR_STATE_STOPED = 0
  128 + SENSOR_STATE_IDLE = 1
  129 + SENSOR_STATE_EXPOSING = 2
  130 + SENSOR_STATE_READING = 3
  131 +
  132 +
126 133 # ------------ del
127 134  
128 135 def __del__(self):
... ... @@ -243,7 +250,7 @@ if __name__ == "__main__":
243 250 Basic example. Only simulation
244 251 """
245 252 comp = ComponentSensorDetectorFlipro("Z", name="test")
246   - comp.init("Z", name="Camera", manufacturer="FLI")
  253 + comp.init("Z", name="Camera", manufacturer="FLIPRO")
247 254 param = {}
248 255 param["exptime"] = 1.0 # inc/s
249 256 param["binning"] = (1,1)
... ...
src/wrapper_flipro/setup.py
... ... @@ -23,15 +23,36 @@ elif psystem == "Darwin":
23 23 distro_name = psystem
24 24 distro_version = distribution[0]
25 25 elif psystem == "Linux":
26   - release = platform.release
  26 + release = platform.release()
27 27 if "microsoft" in release:
28 28 # release = '5.10.16.3-microsoft-standard-WSL2'
29 29 distro_name = release.split("-")[3]
30 30 distro_version = release.split("-")[0]
31 31 else:
32   - distribution = platform.freedesktop_os_release()
33   - distro_name = distribution['NAME']
34   - distro_version = distribution['VERSION_ID']
  32 + try:
  33 + # --- Python >= 3.10
  34 + distribution = platform.freedesktop_os_release()
  35 + distro_name = distribution['NAME']
  36 + distro_version = distribution['VERSION_ID']
  37 + except:
  38 + try:
  39 + # --- Python <= 3.7
  40 + # platform.linux_distribution()
  41 + # ('Red Hat Enterprise Linux', '8.8', 'Ootpa')
  42 + dist = platform.dist()
  43 + # ('redhat', '8.8', 'Ootpa')
  44 + distro_name = dist[0]
  45 + distro_version = dist[1]
  46 + except:
  47 + # --- Python == 3.8 or 3.9
  48 + uname = platform.uname()
  49 + # 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')
  50 + version = uname[3]
  51 + vs = version.split()
  52 + vvs = vs[0].split("-")
  53 + distro_name = vvs[-1]
  54 + distro_version = '?'
  55 +
35 56 print(f"\n{distro_name=}")
36 57 print(f"\n{distro_version=}")
37 58  
... ... @@ -50,6 +71,8 @@ if distro_name == &quot;Windows&quot;:
50 71 path_manufacturer = "libflipro-Version-1.12.59-Windows"
51 72 elif distro_name == "Ubuntu" or distro_name == "Fedora":
52 73 path_manufacturer = "libflipro-Version-2.0.5-"
  74 +elif distro_name == "redhat" :
  75 + path_manufacturer = "libflipro-Version-1.12.59-CentOSLinux"
53 76  
54 77 # =====================================================
55 78 # === Copy manufacturer resources (libraires, etc.) ===
... ... @@ -64,6 +87,10 @@ elif distro_name == &quot;Ubuntu&quot; or distro_name == &quot;Fedora&quot;:
64 87 library_dirs = [os.path.join(path_external, path_manufacturer + distro_name)]
65 88 for library_dir in library_dirs:
66 89 srcs.extend( glob.glob(os.path.join(library_dir, "*.so*")) )
  90 +elif distro_name == "redhat":
  91 + library_dirs = [os.path.join(path_external, path_manufacturer)]
  92 + for library_dir in library_dirs:
  93 + srcs.extend( glob.glob(os.path.join(library_dir, "*.so*")) )
67 94 else:
68 95 raise("No compilation found for your distribution")
69 96 # --- Copy the resource files into the current working directory
... ... @@ -95,6 +122,8 @@ elif distro_name == &quot;Ubuntu&quot; or distro_name == &quot;Fedora&quot;:
95 122 #extra_link_args.append("-lm")
96 123 extra_link_args.append("-lusb-1.0")
97 124 #extra_link_args.append("-lstdc++")
  125 +elif distro_name == "redhat":
  126 + extra_link_args.append("-lusb-1.0")
98 127 # --- Any platform includes
99 128 include_dirs.append(numpy.get_include()) # numpy
100 129 include_dirs.append(os.path.join("audela", "src","include")) # sysexp.h
... ...