fix: radiosonde config path and dependency detection

- Pass config file path (not directory) to auto_rx -c flag
- Use absolute paths in generated station.cfg since auto_rx runs
  with cwd set to its install directory
- Teach dependency checker about auto_rx.py at /opt install path
  so the "missing dependency" banner no longer appears

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Smittix
2026-02-27 11:27:16 +00:00
parent 7f8395a7f7
commit 4e576d83a1
2 changed files with 22 additions and 7 deletions
+9 -7
View File
@@ -85,11 +85,13 @@ def generate_station_cfg(
udp_port: int = RADIOSONDE_UDP_PORT, udp_port: int = RADIOSONDE_UDP_PORT,
) -> str: ) -> str:
"""Generate a station.cfg for radiosonde_auto_rx and return the file path.""" """Generate a station.cfg for radiosonde_auto_rx and return the file path."""
cfg_dir = os.path.join('data', 'radiosonde') cfg_dir = os.path.abspath(os.path.join('data', 'radiosonde'))
os.makedirs(cfg_dir, exist_ok=True) log_dir = os.path.join(cfg_dir, 'logs')
os.makedirs(log_dir, exist_ok=True)
cfg_path = os.path.join(cfg_dir, 'station.cfg') cfg_path = os.path.join(cfg_dir, 'station.cfg')
# Minimal station.cfg that auto_rx needs # Minimal station.cfg that auto_rx needs
# Use absolute paths since auto_rx runs with cwd set to its install dir
cfg = f"""# Auto-generated by INTERCEPT for radiosonde_auto_rx cfg = f"""# Auto-generated by INTERCEPT for radiosonde_auto_rx
[search_params] [search_params]
min_freq = {freq_min} min_freq = {freq_min}
@@ -122,7 +124,7 @@ station_alt = 0.0
[logging] [logging]
per_sonde_log = True per_sonde_log = True
log_directory = ./data/radiosonde/logs log_directory = {log_dir}
[advanced] [advanced]
web_host = 127.0.0.1 web_host = 127.0.0.1
@@ -414,12 +416,12 @@ def start_radiosonde():
bias_t=bias_t, bias_t=bias_t,
) )
# Build command # Build command - auto_rx -c expects a file path, not a directory
cfg_dir = os.path.dirname(os.path.abspath(cfg_path)) cfg_abs = os.path.abspath(cfg_path)
if auto_rx_path.endswith('.py'): if auto_rx_path.endswith('.py'):
cmd = [sys.executable, auto_rx_path, '-c', cfg_dir] cmd = [sys.executable, auto_rx_path, '-c', cfg_abs]
else: else:
cmd = [auto_rx_path, '-c', cfg_dir] cmd = [auto_rx_path, '-c', cfg_abs]
# Set cwd to the auto_rx directory so 'from autorx.scan import ...' works # Set cwd to the auto_rx directory so 'from autorx.scan import ...' works
auto_rx_dir = os.path.dirname(os.path.abspath(auto_rx_path)) auto_rx_dir = os.path.dirname(os.path.abspath(auto_rx_path))
+13
View File
@@ -12,6 +12,14 @@ logger = logging.getLogger('intercept.dependencies')
# Additional paths to search for tools (e.g., /usr/sbin on Debian) # Additional paths to search for tools (e.g., /usr/sbin on Debian)
EXTRA_TOOL_PATHS = ['/usr/sbin', '/sbin'] EXTRA_TOOL_PATHS = ['/usr/sbin', '/sbin']
# Tools installed to non-standard locations (not on PATH)
KNOWN_TOOL_PATHS: dict[str, list[str]] = {
'auto_rx.py': [
'/opt/radiosonde_auto_rx/auto_rx/auto_rx.py',
'/opt/auto_rx/auto_rx.py',
],
}
def check_tool(name: str) -> bool: def check_tool(name: str) -> bool:
"""Check if a tool is installed.""" """Check if a tool is installed."""
@@ -51,6 +59,11 @@ def get_tool_path(name: str) -> str | None:
if os.path.isfile(full_path) and os.access(full_path, os.X_OK): if os.path.isfile(full_path) and os.access(full_path, os.X_OK):
return full_path return full_path
# Check known non-standard install locations
for known_path in KNOWN_TOOL_PATHS.get(name, []):
if os.path.isfile(known_path):
return known_path
return None return None