Skip to content

Commit

Permalink
Restored Python 3.8 compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Apr 27, 2024
1 parent d4f3fd8 commit 035ebe0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
# https://blog.jaraco.com/efficient-use-of-ci-resources/
matrix:
python:
- "3.9"
- "3.8"
- "3.12"
platform:
- ubuntu-latest
Expand Down
6 changes: 4 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import platform
from importlib.resources import files

import pytest
from mockproc import mockprocess
Expand All @@ -16,11 +15,14 @@
@pytest.fixture(scope='session', autouse=True)
def hdhomerun_config_mocked():
import jaraco.home.hdhomerun as hd
from jaraco.home.compat.py38 import resources

hd.hdhomerun_config = 'hdhomerun_config'
scripts = mockprocess.MockProc()
script = (
files('jaraco.home').joinpath('mock hdhomerun.py').read_text(encoding='utf-8')
resources.files('jaraco.home')
.joinpath('mock hdhomerun.py')
.read_text(encoding='utf-8')
)
scripts.append('hdhomerun_config', returncode=0, script=script)
with scripts:
Expand Down
5 changes: 3 additions & 2 deletions jaraco/home/hdhomerun.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
import subprocess
import sys
import time
from importlib.resources import files

import keyring

from .compat.py38 import resources

from jaraco.collections import DictStack
from jaraco.functools import retry
from jaraco.mongodb.helper import connect_db
Expand Down Expand Up @@ -112,7 +113,7 @@ def install():
name = 'Gather HDHomeRun Stats.plist'
agents = pathlib.Path('~/Library/LaunchAgents').expanduser()
target = agents / name
tmpl_name = files(__package__) / name
tmpl_name = resources.files(__package__) / name
tmpl = tmpl_name.read_text()
logs = pathlib.Path(sys.executable).parent.parent / 'logs'
source = tmpl.format(sys=sys, logs=logs)
Expand Down
4 changes: 3 additions & 1 deletion jaraco/home/report-spam-call.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from splinter import Browser

from . import contact as contact_info
from .compat.py38 import removeprefix


DROPPED_CALL = '2'

Expand All @@ -15,7 +17,7 @@ def clean_phone(number):
>>> clean_phone("+1 202 555 1212")
'2025551212'
"""
return re.sub(r'[-. ]', '', number.removeprefix('+1'))
return re.sub(r'[-. ]', '', removeprefix(number, '+1'))


@autocommand.autocommand(__name__)
Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
]
requires-python = ">=3.9"
requires-python = ">=3.8"
dependencies = [
"requests",
"lxml>=4.2.6",
Expand All @@ -30,6 +30,10 @@ dependencies = [
"autocommand",
"python-dateutil",
"victor-smart-kill",
'importlib_resources; python_version < "3.9"',

# workaround for https://bugs.launchpad.net/lxml/+bug/2063945
'lxml<5; python_version<"3.9" and platform_system=="Darwin"',
]
dynamic = ["version"]

Expand Down

0 comments on commit 035ebe0

Please sign in to comment.