mirror of
https://github.com/certbot/certbot.git
synced 2026-07-28 08:45:22 +02:00
Add deprecation warning for Python 2.6 (#5391)
* Add deprecation warning for Python 2.6 * Allow disabling Python 2.6 warning
This commit is contained in:
@@ -13,9 +13,10 @@ supported version: `draft-ietf-acme-01`_.
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
if sys.version_info[:2] == (3, 3):
|
||||
warnings.warn(
|
||||
"Python 3.3 support will be dropped in the next release of "
|
||||
"acme. Please upgrade your Python version.",
|
||||
PendingDeprecationWarning,
|
||||
) #pragma: no cover
|
||||
for (major, minor) in [(2, 6), (3, 3)]:
|
||||
if sys.version_info[:2] == (major, minor):
|
||||
warnings.warn(
|
||||
"Python {0}.{1} support will be dropped in the next release of "
|
||||
"acme. Please upgrade your Python version.".format(major, minor),
|
||||
DeprecationWarning,
|
||||
) #pragma: no cover
|
||||
|
||||
+12
-3
@@ -4,6 +4,7 @@ import functools
|
||||
import logging.handlers
|
||||
import os
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
import configobj
|
||||
import josepy as jose
|
||||
@@ -1217,9 +1218,17 @@ def main(cli_args=sys.argv[1:]):
|
||||
# Let plugins_cmd be run as un-privileged user.
|
||||
if config.func != plugins_cmd:
|
||||
raise
|
||||
if sys.version_info[:2] == (3, 3):
|
||||
logger.warning("Python 3.3 support will be dropped in the next release "
|
||||
"of Certbot - please upgrade your Python version.")
|
||||
deprecation_fmt = (
|
||||
"Python %s.%s support will be dropped in the next "
|
||||
"release of Certbot - please upgrade your Python version.")
|
||||
# We use the warnings system for Python 2.6 and logging for Python 3
|
||||
# because DeprecationWarnings are only reported by default in Python <= 2.6
|
||||
# and warnings can be disabled by the user.
|
||||
if sys.version_info[:2] == (2, 6):
|
||||
warning = deprecation_fmt % sys.version_info[:2]
|
||||
warnings.warn(warning, DeprecationWarning)
|
||||
elif sys.version_info[:2] == (3, 3):
|
||||
logger.warning(deprecation_fmt, *sys.version_info[:2])
|
||||
|
||||
set_displayer(config)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user