Commit 15dbc7051bd9706b1805112fad2e7761afb23c55
1 parent
7957f9e5
Exists in
master
Some minor bugs fixed
Showing
3 changed files
with
42 additions
and
6 deletions
Show diff stats
src/guitastro_device_flipro/component_detector_shutter_flipro.py
@@ -113,7 +113,7 @@ if __name__ == "__main__": | @@ -113,7 +113,7 @@ if __name__ == "__main__": | ||
113 | Basic example. Only simulation | 113 | Basic example. Only simulation |
114 | """ | 114 | """ |
115 | comp = ComponentDetectorShutterFlipro("IRIS", name="test") | 115 | comp = ComponentDetectorShutterFlipro("IRIS", name="test") |
116 | - comp.init("IRIS", name="Shutter", manufacturer="FLI") | 116 | + comp.init("IRIS", name="Shutter", manufacturer="FLIPRO") |
117 | comp.verbose = 1 | 117 | comp.verbose = 1 |
118 | res = comp.command("DO", "CLOSE") | 118 | res = comp.command("DO", "CLOSE") |
119 | res = comp.command("GET", "state") | 119 | res = comp.command("GET", "state") |
src/guitastro_device_flipro/component_sensor_detector_flipro.py
@@ -123,6 +123,13 @@ class ComponentSensorDetectorFlipro(ComponentSensorDetector): | @@ -123,6 +123,13 @@ class ComponentSensorDetectorFlipro(ComponentSensorDetector): | ||
123 | self._wrapper_flipro = kwargs['wrapper_flipro'] | 123 | self._wrapper_flipro = kwargs['wrapper_flipro'] |
124 | self._image = [] | 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 | # ------------ del | 133 | # ------------ del |
127 | 134 | ||
128 | def __del__(self): | 135 | def __del__(self): |
@@ -243,7 +250,7 @@ if __name__ == "__main__": | @@ -243,7 +250,7 @@ if __name__ == "__main__": | ||
243 | Basic example. Only simulation | 250 | Basic example. Only simulation |
244 | """ | 251 | """ |
245 | comp = ComponentSensorDetectorFlipro("Z", name="test") | 252 | comp = ComponentSensorDetectorFlipro("Z", name="test") |
246 | - comp.init("Z", name="Camera", manufacturer="FLI") | 253 | + comp.init("Z", name="Camera", manufacturer="FLIPRO") |
247 | param = {} | 254 | param = {} |
248 | param["exptime"] = 1.0 # inc/s | 255 | param["exptime"] = 1.0 # inc/s |
249 | param["binning"] = (1,1) | 256 | param["binning"] = (1,1) |
src/wrapper_flipro/setup.py
@@ -23,15 +23,36 @@ elif psystem == "Darwin": | @@ -23,15 +23,36 @@ elif psystem == "Darwin": | ||
23 | distro_name = psystem | 23 | distro_name = psystem |
24 | distro_version = distribution[0] | 24 | distro_version = distribution[0] |
25 | elif psystem == "Linux": | 25 | elif psystem == "Linux": |
26 | - release = platform.release | 26 | + release = platform.release() |
27 | if "microsoft" in release: | 27 | if "microsoft" in release: |
28 | # release = '5.10.16.3-microsoft-standard-WSL2' | 28 | # release = '5.10.16.3-microsoft-standard-WSL2' |
29 | distro_name = release.split("-")[3] | 29 | distro_name = release.split("-")[3] |
30 | distro_version = release.split("-")[0] | 30 | distro_version = release.split("-")[0] |
31 | else: | 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 | print(f"\n{distro_name=}") | 56 | print(f"\n{distro_name=}") |
36 | print(f"\n{distro_version=}") | 57 | print(f"\n{distro_version=}") |
37 | 58 | ||
@@ -50,6 +71,8 @@ if distro_name == "Windows": | @@ -50,6 +71,8 @@ if distro_name == "Windows": | ||
50 | path_manufacturer = "libflipro-Version-1.12.59-Windows" | 71 | path_manufacturer = "libflipro-Version-1.12.59-Windows" |
51 | elif distro_name == "Ubuntu" or distro_name == "Fedora": | 72 | elif distro_name == "Ubuntu" or distro_name == "Fedora": |
52 | path_manufacturer = "libflipro-Version-2.0.5-" | 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 | # === Copy manufacturer resources (libraires, etc.) === | 78 | # === Copy manufacturer resources (libraires, etc.) === |
@@ -64,6 +87,10 @@ elif distro_name == "Ubuntu" or distro_name == "Fedora": | @@ -64,6 +87,10 @@ elif distro_name == "Ubuntu" or distro_name == "Fedora": | ||
64 | library_dirs = [os.path.join(path_external, path_manufacturer + distro_name)] | 87 | library_dirs = [os.path.join(path_external, path_manufacturer + distro_name)] |
65 | for library_dir in library_dirs: | 88 | for library_dir in library_dirs: |
66 | srcs.extend( glob.glob(os.path.join(library_dir, "*.so*")) ) | 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 | else: | 94 | else: |
68 | raise("No compilation found for your distribution") | 95 | raise("No compilation found for your distribution") |
69 | # --- Copy the resource files into the current working directory | 96 | # --- Copy the resource files into the current working directory |
@@ -95,6 +122,8 @@ elif distro_name == "Ubuntu" or distro_name == "Fedora": | @@ -95,6 +122,8 @@ elif distro_name == "Ubuntu" or distro_name == "Fedora": | ||
95 | #extra_link_args.append("-lm") | 122 | #extra_link_args.append("-lm") |
96 | extra_link_args.append("-lusb-1.0") | 123 | extra_link_args.append("-lusb-1.0") |
97 | #extra_link_args.append("-lstdc++") | 124 | #extra_link_args.append("-lstdc++") |
125 | +elif distro_name == "redhat": | ||
126 | + extra_link_args.append("-lusb-1.0") | ||
98 | # --- Any platform includes | 127 | # --- Any platform includes |
99 | include_dirs.append(numpy.get_include()) # numpy | 128 | include_dirs.append(numpy.get_include()) # numpy |
100 | include_dirs.append(os.path.join("audela", "src","include")) # sysexp.h | 129 | include_dirs.append(os.path.join("audela", "src","include")) # sysexp.h |