mirror of
https://github.com/smittix/intercept.git
synced 2026-06-08 06:01:56 -07:00
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:
@@ -85,11 +85,13 @@ def generate_station_cfg(
|
||||
udp_port: int = RADIOSONDE_UDP_PORT,
|
||||
) -> str:
|
||||
"""Generate a station.cfg for radiosonde_auto_rx and return the file path."""
|
||||
cfg_dir = os.path.join('data', 'radiosonde')
|
||||
os.makedirs(cfg_dir, exist_ok=True)
|
||||
cfg_dir = os.path.abspath(os.path.join('data', 'radiosonde'))
|
||||
log_dir = os.path.join(cfg_dir, 'logs')
|
||||
os.makedirs(log_dir, exist_ok=True)
|
||||
cfg_path = os.path.join(cfg_dir, 'station.cfg')
|
||||
|
||||
# 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
|
||||
[search_params]
|
||||
min_freq = {freq_min}
|
||||
@@ -122,7 +124,7 @@ station_alt = 0.0
|
||||
|
||||
[logging]
|
||||
per_sonde_log = True
|
||||
log_directory = ./data/radiosonde/logs
|
||||
log_directory = {log_dir}
|
||||
|
||||
[advanced]
|
||||
web_host = 127.0.0.1
|
||||
@@ -414,12 +416,12 @@ def start_radiosonde():
|
||||
bias_t=bias_t,
|
||||
)
|
||||
|
||||
# Build command
|
||||
cfg_dir = os.path.dirname(os.path.abspath(cfg_path))
|
||||
# Build command - auto_rx -c expects a file path, not a directory
|
||||
cfg_abs = os.path.abspath(cfg_path)
|
||||
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:
|
||||
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
|
||||
auto_rx_dir = os.path.dirname(os.path.abspath(auto_rx_path))
|
||||
|
||||
@@ -12,6 +12,14 @@ logger = logging.getLogger('intercept.dependencies')
|
||||
# Additional paths to search for tools (e.g., /usr/sbin on Debian)
|
||||
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:
|
||||
"""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):
|
||||
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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user