From 643364a6558a848f464e6179bf061b9cb1f07296 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Tue, 17 Jan 2023 19:23:29 +0000 Subject: [PATCH 1/2] Raise minimum Python version to 3.8 --- .github/workflows/build.yml | 3 +-- README.rst | 2 +- doc/changelog.txt | 6 ++++++ doc/i18n/gettext/index.pot | 2 +- doc/i18n/locales/de/LC_MESSAGES/index.po | 2 +- doc/src/index.rst | 2 +- doc/upgrading.txt | 5 +++++ linkcheck/__init__.py | 4 ++-- pyproject.toml | 3 +-- tox.ini | 2 +- 10 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e88033f9..01d6bdfb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,13 +20,12 @@ jobs: strategy: matrix: python-version: - - "3.8" - "3.9" - "3.10" - "3.11" toxenv: [py] include: - - python-version: "3.7" + - python-version: "3.8" toxenv: minreqs steps: diff --git a/README.rst b/README.rst index 50307e92..15d81bdd 100644 --- a/README.rst +++ b/README.rst @@ -28,7 +28,7 @@ Features Installation ------------- -Python 3.7 or later is needed. Using pip to install LinkChecker: +Python 3.8 or later is needed. Using pip to install LinkChecker: ``pip3 install linkchecker`` diff --git a/doc/changelog.txt b/doc/changelog.txt index 588bdb05..6a9c3466 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -1,3 +1,9 @@ +10.x + +Changes: +- Minimum Python version required is 3.8 + + 10.2.1 (released 05.12.2022) Fixes diff --git a/doc/i18n/gettext/index.pot b/doc/i18n/gettext/index.pot index e1abba1a..d2f34ea4 100644 --- a/doc/i18n/gettext/index.pot +++ b/doc/i18n/gettext/index.pot @@ -25,7 +25,7 @@ msgid "Introduction" msgstr "" #: ../../src/index.rst:10 -msgid "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.7 or later." +msgid "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." msgstr "" #: ../../src/index.rst:15 diff --git a/doc/i18n/locales/de/LC_MESSAGES/index.po b/doc/i18n/locales/de/LC_MESSAGES/index.po index 569ba4f7..c0c16bcb 100644 --- a/doc/i18n/locales/de/LC_MESSAGES/index.po +++ b/doc/i18n/locales/de/LC_MESSAGES/index.po @@ -30,7 +30,7 @@ msgstr "" msgid "" "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.7 or " +"full websites. It runs on Python 3 systems, requiring Python 3.8 or " "later." msgstr "" diff --git a/doc/src/index.rst b/doc/src/index.rst index 4a976d98..86e376ab 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.7 or later. +It runs on Python 3 systems, requiring Python 3.8 or later. Visit the project on `GitHub `_. diff --git a/doc/upgrading.txt b/doc/upgrading.txt index f8c9e861..49d82630 100644 --- a/doc/upgrading.txt +++ b/doc/upgrading.txt @@ -1,5 +1,10 @@ Upgrading ========= + +Migrating from 10.2 to 10.x +--------------------------- +Python 3.8 or newer is required. + Migrating from 10.1 to 10.2 --------------------------- Python 3.7 or newer is required. diff --git a/linkcheck/__init__.py b/linkcheck/__init__.py index b342f80a..e522c39a 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, 7, 0, 'final', 0): +if sys.version_info < (3, 8, 0, 'final', 0): import platform raise SystemExit( - "This program requires Python 3.7 or later instead of %s." + "This program requires Python 3.8 or later instead of %s." % platform.python_version() ) diff --git a/pyproject.toml b/pyproject.toml index c4be6685..e354d479 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.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", ] -requires-python = ">=3.7" +requires-python = ">=3.8" dependencies = [ "requests >= 2.20", diff --git a/tox.ini b/tox.ini index eff1a51c..141f0d6c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py3{7,8,9,10,11}, minreqs +envlist = py3{8,9,10,11}, minreqs [base] deps = From 926932411d5ed6f952657b35c51d451d0a4d2363 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Tue, 17 Jan 2023 19:23:29 +0000 Subject: [PATCH 2/2] Only attempt to get rel attribute from link elements --- linkcheck/htmlutil/linkparse.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linkcheck/htmlutil/linkparse.py b/linkcheck/htmlutil/linkparse.py index d8b586aa..94acdfcf 100644 --- a/linkcheck/htmlutil/linkparse.py +++ b/linkcheck/htmlutil/linkparse.py @@ -159,8 +159,8 @@ class LinkFinder: base = self.base_ref # note: value can be None value = attrs.get(attr) - rel = attrs.get('rel', '').lower() - if tag == 'link' and ('dns-prefetch' in rel or 'preconnect' in rel): + if tag == 'link' and (rel := attrs.get('rel', '').lower()) \ + and ('dns-prefetch' in rel or 'preconnect' in rel): if ':' in value: value = value.split(':', 1)[1] value = 'dns:' + value.rstrip('/')