From 9a710587e847f248b1f0ffcf1e1091e9fc2ec027 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Thu, 9 Feb 2023 18:42:59 +0100 Subject: [PATCH] [fix] remove usage of deprecated-module distutis Closes: https://github.com/searxng/searxng/issues/2168 Signed-off-by: Markus Heiser --- searxng_extra/update/update_firefox_version.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/searxng_extra/update/update_firefox_version.py b/searxng_extra/update/update_firefox_version.py index 51aec39c5..2e730764a 100755 --- a/searxng_extra/update/update_firefox_version.py +++ b/searxng_extra/update/update_firefox_version.py @@ -13,7 +13,7 @@ import json import re from os.path import join from urllib.parse import urlparse, urljoin -from distutils.version import LooseVersion # pylint: disable=deprecated-module +from packaging.version import parse import requests from lxml import html @@ -51,7 +51,7 @@ def fetch_firefox_versions(): if path.startswith(RELEASE_PATH): version = path[len(RELEASE_PATH) : -1] if NORMAL_REGEX.match(version): - versions.append(LooseVersion(version)) + versions.append(parse(version)) list.sort(versions, reverse=True) return versions @@ -61,11 +61,11 @@ def fetch_firefox_last_versions(): versions = fetch_firefox_versions() result = [] - major_last = versions[0].version[0] + major_last = versions[0].major major_list = (major_last, major_last - 1) for version in versions: - major_current = version.version[0] - minor_current = version.version[1] + major_current = version.major + minor_current = version.minor if major_current in major_list: user_agent_version = f'{major_current}.{minor_current}' if user_agent_version not in result: