From 9c3c186a23128fe2cfc5d8619997b5d1f5f1650c Mon Sep 17 00:00:00 2001 From: John Marzulli Date: Thu, 19 Oct 2023 13:56:54 -0700 Subject: [PATCH 1/4] Fix formatting issue that caused newer versions of Python to be treated as older versions --- lib/local_debug.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/local_debug.py b/lib/local_debug.py index 5f5add6..8ef94d3 100644 --- a/lib/local_debug.py +++ b/lib/local_debug.py @@ -8,7 +8,9 @@ from sys import platform as os_platform import platform -REQUIRED_PYTHON_VERSION = 3.5 +REQUIRED_PYTHON_MAJOR_VERSION = 3 +REQUIRED_PYTHON_REVISION_VERSION = 5 + IS_LINUX = 'linux' in os_platform DETECTED_CPU = platform.machine() IS_PI = "arm" in DETECTED_CPU @@ -22,15 +24,18 @@ def validate_python_version(): Exception -- If the version of Python is not new enough. """ - python_version = float('{}.{}'.format( - version_info.major, version_info.minor)) - error_text = 'Requires Python {}'.format(REQUIRED_PYTHON_VERSION) + error_text = None + + if REQUIRED_PYTHON_MAJOR_VERSION != version_info.major: + error_text = 'Requires Python 3.x, found {}.x'.format(version_info.major) - if python_version < REQUIRED_PYTHON_VERSION: + if REQUIRED_PYTHON_REVISION_VERSION > version_info.minor: + error_text = 'Requires Python 3.5 or newer, found 3.{}'.format(version_info.minor) + + if error_text != None: print(error_text) raise Exception(error_text) - def is_debug(): """ returns True if this should be run as a local debug (Mac or Windows). From 5d9b95a01e70846806939358c463a29e86644e29 Mon Sep 17 00:00:00 2001 From: John Marzulli Date: Thu, 19 Oct 2023 13:57:20 -0700 Subject: [PATCH 2/4] Update to use newer version of NOAA's site --- data_sources/weather.py | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/data_sources/weather.py b/data_sources/weather.py index 459c87c..2eefc5c 100644 --- a/data_sources/weather.py +++ b/data_sources/weather.py @@ -646,28 +646,23 @@ def get_metar_reports_from_web( metars = {} metar_list = "%20".join(airport_icao_codes) - request_url = 'http://www.aviationweather.gov/metar/data?ids={}&format=raw&hours=0&taf=off&layout=off&date=0'.format( - metar_list) + request_url = 'https://aviationweather.gov/cgi-bin/data/metar.php?ids={}&hours=0&order=id%2C-obs&sep=true'.format(metar_list) stream = urllib.request.urlopen(request_url, timeout=2) - data_found = False + stream_lines = stream.readlines() stream.close() for line in stream_lines: line_as_string = line.decode("utf-8") - if '' in line_as_string: - data_found = True - elif '' in line_as_string: - break - elif data_found: - identifier, metar = get_metar_from_report_line(line_as_string) - - if identifier is None: - continue - - # If we get a good report, go ahead and shove it into the results. - if metar is not None: - metars[identifier] = metar - __station_last_called__[identifier] = datetime.utcnow() + + identifier, metar = get_metar_from_report_line(line_as_string) + + if identifier is None: + continue + + # If we get a good report, go ahead and shove it into the results. + if metar is not None: + metars[identifier] = metar + __station_last_called__[identifier] = datetime.utcnow() return metars From 2dbf7736416467fc6ca07f2b1c30e59d9d597108 Mon Sep 17 00:00:00 2001 From: John Marzulli Date: Thu, 19 Oct 2023 13:58:37 -0700 Subject: [PATCH 3/4] Update software version --- readme.md | 1 + setup.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 4af017e..25b3819 100644 --- a/readme.md +++ b/readme.md @@ -451,6 +451,7 @@ This mode cycles all of the stations through the spectrum, but all stations shif | Version | Change | | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 2.1.1 | Fix issue where newer versions of Python would not let the code to run. Update to newer NOAA source. | 2.1 | Change precipitation visualizer to pulse the snow color to make it distinct from "nothing" | 2.0.1 | Minor tweak to ceiling categorization. | | 2.0 | Add a remote control app that allows for brightness, night effects, and more to be changed on the fly. Add support for WS2811 and WS2812 based lights. Major performance improvements for adressable RGB LEDs. Selectable visualizers. Removed support for hard wired GPIO based LEDs. | diff --git a/setup.py b/setup.py index 3886ed1..10abc9b 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ setup( name='cateorical-sectional', - version='2.1', + version='2.2.1', python_requires='>=3.7', description='VFR weathermap supporting Adafruit WS2801 lights.', url='https://github.com/JohnMarzulli/categorical-sectional', From 1807123a970dcf35afe28bbf19c7a068f81a456b Mon Sep 17 00:00:00 2001 From: John Marzulli Date: Thu, 19 Oct 2023 14:19:22 -0700 Subject: [PATCH 4/4] More release notes. --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 25b3819..ac3e09a 100644 --- a/readme.md +++ b/readme.md @@ -451,7 +451,7 @@ This mode cycles all of the stations through the spectrum, but all stations shif | Version | Change | | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 2.1.1 | Fix issue where newer versions of Python would not let the code to run. Update to newer NOAA source. +| 2.1.1 | Fix issue where newer versions of Python would not let the code to run. Update to newer NOAA source. Show name of visualizer. | 2.1 | Change precipitation visualizer to pulse the snow color to make it distinct from "nothing" | 2.0.1 | Minor tweak to ceiling categorization. | | 2.0 | Add a remote control app that allows for brightness, night effects, and more to be changed on the fly. Add support for WS2811 and WS2812 based lights. Major performance improvements for adressable RGB LEDs. Selectable visualizers. Removed support for hard wired GPIO based LEDs. |