From c1a58907bbfa53fefca531ed95b384eaacb8282f Mon Sep 17 00:00:00 2001 From: Brad Warren Date: Mon, 1 Nov 2021 10:17:43 -0700 Subject: [PATCH] deprecate get_strict_version --- certbot/CHANGELOG.md | 2 ++ certbot/certbot/util.py | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/certbot/CHANGELOG.md b/certbot/CHANGELOG.md index e43057fd7..dd3a7bf21 100644 --- a/certbot/CHANGELOG.md +++ b/certbot/CHANGELOG.md @@ -20,6 +20,8 @@ Certbot adheres to [Semantic Versioning](https://semver.org/). * BF6BCFC89E90747B9A680FD7B6029E8500F7DB16 * 86379B4F0AF371B50CD9E5FF3402831161D1D280 * 20F201346BF8F3F455A73F9A780CC99432A28621 +* The function certbot.util.get_strict_version was deprecated and will be + removed in a future release. ### Fixed diff --git a/certbot/certbot/util.py b/certbot/certbot/util.py index eb1b3edb8..2b3e8cae5 100644 --- a/certbot/certbot/util.py +++ b/certbot/certbot/util.py @@ -1,10 +1,7 @@ """Utilities for all Certbot.""" -# distutils.version under virtualenv confuses pylint -# For more info, see: https://github.com/PyCQA/pylint/issues/73 import argparse import atexit import collections -import distutils.version import errno import logging import platform @@ -613,8 +610,13 @@ def get_strict_version(normalized): :rtype: distutils.version.StrictVersion """ - # strict version ending with "a" and a number designates a pre-release - return distutils.version.StrictVersion(normalized.replace(".dev", "a")) + warnings.warn("certbot.util.get_strict_version is deprecated and will be " + "removed in a future release.", DeprecationWarning) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + import distutils.version + # strict version ending with "a" and a number designates a pre-release + return distutils.version.StrictVersion(normalized.replace(".dev", "a")) def is_staging(srv):