Skip to content

Commit

Permalink
HyperNav Analysis Tab enable through GitHub Workflow
Browse files Browse the repository at this point in the history
- Improve error if aquasense package is missing
  • Loading branch information
doizuc committed Jul 30, 2024
1 parent 7fddd04 commit 92ffb11
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
11 changes: 7 additions & 4 deletions inlinino/instruments/hydroscat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from inlinino.log import Log

try:
import aquasense.hydroscat
from aquasense.hydroscat import HydroScat as ASHydroScat
except ImportError:
pass
ASHydroScat = None

from datetime import datetime

Expand Down Expand Up @@ -35,7 +35,7 @@ def __init__(self, uuid, cfg, *args, **kwargs):
self._io = io.TextIOWrapper(io.BufferedRWPair(self._interface._serial, self._interface._serial))

# Instrument state machine
self.hydroscat: aquasense.hydroscat.HydroScat = None
self.hydroscat: ASHydroScat = None
self.output_cal_header = None
self.state = "IDLE"
self.previous_state = None
Expand Down Expand Up @@ -85,7 +85,10 @@ def setup(self, cfg):
if errmsgs:
raise ValueError('\n'.join(errmsgs))

self.hydroscat = aquasense.hydroscat.HydroScat(
if ASHydroScat is None:
raise ImportError("Package `aquasense` required.")

self.hydroscat = ASHydroScat(
cal_path=cfg["calibration_file"], in_out=self._io,
out=None, sep=",", serial_mode=False,
burst_mode=cfg["burst_mode"],
Expand Down
14 changes: 12 additions & 2 deletions make.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

import PyInstaller.__main__
import pyqtgraph
try:
import hypernav
except ImportError:
hypernav = None


root = os.path.join('.', 'bundle')
Expand Down Expand Up @@ -47,6 +51,12 @@
(os.path.join(os.path.dirname(pyqtgraph.__file__), 'icons', '*.png'), os.path.join('pyqtgraph', 'icons')),
(os.path.join(os.path.dirname(pyqtgraph.__file__), 'icons', '*.svg'), os.path.join('pyqtgraph', 'icons')),
]
if hypernav is not None:
ls.extend([
(os.path.join(os.path.dirname(hypernav.__file__), 'bin', '*.exe'), os.path.join('hypernav', 'bin')),
(os.path.join(os.path.dirname(hypernav.__file__), 'calibrate', 'templates', '*.txt'),
os.path.join('hypernav', 'calibrate', 'templates'))
])
for item, dest in ls:
add_data.append(f'--add-data={os.path.abspath(item)}{data_sep}{dest}')
# Require absolute path for GitHub workflow as data can be on different drive and relpath won't work.
Expand All @@ -67,11 +77,11 @@
f'--distpath={os.path.join(root, "dist")}',
f'--workpath={os.path.join(root, "build")}',
f'--specpath={root}',
# '--windowed',
'--windowed',
'--noconfirm',
# '--log-level=DEBUG',
# '--clean',
'--debug=imports',
# '--debug=imports',
*add_data,
*hidden_imports,
*os_specific_args,
Expand Down

0 comments on commit 92ffb11

Please sign in to comment.