From 5a1ca05e08426a421f7d970caab8c64d75ab9e1e Mon Sep 17 00:00:00 2001 From: Adrien Ferrand Date: Fri, 17 Jul 2020 23:05:32 +0200 Subject: [PATCH] Add warnings about Python 3.5 deprecation in Certbot --- acme/acme/__init__.py | 8 ++++++++ certbot/CHANGELOG.md | 3 ++- certbot/certbot/__init__.py | 9 +++++++++ certbot/certbot/_internal/main.py | 4 ++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/acme/acme/__init__.py b/acme/acme/__init__.py index d1679fcad..c16f95826 100644 --- a/acme/acme/__init__.py +++ b/acme/acme/__init__.py @@ -20,3 +20,11 @@ for mod in list(sys.modules): # preserved (acme.jose.* is josepy.*) if mod == 'josepy' or mod.startswith('josepy.'): sys.modules['acme.' + mod.replace('josepy', 'jose', 1)] = sys.modules[mod] + + +if sys.version_info[:2] == (3, 5): + warnings.warn( + "Python 3.5 support will be dropped in the next release of " + "acme. Please upgrade your Python version.", + PendingDeprecationWarning, + ) # pragma: no cover diff --git a/certbot/CHANGELOG.md b/certbot/CHANGELOG.md index 8124d1e0c..2da269713 100644 --- a/certbot/CHANGELOG.md +++ b/certbot/CHANGELOG.md @@ -12,7 +12,8 @@ Certbot adheres to [Semantic Versioning](https://semver.org/). ### Changed -* +* We deprecated support for Python 3.5 in Certbot and its ACME library. + Support for Python 3.5 will be removed in the next major release of Certbot. ### Fixed diff --git a/certbot/certbot/__init__.py b/certbot/certbot/__init__.py index 4db5f1e39..0c180336d 100644 --- a/certbot/certbot/__init__.py +++ b/certbot/certbot/__init__.py @@ -1,4 +1,13 @@ """Certbot client.""" +import warnings +import sys # version number like 1.2.3a0, must have at least 2 parts, like 1.2 __version__ = '1.7.0.dev0' + +if sys.version_info[:2] == (3, 5): + warnings.warn( + "Python 3.5 support will be dropped in the next release of " + "acme. Please upgrade your Python version.", + PendingDeprecationWarning, + ) # pragma: no cover \ No newline at end of file diff --git a/certbot/certbot/_internal/main.py b/certbot/certbot/_internal/main.py index 30f4dd0a2..6cf2ccf17 100644 --- a/certbot/certbot/_internal/main.py +++ b/certbot/certbot/_internal/main.py @@ -1343,6 +1343,10 @@ def main(cli_args=None): if config.func != plugins_cmd: # pylint: disable=comparison-with-callable raise + if sys.version_info[:2] == (3, 5): + logger.warning("Python 3.5 support will be dropped in the next release " + "of Certbot - please upgrade your Python version.") + set_displayer(config) # Reporter