Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/certbot/certbot.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorohemorange <ebportnoy@gmail.com>2018-01-10 03:11:04 +0300
committerBrad Warren <bmw@users.noreply.github.com>2018-01-10 03:11:04 +0300
commitf5a02714cd8b610db52ac04e62685bba9c081a47 (patch)
tree155f5b167855f926cc749f8454977d45958f9385
parent887a6bcfce73f7b3c556720ccbbc470bf8855606 (diff)
Add deprecation warning for Python 2.6 (#5391)
* Add deprecation warning for Python 2.6 * Allow disabling Python 2.6 warning
-rw-r--r--acme/acme/__init__.py13
-rw-r--r--certbot/main.py15
2 files changed, 19 insertions, 9 deletions
diff --git a/acme/acme/__init__.py b/acme/acme/__init__.py
index 618dda200..5850fa955 100644
--- a/acme/acme/__init__.py
+++ b/acme/acme/__init__.py
@@ -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
diff --git a/certbot/main.py b/certbot/main.py
index e25e030aa..32dd69256 100644
--- a/certbot/main.py
+++ b/certbot/main.py
@@ -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)