Merge pull request #154 from darksidelemm/testing

Add version check on startup.
pull/161/head
Mark Jessop 2019-03-24 16:51:29 +10:30 zatwierdzone przez GitHub
commit 7ce244785d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 32 dodań i 3 usunięć

Wyświetl plik

@ -26,7 +26,7 @@ from autorx.habitat import HabitatUploader
from autorx.aprs import APRSUploader
from autorx.ozimux import OziUploader
from autorx.rotator import Rotator
from autorx.utils import rtlsdr_test, position_info, check_rs_utils
from autorx.utils import rtlsdr_test, position_info, check_rs_utils, check_autorx_version
from autorx.config import read_auto_rx_config
from autorx.web import start_flask, stop_flask, flask_emit_event, WebHandler, WebExporter
@ -593,6 +593,8 @@ def main():
# MQTT (?) - TODO
check_autorx_version()
# Note the start time.
_start_time = time.time()

Wyświetl plik

@ -12,11 +12,13 @@ import logging
import os
import platform
import re
import requests
import subprocess
import threading
import time
import numpy as np
from math import radians, degrees, sin, cos, atan2, sqrt, pi
from . import __version__ as auto_rx_version
try:
# Python 2
from Queue import Queue
@ -40,6 +42,32 @@ def check_rs_utils():
return True
AUTORX_VERSION_URL = "https://raw.githubusercontent.com/projecthorus/radiosonde_auto_rx/master/auto_rx/autorx/__init__.py"
def check_autorx_version():
""" Grab the latest __init__ file from Github and compare the version with our current version. """
try:
_r = requests.get(AUTORX_VERSION_URL,timeout=5)
except Exception as e:
logging.error("Version - Error determining latest master version - %s" % str(e))
return
_version = "Unknown"
try:
for _line in _r.text.split('\n'):
if _line.startswith("__version__"):
_version = _line.split('=')[1]
_version = _version.replace("\"", "").strip()
break
except Exception as e:
logging.error("Version - Error determining latest master version.")
logging.info("Version - Local Version: %s Current Master Version: %s" % (auto_rx_version, _version))
class AsynchronousFileReader(threading.Thread):
""" Asynchronous File Reader
Helper class to implement asynchronous reading of a file
@ -714,5 +742,4 @@ def peak_decimation(freq, power, factor):
if __name__ == "__main__":
import sys
logging.basicConfig(format='%(asctime)s %(levelname)s:%(message)s', level=logging.DEBUG)
print(lsusb())
print(rtlsdr_test(sys.argv[1]))
check_autorx_version()