mirror of https://github.com/searxng/searxng.git
[fix] remove usage of deprecated-module distutis
Closes: https://github.com/searxng/searxng/issues/2168 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
6707354bc8
commit
9a710587e8
|
@ -13,7 +13,7 @@ import json
|
||||||
import re
|
import re
|
||||||
from os.path import join
|
from os.path import join
|
||||||
from urllib.parse import urlparse, urljoin
|
from urllib.parse import urlparse, urljoin
|
||||||
from distutils.version import LooseVersion # pylint: disable=deprecated-module
|
from packaging.version import parse
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from lxml import html
|
from lxml import html
|
||||||
|
@ -51,7 +51,7 @@ def fetch_firefox_versions():
|
||||||
if path.startswith(RELEASE_PATH):
|
if path.startswith(RELEASE_PATH):
|
||||||
version = path[len(RELEASE_PATH) : -1]
|
version = path[len(RELEASE_PATH) : -1]
|
||||||
if NORMAL_REGEX.match(version):
|
if NORMAL_REGEX.match(version):
|
||||||
versions.append(LooseVersion(version))
|
versions.append(parse(version))
|
||||||
|
|
||||||
list.sort(versions, reverse=True)
|
list.sort(versions, reverse=True)
|
||||||
return versions
|
return versions
|
||||||
|
@ -61,11 +61,11 @@ def fetch_firefox_last_versions():
|
||||||
versions = fetch_firefox_versions()
|
versions = fetch_firefox_versions()
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
major_last = versions[0].version[0]
|
major_last = versions[0].major
|
||||||
major_list = (major_last, major_last - 1)
|
major_list = (major_last, major_last - 1)
|
||||||
for version in versions:
|
for version in versions:
|
||||||
major_current = version.version[0]
|
major_current = version.major
|
||||||
minor_current = version.version[1]
|
minor_current = version.minor
|
||||||
if major_current in major_list:
|
if major_current in major_list:
|
||||||
user_agent_version = f'{major_current}.{minor_current}'
|
user_agent_version = f'{major_current}.{minor_current}'
|
||||||
if user_agent_version not in result:
|
if user_agent_version not in result:
|
||||||
|
|
Loading…
Reference in New Issue