From 0e7fecc4ba515a9649bcbc674732a3744054ae43 Mon Sep 17 00:00:00 2001 From: Brad Warren Date: Fri, 29 Oct 2021 14:41:58 -0700 Subject: [PATCH] fix typos --- .../certbot_apache/_internal/entrypoint.py | 2 +- .../certbot_nginx/_internal/configurator.py | 2 +- certbot/certbot/util.py | 12 +++++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/certbot-apache/certbot_apache/_internal/entrypoint.py b/certbot-apache/certbot_apache/_internal/entrypoint.py index 80e24fea6..4311b11c6 100644 --- a/certbot-apache/certbot_apache/_internal/entrypoint.py +++ b/certbot-apache/certbot_apache/_internal/entrypoint.py @@ -45,7 +45,7 @@ def get_configurator(): override_class = None # Special case for older Fedora versions - min_version = util.parse_loose_version('29'() + min_version = util.parse_loose_version('29') if os_name == 'fedora' and util.parse_loose_version(os_version) < min_version: os_name = 'fedora_old' diff --git a/certbot-nginx/certbot_nginx/_internal/configurator.py b/certbot-nginx/certbot_nginx/_internal/configurator.py index d88243819..596890cd1 100644 --- a/certbot-nginx/certbot_nginx/_internal/configurator.py +++ b/certbot-nginx/certbot_nginx/_internal/configurator.py @@ -143,7 +143,7 @@ class NginxConfigurator(common.Installer, interfaces.Authenticator): use_tls13 = self.version >= (1, 13, 0) min_openssl_version = util.parse_loose_version('1.0.2l') session_tix_off = self.version >= (1, 5, 9) and self.openssl_version and\ - util.parse_loose_version(self.openssl_version) >= LooseVersion('1.0.2l'): + util.parse_loose_version(self.openssl_version) >= min_openssl_version if use_tls13: if session_tix_off: diff --git a/certbot/certbot/util.py b/certbot/certbot/util.py index 1a2a30c62..eb1b3edb8 100644 --- a/certbot/certbot/util.py +++ b/certbot/certbot/util.py @@ -14,6 +14,7 @@ import subprocess import sys from typing import Dict from typing import IO +from typing import List from typing import Text from typing import Tuple from typing import Union @@ -640,21 +641,22 @@ def atexit_register(func, *args, **kwargs): def parse_loose_version(version_string): - """Parses a version string into a tuple. + """Parses a version string into its components. This code and the returned tuple is based on the now deprecated distutils.version.LooseVersion class from the Python standard library. - Two LooseVersion classes and two tuples as returned by this function should + Two LooseVersion classes and two lists as returned by this function should compare in the same way. See https://github.com/python/cpython/blob/v3.10.0/Lib/distutils/version.py#L205-L347. :param str version_string: version string - :returns: tuple of parsed version string components - :rtype: tuple + :returns: list of parsed version string components + :rtype: list """ - components = [x for x in _VERSION_COMPONENT_RE.split(vstring) + components: List[Union[int, str]] + components = [x for x in _VERSION_COMPONENT_RE.split(version_string) if x and x != '.'] for i, obj in enumerate(components): try: