1
0
mirror of https://github.com/certbot/certbot.git synced 2025-08-06 16:42:41 +03:00

tree-wide: use LooseVersion instead of StrictVersion (#8081)

According to `distutils/version.py`, StrictVersion is pretty strict in
what version numbers to accept:

> A version number consists of two or three dot-separated numeric
> components, with an optional "pre-release" tag on the end.  The
> pre-release tag consists of the letter 'a' or 'b' followed by a number.

This assumption already fails for some pretty basic python libraries
itself, like setuptools, also available in `46.1.3.post20200610`, a
completely valid version number according to
https://www.python.org/dev/peps/pep-0440/#post-releases.

There doesn't seem to be a particular reason on why StrictVersion has
been used here, so let's use LooseVersion, to be compatible with these
versions.

Co-authored-by: Adrien Ferrand <adferrand@users.noreply.github.com>
This commit is contained in:
Florian Klink
2020-06-19 17:11:35 +02:00
committed by GitHub
parent db064a4109
commit 25e79e4aca
22 changed files with 44 additions and 40 deletions

View File

@@ -1,4 +1,4 @@
from distutils.version import StrictVersion
from distutils.version import LooseVersion
import sys
from setuptools import __version__ as setuptools_version
@@ -19,7 +19,7 @@ install_requires = [
'zope.interface',
]
setuptools_known_environment_markers = (StrictVersion(setuptools_version) >= StrictVersion('36.2'))
setuptools_known_environment_markers = (LooseVersion(setuptools_version) >= LooseVersion('36.2'))
if setuptools_known_environment_markers:
install_requires.append('mock ; python_version < "3.3"')
elif 'bdist_wheel' in sys.argv[1:]: