Android: Replace deprecated distutils LooseVersion usage

(cherry picked from commit 9e9ea714ad)
This commit is contained in:
Rémi Verschelde 2024-11-05 21:22:22 +01:00
parent c558ce1495
commit 4da42804b4
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -1,7 +1,6 @@
import os
import sys
import platform
from distutils.version import LooseVersion
def is_active():
@ -265,8 +264,14 @@ def configure(env):
# Link flags
# HACK: Replaced use of now obsoleted distutils.version.LooseVersion with this simple method,
# which isn't bullet proof but should be sufficient here with "x.y.z" parameters.
# Alternatives imply adding more dependencies.
def version_tuple(v):
return tuple(map(int, (v.split("."))))
ndk_version = get_ndk_version(env["ANDROID_NDK_ROOT"])
if ndk_version != None and LooseVersion(ndk_version) >= LooseVersion("17.1.4828580"):
if ndk_version != None and version_tuple(ndk_version) >= version_tuple("17.1.4828580"):
env.Append(LINKFLAGS=["-Wl,--exclude-libs,libgcc.a", "-Wl,--exclude-libs,libatomic.a", "-nostdlib++"])
else:
env.Append(