diff --git a/.github/workflows/py3-test.yaml b/.github/workflows/py3-test.yaml index bc5f5107..c442526d 100644 --- a/.github/workflows/py3-test.yaml +++ b/.github/workflows/py3-test.yaml @@ -30,22 +30,6 @@ jobs: path: unit_report.html driver: - name: Driver tests (Python 3.8) - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Run tox - uses: ./.github/actions/py3-tox - with: - tox_target: fast-driver - - name: Archive results - uses: actions/upload-artifact@v3 - with: - name: driver_report - path: driver_report.html - - driver-py: name: Driver tests (Python 3.10) runs-on: ubuntu-22.04 steps: diff --git a/chirp/wxui/__init__.py b/chirp/wxui/__init__.py index bc6296b9..1102d46f 100644 --- a/chirp/wxui/__init__.py +++ b/chirp/wxui/__init__.py @@ -1,14 +1,10 @@ import argparse import builtins +from importlib import resources import logging import os import sys -if sys.version_info < (3, 10): - import importlib_resources -else: - import importlib.resources as importlib_resources - from chirp import CHIRP_VERSION from chirp import directory from chirp import logger @@ -33,14 +29,13 @@ def maybe_install_desktop(args): local = os.path.join(os.path.expanduser('~'), '.local') desktop_path = os.path.join(local, 'share', 'applications', 'chirp.desktop') - with importlib_resources.as_file( - importlib_resources.files('chirp.share') - .joinpath('chirp.desktop')) as desktop_src: + with resources.as_file( + resources.files('chirp.share').joinpath('chirp.desktop') + ) as desktop_src: with open(desktop_src) as f: desktop_content = f.readlines() - with importlib_resources.as_file( - importlib_resources.files('chirp.share') - .joinpath('chirp.ico')) as p: + with resources.as_file( + resources.files('chirp.share').joinpath('chirp.ico')) as p: icon_path = str(p) # If asked not to do this, always bail @@ -168,8 +163,7 @@ def chirpmain(): else: lang = wx.Locale.GetSystemLanguage() - localedir = str(os.path.join(importlib_resources.files('chirp'), - 'locale')) + localedir = str(os.path.join(resources.files('chirp'), 'locale')) app._lc = wx.Locale() if localedir and os.path.isdir(localedir): wx.Locale.AddCatalogLookupPathPrefix(localedir) diff --git a/chirp/wxui/main.py b/chirp/wxui/main.py index d23366d0..8e24fcab 100644 --- a/chirp/wxui/main.py +++ b/chirp/wxui/main.py @@ -16,6 +16,7 @@ import datetime import functools import hashlib +from importlib import resources import logging import os import pickle @@ -25,10 +26,6 @@ import time import typing import webbrowser -if sys.version_info < (3, 10): - import importlib_resources -else: - import importlib.resources as importlib_resources import wx import wx.aui @@ -374,9 +371,8 @@ class ChirpWelcomePanel(wx.Panel): vbox = wx.BoxSizer(wx.VERTICAL) self.SetSizer(vbox) - with importlib_resources.as_file( - importlib_resources.files('chirp.share') - .joinpath('welcome_screen.png') + with resources.as_file( + resources.files('chirp.share').joinpath('welcome_screen.png') ) as welcome: bmp = wx.Bitmap(str(welcome)) width, height = self.GetSize() @@ -453,9 +449,8 @@ class ChirpMain(wx.Frame): self.add_tab_panel = wx.Panel(self, pos=(0, 0), size=(600, 600)) self.add_tab_panel.Hide() - with importlib_resources.as_file( - importlib_resources.files('chirp.share') - .joinpath('plus-icon.png') + with resources.as_file( + resources.files('chirp.share').joinpath('plus-icon.png') ) as icon: self.add_tab_bm = wx.Bitmap(str(icon), wx.BITMAP_TYPE_ANY) @@ -525,9 +520,8 @@ class ChirpMain(wx.Frame): icon = 'chirp.ico' else: icon = 'chirp.png' - with importlib_resources.as_file( - importlib_resources.files('chirp.share') - .joinpath(icon) + with resources.as_file( + resources.files('chirp.share').joinpath(icon) ) as path: self.SetIcon(wx.Icon(str(path))) @@ -588,7 +582,7 @@ class ChirpMain(wx.Frame): dist_stock_confs = sorted( [ (conf.name, hashlib.md5(conf.read_bytes())) for conf - in importlib_resources.files('chirp.stock_configs').iterdir() + in resources.files('chirp.stock_configs').iterdir() if conf.is_file() ] ) @@ -1233,9 +1227,8 @@ class ChirpMain(wx.Frame): user_stock_dir = get_stock_configs() user_stock_conf = os.path.join(user_stock_dir, fn) - with importlib_resources.as_file( - importlib_resources.files('chirp.stock_configs') - .joinpath(fn) + with resources.as_file( + resources.files('chirp.stock_configs').joinpath(fn) ) as path: dist_stock_conf = str(path) if os.path.exists(user_stock_conf): diff --git a/requirements.txt b/requirements.txt index 4b4b6923..b08f93ee 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,5 +4,4 @@ pyserial requests pywin32; platform_system=="Windows" suds -importlib-resources;python_version<"3.10" yattag diff --git a/setup.py b/setup.py index 6de0cc5d..f251515f 100644 --- a/setup.py +++ b/setup.py @@ -7,11 +7,10 @@ setup(name='chirp', include_package_data=True, version=0, url='https://chirp.danplanet.com', - python_requires=">=3.7,<4", + python_requires=">=3.10,<4", install_requires=[ 'pyserial', 'requests', - 'importlib-resources;python_version<"3.10"', 'yattag', ], extras_require={