1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-04 22:40:12 +01:00

Merge branch 'python3.12' into 'master'

Add support for Python 3.12

See merge request fdroid/fdroidserver!1403
This commit is contained in:
Hans-Christoph Steiner 2023-12-08 07:30:48 +00:00
commit c4424a5e1a
5 changed files with 16 additions and 15 deletions

View File

@ -57,7 +57,7 @@ import defusedxml.ElementTree as XMLElementTree
from base64 import urlsafe_b64encode
from binascii import hexlify
from datetime import datetime, timedelta, timezone
from distutils.version import LooseVersion
from packaging.version import Version
from queue import Queue
from zipfile import ZipFile
@ -656,7 +656,7 @@ def find_apksigner(config):
if not os.path.isdir(os.path.join(build_tools_path, f)):
continue
try:
if LooseVersion(f) < LooseVersion(MINIMUM_APKSIGNER_BUILD_TOOLS_VERSION):
if Version(f) < Version(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 LooseVersion(bugfix) < LooseVersion(MINIMUM_AAPT_BUILD_TOOLS_VERSION):
if Version(bugfix) < Version(MINIMUM_AAPT_BUILD_TOOLS_VERSION):
too_old = True
elif LooseVersion('.'.join((major, minor, bugfix))) < LooseVersion('0.2.4062713'):
elif Version('.'.join((major, minor, bugfix))) < Version('0.2.4062713'):
too_old = True
if too_old:
logging.warning(_("'{aapt}' is too old, fdroid requires build-tools-{version} or newer!")

View File

@ -98,6 +98,7 @@ 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',

View File

@ -21,7 +21,7 @@ import unittest
import textwrap
import yaml
import gzip
from distutils.version import LooseVersion
from packaging.version import Version
from zipfile import BadZipFile, ZipFile
from unittest import mock
from pathlib import Path
@ -852,9 +852,9 @@ class CommonTest(unittest.TestCase):
v = bt.split('/')[-2]
if v == 'debian':
continue
if LooseVersion(version) < LooseVersion(v):
if Version(version) < Version(v):
version = v
if LooseVersion(version) < LooseVersion(min_version):
if Version(version) < Version(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 = LooseVersion(
sdkmanager_version = Version(
pkg_resources.get_distribution('sdkmanager').version
)
if sdkmanager_version < LooseVersion('0.6.4'):
if sdkmanager_version < Version('0.6.4'):
raise unittest.SkipTest('needs fdroid sdkmanager >= 0.6.4')
fdroidserver.common.config = {'sdk_path': 'placeholder'}

View File

@ -8,7 +8,7 @@ import requests
import subprocess
import sys
from colorama import Fore, Style
from distutils.version import LooseVersion
from packaging.version import Version
checksums = None
@ -52,7 +52,7 @@ for url, checksum in config['CACHE_FILES']:
# error if makebuildserver is missing the latest version
for version in sorted(versions.keys()):
if version not in makebuildserver_versions \
and LooseVersion(version) > LooseVersion(sorted(makebuildserver_versions)[-1]):
and Version(version) > Version(sorted(makebuildserver_versions)[-1]):
add_before = """ ('https://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin',"""
new = to_compile.replace(
add_before,
@ -78,14 +78,14 @@ for m in get_sha_pat.finditer(gradlew_fdroid):
+ Style.RESET_ALL)
errors += 1
new = ''
for version in sorted(versions.keys(), key=LooseVersion):
for version in sorted(versions.keys(), key=Version):
sha256 = versions[version]
spaces = ''
for i in range(6 - len(version)):
spaces += ' '
new += """ '%s')%s echo '%s' ;;\n""" % (version, spaces, sha256)
gradlew_fdroid = gradlew_fdroid.replace(current, new)
plugin_v = ' '.join(sorted(versions.keys(), key=LooseVersion, reverse=True))
plugin_v = ' '.join(sorted(versions.keys(), key=Version, reverse=True))
plugin_v_pat = re.compile(r'\nplugin_v=\(([0-9. ]+)\)')
with open('gradlew-fdroid', 'w') as fp:
fp.write(plugin_v_pat.sub('\nplugin_v=(%s)' % plugin_v, gradlew_fdroid))

View File

@ -21,7 +21,7 @@ import yaml
import zipfile
import textwrap
from datetime import datetime
from distutils.version import LooseVersion
from packaging.version import Version
from pathlib import Path
from testcommon import TmpCwd, mkdtemp
from unittest import mock
@ -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 LooseVersion(v) < LooseVersion('1.8.0_132'):
if Version(v) < Version('1.8.0_132'):
print('SKIPPING: running tests with old Java (' + v + ')')
return