From 4da42804b4bec85174cc683a4be818e79910f5af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 5 Nov 2024 21:22:22 +0100 Subject: [PATCH] Android: Replace deprecated distutils LooseVersion usage (cherry picked from commit 9e9ea714adcc319bde381e292efcca62fa2c7991) --- platform/android/detect.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/platform/android/detect.py b/platform/android/detect.py index 1704724c14a..6c99d211cde 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -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(