remove python 3.8 support (#10077)

fixes https://github.com/certbot/certbot/issues/10035. you can compare
this to the PR that did this for python 3.7 at
https://github.com/certbot/certbot/pull/9792

i agree with erica's comment at
https://github.com/certbot/certbot/issues/10035#issuecomment-2452212686,
but felt this PR was already getting pretty large so i did that in a
second PR at https://github.com/certbot/certbot/pull/10076
This commit is contained in:
Brad Warren
2024-12-04 14:55:20 -08:00
committed by GitHub
parent bcbc3dd484
commit 087cb4d1f4
38 changed files with 329 additions and 398 deletions
+2
View File
@@ -10,6 +10,8 @@ Certbot adheres to [Semantic Versioning](https://semver.org/).
### Changed
* Python 3.8 support was removed.
* certbot-dns-rfc2136's minimum required version of dnspython is now 2.6.1.
* Updated our Docker images to be based on Alpine Linux 3.20.
* Our runtime dependency on setuptools has been dropped from all Certbot
components.
-9
View File
@@ -1,13 +1,4 @@
"""Certbot client."""
import sys
import warnings
# version number like 1.2.3a0, must have at least 2 parts, like 1.2
__version__ = '3.1.0.dev0'
if sys.version_info[:2] == (3, 8):
warnings.warn(
"Python 3.8 support will be dropped in the next planned release of "
"certbot. Please upgrade your Python version.",
PendingDeprecationWarning,
) # pragma: no cover
-4
View File
@@ -1866,10 +1866,6 @@ def main(cli_args: Optional[List[str]] = None) -> Optional[Union[str, int]]:
if config.func != plugins_cmd: # pylint: disable=comparison-with-callable
raise
if sys.version_info[:2] == (3, 8):
logger.warning("Python 3.8 support will be dropped in the next planned release "
"of Certbot - please upgrade your Python version.")
with make_displayer(config) as displayer:
display_obj.set_display(displayer)
@@ -631,10 +631,6 @@ class ReadlinkTest(unittest.TestCase):
@unittest.skipIf(POSIX_MODE, reason='Tests specific to Windows')
@mock.patch("certbot.compat.filesystem.os.readlink")
def test_normal_path_windows(self, mock_readlink):
# Python <3.8
mock_readlink.return_value = "C:\\short\\path"
assert filesystem.readlink("dummy") == "C:\\short\\path"
# Python >=3.8 (os.readlink always returns the extended form)
mock_readlink.return_value = "\\\\?\\C:\\short\\path"
assert filesystem.readlink("dummy") == "C:\\short\\path"
@@ -218,7 +218,6 @@ class PostHookTest(HookTest):
assert not self._call_with_mock_execute(self.config, []).called
assert not self._get_eventually()
@unittest.skipIf(pyver_lt(3, 8), "Python 3.8+ required for this test.")
def test_renew_env(self):
self.config.verb = "certonly"
args = self._call_with_mock_execute(self.config, ["success.org"]).call_args
@@ -308,7 +307,6 @@ class RunSavedPostHooksTest(HookTest):
mock_execute = self._call_with_mock_execute_and_eventually([], [])
mock_execute.assert_called_once_with("post-hook", self.eventually[0], env=mock.ANY)
@unittest.skipIf(pyver_lt(3, 8), "Python 3.8+ required for this test.")
def test_env(self):
self.eventually = ["foo"]
mock_execute = self._call_with_mock_execute_and_eventually(["success.org"], ["failed.org"])
+10 -25
View File
@@ -5,11 +5,9 @@ from contextlib import contextmanager
import errno
import os # pylint: disable=os-module-forbidden
import stat
import sys
from typing import Any
from typing import Dict
from typing import Generator
from typing import List
from typing import Optional
try:
@@ -370,27 +368,14 @@ def realpath(file_path: str) -> str:
"""
original_path = file_path
# Since Python 3.8, os.path.realpath also resolves symlinks on Windows.
if POSIX_MODE or sys.version_info >= (3, 8):
path = os.path.realpath(file_path)
if os.path.islink(path):
# If path returned by realpath is still a link, it means that it failed to
# resolve the symlink because of a loop.
# See realpath code: https://github.com/python/cpython/blob/master/Lib/posixpath.py
raise RuntimeError('Error, link {0} is a loop!'.format(original_path))
return path
inspected_paths: List[str] = []
while os.path.islink(file_path):
link_path = file_path
file_path = os.readlink(file_path)
if not os.path.isabs(file_path):
file_path = os.path.join(os.path.dirname(link_path), file_path)
if file_path in inspected_paths:
raise RuntimeError('Error, link {0} is a loop!'.format(original_path))
inspected_paths.append(file_path)
return os.path.abspath(file_path)
# os.path.realpath also resolves symlinks
path = os.path.realpath(file_path)
if os.path.islink(path):
# If path returned by realpath is still a link, it means that it failed to
# resolve the symlink because of a loop.
# See realpath code: https://github.com/python/cpython/blob/master/Lib/posixpath.py
raise RuntimeError('Error, link {0} is a loop!'.format(original_path))
return path
def readlink(link_path: str) -> str:
@@ -404,11 +389,11 @@ def readlink(link_path: str) -> str:
"""
path = os.readlink(link_path)
if POSIX_MODE or not path.startswith('\\\\?\\'):
if POSIX_MODE:
return path
# At this point, we know we are on Windows and that the path returned uses
# the extended form which is done for all paths in Python 3.8+
# the extended form which begins with the prefix \\?\
# Max length of a normal path is 260 characters on Windows, including the non printable
# termination character "<NUL>". The termination character is not included in Python
+1 -2
View File
@@ -99,7 +99,7 @@ setup(
author="Certbot Project",
author_email='certbot-dev@eff.org',
license='Apache License 2.0',
python_requires='>=3.8',
python_requires='>=3.9',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
@@ -109,7 +109,6 @@ setup(
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',