From 284969e7bb4e03b32a58bcb790c7f08bb968d649 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Mon, 27 Nov 2023 19:22:08 +0000 Subject: [PATCH 1/3] Raise minimum Python version to 3.9 --- .github/workflows/build.yml | 3 +-- README.rst | 2 +- doc/src/index.rst | 2 +- doc/upgrading.txt | 4 ++++ linkcheck/__init__.py | 4 ++-- pyproject.toml | 3 +-- tox.ini | 2 +- 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2bd68451..139da3b1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,13 +22,12 @@ jobs: strategy: matrix: python-version: - - "3.9" - "3.10" - "3.11" - "3.12" toxenv: [py] include: - - python-version: "3.8" + - python-version: "3.9" toxenv: minreqs services: diff --git a/README.rst b/README.rst index 9c8350ec..b515dbdf 100644 --- a/README.rst +++ b/README.rst @@ -28,7 +28,7 @@ Features Installation ------------- -Python 3.8 or later is needed. Using pip to install LinkChecker: +Python 3.9 or later is needed. Using pip to install LinkChecker: ``pip3 install linkchecker`` diff --git a/doc/src/index.rst b/doc/src/index.rst index e106b289..ed4ac8c9 100644 --- a/doc/src/index.rst +++ b/doc/src/index.rst @@ -10,7 +10,7 @@ Introduction LinkChecker is a free, `GPL `_ licensed website validator. LinkChecker checks links in web documents or full websites. -It runs on Python 3 systems, requiring Python 3.8 or later. +It runs on Python 3 systems, requiring Python 3.9 or later. Visit the project on `GitHub `_. diff --git a/doc/upgrading.txt b/doc/upgrading.txt index 7f1db863..5e7fc2d4 100644 --- a/doc/upgrading.txt +++ b/doc/upgrading.txt @@ -1,6 +1,10 @@ Upgrading ========= +Migrating from 10.3 to 10.x +--------------------------- +Python 3.9 or newer is required. + Migrating from 10.2 to 10.3 --------------------------- Python 3.8 or newer is required. diff --git a/linkcheck/__init__.py b/linkcheck/__init__.py index c8ebf39e..ce2bb3f6 100644 --- a/linkcheck/__init__.py +++ b/linkcheck/__init__.py @@ -20,11 +20,11 @@ Main package for link checking. # version checks import sys -if sys.version_info < (3, 8, 0, 'final', 0): +if sys.version_info < (3, 9, 0, 'final', 0): import platform raise SystemExit( - "This program requires Python 3.8 or later instead of %s." + "This program requires Python 3.9 or later instead of %s." % platform.python_version() ) diff --git a/pyproject.toml b/pyproject.toml index ab79206c..caee384a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,14 +11,13 @@ classifiers = [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", "Programming Language :: Python", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", ] -requires-python = ">=3.8" +requires-python = ">=3.9" dependencies = [ "requests >= 2.20", diff --git a/tox.ini b/tox.ini index f7038cf3..cd7ba097 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py3{8,9,10,11,12}, minreqs +envlist = py3{9,10,11,12}, minreqs [base] deps = From f390b7da332d75990c5e470c6649ff24847e2a2d Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Mon, 27 Nov 2023 19:22:08 +0000 Subject: [PATCH 2/3] Replace deprecated importlib.resources.path() --- linkcheck/configuration/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linkcheck/configuration/__init__.py b/linkcheck/configuration/__init__.py index 09214851..6fbd64bd 100644 --- a/linkcheck/configuration/__init__.py +++ b/linkcheck/configuration/__init__.py @@ -385,8 +385,8 @@ def get_user_config(): ) if not os.path.exists(userconf): # initial config (with all options explained) - with importlib.resources.path( - f"{PACKAGE_NAME}.data", "linkcheckerrc") as initialconf: + with importlib.resources.as_file(importlib.resources.files( + f"{PACKAGE_NAME}.data").joinpath("linkcheckerrc")) as initialconf: # copy the initial configuration to the user configuration try: make_userdir(userconf) From 33b21e4bcdd01b3cbbbd58a12bcf373dfa193cbc Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Mon, 27 Nov 2023 19:22:08 +0000 Subject: [PATCH 3/3] Avoid deprecated use of floats with ngettext tests/test_cgi.py::TestWsgi::test_application linkcheck/strformat.py:190: DeprecationWarning: Plural value must be an integer, got float time_str.append(_n(single, plural, unit) % unit) --- linkcheck/strformat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linkcheck/strformat.py b/linkcheck/strformat.py index 0783fab7..f047fb64 100644 --- a/linkcheck/strformat.py +++ b/linkcheck/strformat.py @@ -22,6 +22,7 @@ Various string utility functions. Note that these functions are not necessarily optimised for large strings, so use with care. """ +import math import re import textwrap import os @@ -187,7 +188,7 @@ def strduration_long(duration, do_translate=True): else: duration, unit = divmod(duration, divisor) if unit: - time_str.append(_n(single, plural, unit) % unit) + time_str.append(_n(single, plural, math.ceil(unit)) % unit) time_str.reverse() if len(time_str) > 2: time_str.pop()