hamlib exception

hamlib search order now working for openSUSE
This commit is contained in:
DJ2LS 2021-11-20 10:20:30 +01:00
parent a952b49ce6
commit 9e51eaa52f
3 changed files with 29 additions and 29 deletions

View file

@ -28,7 +28,7 @@ npm cache clean -f
sudo npm install -g n
sudo n stable
sudo apt install python3 python3-hamlib portaudio19-dev python3-pyaudio python3-pip
pip3 install psutil crcengine ujson pyserial numpy
pip3 install psutil crcengine ujson pyserial numpy structlog
git clone https://github.com/DJ2LS/FreeDATA.git
cd FreeDATA/gui

View file

@ -58,29 +58,29 @@ def noalsaerr():
# sys.path.append("hamlib/linux")
try:
from lib.hamlib.linux import Hamlib
from lib.hamlib.linux import Hamlib2
# https://stackoverflow.com/a/4703409
hamlib_version = re.findall(r"[-+]?\d*\.?\d+|\d+", Hamlib.cvar.hamlib_version)
hamlib_version = float(hamlib_version[0])
hamlib_path = "lib/hamlib/" + sys.platform
structlog.get_logger("structlog").info("[DMN] Hamlib found", version=hamlib_version, path=hamlib_path)
except ImportError:
import Hamlib
# https://stackoverflow.com/a/4703409
hamlib_version = re.findall(r"[-+]?\d*\.?\d+|\d+", Hamlib.cvar.hamlib_version)
hamlib_version = float(hamlib_version[0])
min_hamlib_version = 4.1
if hamlib_version > min_hamlib_version:
structlog.get_logger("structlog").info("[DMN] Hamlib found", version=hamlib_version, path="system")
else:
structlog.get_logger("structlog").critical("[DMN] Hamlib outdated", found=hamlib_version, needed=min_hamlib_version, path="system")
else:
# place for rigctld
pass
except ImportError:
try:
import Hamlib
# https://stackoverflow.com/a/4703409
hamlib_version = re.findall(r"[-+]?\d*\.?\d+|\d+", Hamlib.cvar.hamlib_version)
hamlib_version = float(hamlib_version[0])
min_hamlib_version = 4.1
if hamlib_version > min_hamlib_version:
structlog.get_logger("structlog").info("[DMN] Hamlib found", version=hamlib_version, path="system")
else:
structlog.get_logger("structlog").critical("[DMN] Hamlib outdated", found=hamlib_version, needed=min_hamlib_version, path="system")
except:
structlog.get_logger("structlog").critical("[DMN] Hamlib not found")
crc_algorithm = crcengine.new('crc16-ccitt-false') # load crc8 library

View file

@ -63,20 +63,20 @@ try:
hamlib_path = "/lib/hamlib/" + sys.platform
structlog.get_logger("structlog").info("[TNC] Hamlib found", version=hamlib_version, path=hamlib_path)
except ImportError:
import Hamlib
try:
import Hamlib
# https://stackoverflow.com/a/4703409
hamlib_version = re.findall(r"[-+]?\d*\.?\d+|\d+", Hamlib.cvar.hamlib_version)
hamlib_version = float(hamlib_version[0])
min_hamlib_version = 4.1
if hamlib_version > min_hamlib_version:
structlog.get_logger("structlog").info("[TNC] Hamlib found", version=hamlib_version, path="system")
else:
structlog.get_logger("structlog").critical("[TNC] Hamlib outdated", found=hamlib_version, needed=min_hamlib_version, path="system")
else:
# place for rigctld
pass
# https://stackoverflow.com/a/4703409
hamlib_version = re.findall(r"[-+]?\d*\.?\d+|\d+", Hamlib.cvar.hamlib_version)
hamlib_version = float(hamlib_version[0])
min_hamlib_version = 4.1
if hamlib_version > min_hamlib_version:
structlog.get_logger("structlog").info("[TNC] Hamlib found", version=hamlib_version, path="system")
else:
structlog.get_logger("structlog").critical("[TNC] Hamlib outdated", found=hamlib_version, needed=min_hamlib_version, path="system")
except:
structlog.get_logger("structlog").critical("[TNC] Hamlib not found")
#import rigctld