Drop support for Python <3.10

This commit is contained in:
Dan Smith 2024-04-10 18:27:41 -07:00 committed by Dan Smith
parent 3470e8136e
commit ef783cb14b
5 changed files with 18 additions and 49 deletions

View File

@ -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:

View File

@ -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)

View File

@ -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):

View File

@ -4,5 +4,4 @@ pyserial
requests
pywin32; platform_system=="Windows"
suds
importlib-resources;python_version<"3.10"
yattag

View File

@ -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={