From 092a2e5ca01e20ac59f4487c3c98fc25c78c2306 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Mon, 30 Dec 2019 16:38:16 +0100 Subject: [PATCH] handle soapy not being installed at all, references #42 --- owrx/feature.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/owrx/feature.py b/owrx/feature.py index 00932df..5404ac8 100644 --- a/owrx/feature.py +++ b/owrx/feature.py @@ -221,15 +221,18 @@ class FeatureDetector(object): return self._check_connector("soapy_connector") def _has_soapy_driver(self, driver): - process = subprocess.Popen(["SoapySDRUtil", "--info"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) - driverRegex = re.compile("^Module found: .*lib(.*)Support.so") + try: + process = subprocess.Popen(["SoapySDRUtil", "--info"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) + driverRegex = re.compile("^Module found: .*lib(.*)Support.so") - def matchLine(line): - matches = driverRegex.match(line.decode()) - return matches is not None and matches.group(1) == driver + def matchLine(line): + matches = driverRegex.match(line.decode()) + return matches is not None and matches.group(1) == driver - lines = [matchLine(line) for line in process.stdout] - return reduce(or_, lines, False) + lines = [matchLine(line) for line in process.stdout] + return reduce(or_, lines, False) + except FileNotFoundError: + return False def has_soapy_sdrplay(self): """