mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 03:32:13 +02:00
Deprecate support for Python 2 (#8491)
Fixes #8388 * Deprecate support for Python 2 * Ignore deprecation warning * Update certbot/CHANGELOG.md Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
This commit is contained in:
co-authored by
Brad Warren
parent
447b6ffaef
commit
9045c03949
@@ -6,6 +6,7 @@ This module is an implementation of the `ACME protocol`_.
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
import sys
|
import sys
|
||||||
|
import warnings
|
||||||
|
|
||||||
# This code exists to keep backwards compatibility with people using acme.jose
|
# This code exists to keep backwards compatibility with people using acme.jose
|
||||||
# before it became the standalone josepy package.
|
# before it became the standalone josepy package.
|
||||||
@@ -19,3 +20,10 @@ for mod in list(sys.modules):
|
|||||||
# preserved (acme.jose.* is josepy.*)
|
# preserved (acme.jose.* is josepy.*)
|
||||||
if mod == 'josepy' or mod.startswith('josepy.'):
|
if mod == 'josepy' or mod.startswith('josepy.'):
|
||||||
sys.modules['acme.' + mod.replace('josepy', 'jose', 1)] = sys.modules[mod]
|
sys.modules['acme.' + mod.replace('josepy', 'jose', 1)] = sys.modules[mod]
|
||||||
|
|
||||||
|
if sys.version_info[0] == 2:
|
||||||
|
warnings.warn(
|
||||||
|
"Python 2 support will be dropped in the next release of acme. "
|
||||||
|
"Please upgrade your Python version.",
|
||||||
|
PendingDeprecationWarning,
|
||||||
|
) # pragma: no cover
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ Certbot adheres to [Semantic Versioning](https://semver.org/).
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
* We deprecated support for Python 2 in Certbot and its ACME library.
|
||||||
|
Support for Python 2 will be removed in the next planned release of Certbot.
|
||||||
* certbot-auto was deprecated on all systems.
|
* certbot-auto was deprecated on all systems.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -1,4 +1,13 @@
|
|||||||
"""Certbot client."""
|
"""Certbot client."""
|
||||||
|
import warnings
|
||||||
|
import sys
|
||||||
|
|
||||||
# version number like 1.2.3a0, must have at least 2 parts, like 1.2
|
# version number like 1.2.3a0, must have at least 2 parts, like 1.2
|
||||||
__version__ = '1.11.0.dev0'
|
__version__ = '1.11.0.dev0'
|
||||||
|
|
||||||
|
if sys.version_info[0] == 2:
|
||||||
|
warnings.warn(
|
||||||
|
"Python 2 support will be dropped in the next release of Certbot. "
|
||||||
|
"Please upgrade your Python version.",
|
||||||
|
PendingDeprecationWarning,
|
||||||
|
) # pragma: no cover
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ from __future__ import print_function
|
|||||||
import functools
|
import functools
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
import sys
|
import sys
|
||||||
|
import warnings
|
||||||
|
|
||||||
import configobj
|
import configobj
|
||||||
import josepy as jose
|
import josepy as jose
|
||||||
@@ -1402,6 +1403,13 @@ def main(cli_args=None):
|
|||||||
if config.func != plugins_cmd: # pylint: disable=comparison-with-callable
|
if config.func != plugins_cmd: # pylint: disable=comparison-with-callable
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
if sys.version_info[0] == 2:
|
||||||
|
warnings.warn(
|
||||||
|
"Python 2 support will be dropped in the next release of Certbot. "
|
||||||
|
"Please upgrade your Python version.",
|
||||||
|
PendingDeprecationWarning,
|
||||||
|
) # pragma: no cover
|
||||||
|
|
||||||
set_displayer(config)
|
set_displayer(config)
|
||||||
|
|
||||||
# Reporter
|
# Reporter
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
[pytest]
|
[pytest]
|
||||||
# In general, all warnings are treated as errors. Here are the exceptions:
|
# In general, all warnings are treated as errors. Here are the exceptions:
|
||||||
# 1- decodestring: https://github.com/rthalley/dnspython/issues/338
|
# 1- decodestring: https://github.com/rthalley/dnspython/issues/338
|
||||||
|
# 2- Python 2 deprecation: https://github.com/certbot/certbot/issues/8388
|
||||||
|
# (to be removed with Certbot 1.12.0 and its drop of Python 2 support)
|
||||||
# Warnings being triggered by our plugins using deprecated features in
|
# Warnings being triggered by our plugins using deprecated features in
|
||||||
# acme/certbot should be fixed by having our plugins no longer using the
|
# acme/certbot should be fixed by having our plugins no longer using the
|
||||||
# deprecated code rather than adding them to the list of ignored warnings here.
|
# deprecated code rather than adding them to the list of ignored warnings here.
|
||||||
@@ -14,3 +16,4 @@
|
|||||||
filterwarnings =
|
filterwarnings =
|
||||||
error
|
error
|
||||||
ignore:decodestring:DeprecationWarning
|
ignore:decodestring:DeprecationWarning
|
||||||
|
ignore:Python 2 support will be dropped:PendingDeprecationWarning
|
||||||
|
|||||||
Reference in New Issue
Block a user