diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2023-02-09 18:42:59 +0100 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2023-02-10 15:31:54 +0100 |
commit | 9a710587e847f248b1f0ffcf1e1091e9fc2ec027 (patch) | |
tree | 0cd911169c08234c27bee27c9e9e5620e8f63674 /searxng_extra/update/update_firefox_version.py | |
parent | 6707354bc81a0c7d16ca7db6ab6bd151813380d0 (diff) | |
download | searxng-9a710587e847f248b1f0ffcf1e1091e9fc2ec027.tar.gz searxng-9a710587e847f248b1f0ffcf1e1091e9fc2ec027.zip |
[fix] remove usage of deprecated-module distutis
Closes: https://github.com/searxng/searxng/issues/2168
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searxng_extra/update/update_firefox_version.py')
-rwxr-xr-x | searxng_extra/update/update_firefox_version.py | 10 |
1 files 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: |