mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-04 06:20:12 +01:00
port to looseversion
This commit is contained in:
parent
4b208e438e
commit
e2949cbd61
@ -57,7 +57,6 @@ import defusedxml.ElementTree as XMLElementTree
|
||||
from base64 import urlsafe_b64encode
|
||||
from binascii import hexlify
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from packaging.version import Version
|
||||
from queue import Queue
|
||||
from zipfile import ZipFile
|
||||
|
||||
@ -71,6 +70,7 @@ from fdroidserver import _
|
||||
from fdroidserver.exception import FDroidException, VCSException, NoSubmodulesException,\
|
||||
BuildException, VerificationException, MetaDataException
|
||||
from .asynchronousfilereader import AsynchronousFileReader
|
||||
from .looseversion import LooseVersion
|
||||
|
||||
from . import apksigcopier, common
|
||||
|
||||
@ -656,7 +656,7 @@ def find_apksigner(config):
|
||||
if not os.path.isdir(os.path.join(build_tools_path, f)):
|
||||
continue
|
||||
try:
|
||||
if Version(f) < Version(MINIMUM_APKSIGNER_BUILD_TOOLS_VERSION):
|
||||
if LooseVersion(f) < LooseVersion(MINIMUM_APKSIGNER_BUILD_TOOLS_VERSION):
|
||||
logging.debug("Local Android SDK only has outdated apksigner versions")
|
||||
return
|
||||
except TypeError:
|
||||
@ -717,9 +717,9 @@ def test_aapt_version(aapt):
|
||||
# the Debian package has the version string like "v0.2-23.0.2"
|
||||
too_old = False
|
||||
if '.' in bugfix:
|
||||
if Version(bugfix) < Version(MINIMUM_AAPT_BUILD_TOOLS_VERSION):
|
||||
if LooseVersion(bugfix) < LooseVersion(MINIMUM_AAPT_BUILD_TOOLS_VERSION):
|
||||
too_old = True
|
||||
elif Version('.'.join((major, minor, bugfix))) < Version('0.2.4062713'):
|
||||
elif LooseVersion('.'.join((major, minor, bugfix))) < LooseVersion('0.2.4062713'):
|
||||
too_old = True
|
||||
if too_old:
|
||||
logging.warning(_("'{aapt}' is too old, fdroid requires build-tools-{version} or newer!")
|
||||
|
1
setup.py
1
setup.py
@ -98,7 +98,6 @@ setup(
|
||||
'paramiko',
|
||||
'Pillow',
|
||||
'apache-libcloud >= 0.14.1',
|
||||
'packaging',
|
||||
'pyasn1 >=0.4.1, < 0.5.0',
|
||||
'pyasn1-modules >= 0.2.1, < 0.3',
|
||||
'python-vagrant',
|
||||
|
@ -21,7 +21,6 @@ import unittest
|
||||
import textwrap
|
||||
import yaml
|
||||
import gzip
|
||||
from packaging.version import Version
|
||||
from zipfile import BadZipFile, ZipFile
|
||||
from unittest import mock
|
||||
from pathlib import Path
|
||||
@ -42,6 +41,7 @@ from testcommon import TmpCwd, mkdtemp
|
||||
from fdroidserver.common import ANTIFEATURES_CONFIG_NAME, CATEGORIES_CONFIG_NAME
|
||||
from fdroidserver.exception import FDroidException, VCSException,\
|
||||
MetaDataException, VerificationException
|
||||
from fdroidserver.looseversion import LooseVersion
|
||||
|
||||
|
||||
class CommonTest(unittest.TestCase):
|
||||
@ -852,9 +852,9 @@ class CommonTest(unittest.TestCase):
|
||||
v = bt.split('/')[-2]
|
||||
if v == 'debian':
|
||||
continue
|
||||
if Version(version) < Version(v):
|
||||
if LooseVersion(version) < LooseVersion(v):
|
||||
version = v
|
||||
if Version(version) < Version(min_version):
|
||||
if LooseVersion(version) < LooseVersion(min_version):
|
||||
self.skipTest('SKIPPING since build-tools %s or higher is required!' % min_version)
|
||||
fdroidserver.common.config = {'sdk_path': android_home}
|
||||
with mock.patch.dict(os.environ, clear=True):
|
||||
@ -2374,10 +2374,10 @@ class CommonTest(unittest.TestCase):
|
||||
import sdkmanager
|
||||
import pkg_resources
|
||||
|
||||
sdkmanager_version = Version(
|
||||
sdkmanager_version = LooseVersion(
|
||||
pkg_resources.get_distribution('sdkmanager').version
|
||||
)
|
||||
if sdkmanager_version < Version('0.6.4'):
|
||||
if sdkmanager_version < LooseVersion('0.6.4'):
|
||||
raise unittest.SkipTest('needs fdroid sdkmanager >= 0.6.4')
|
||||
|
||||
fdroidserver.common.config = {'sdk_path': 'placeholder'}
|
||||
|
@ -21,7 +21,6 @@ import yaml
|
||||
import zipfile
|
||||
import textwrap
|
||||
from datetime import datetime
|
||||
from packaging.version import Version
|
||||
from pathlib import Path
|
||||
from testcommon import TmpCwd, mkdtemp
|
||||
from unittest import mock
|
||||
@ -54,6 +53,7 @@ import fdroidserver.exception
|
||||
import fdroidserver.metadata
|
||||
import fdroidserver.update
|
||||
from fdroidserver.common import CATEGORIES_CONFIG_NAME
|
||||
from fdroidserver.looseversion import LooseVersion
|
||||
|
||||
|
||||
DONATION_FIELDS = ('Donate', 'Liberapay', 'OpenCollective')
|
||||
@ -1041,7 +1041,7 @@ class UpdateTest(unittest.TestCase):
|
||||
|
||||
javac = config['jarsigner'].replace('jarsigner', 'javac')
|
||||
v = subprocess.check_output([javac, '-version'], stderr=subprocess.STDOUT)[6:-1].decode('utf-8')
|
||||
if Version(v) < Version('1.8.0_132'):
|
||||
if LooseVersion(v) < LooseVersion('1.8.0_132'):
|
||||
print('SKIPPING: running tests with old Java (' + v + ')')
|
||||
return
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user