From 3504af335ee10792cfaaa86f8483dd7127da405b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 14 Oct 2025 11:55:30 +0200 Subject: [PATCH] Replace obsoleted Python `distutils.spawn.find_executable` by `shutil.which` --- files/patches/emscripten-python-3.12.diff | 25 +++++++++++++++++++++++ patch_emscripten.py | 4 ++++ 2 files changed, 29 insertions(+) create mode 100644 files/patches/emscripten-python-3.12.diff diff --git a/files/patches/emscripten-python-3.12.diff b/files/patches/emscripten-python-3.12.diff new file mode 100644 index 0000000..e1996bb --- /dev/null +++ b/files/patches/emscripten-python-3.12.diff @@ -0,0 +1,25 @@ +diff -aur a/tools/shared.py b/tools/shared.py +--- a/tools/shared.py 2025-10-14 09:16:13.210070677 +0000 ++++ b/tools/shared.py 2025-10-14 09:15:07.106178680 +0000 +@@ -5,7 +5,7 @@ + + from __future__ import print_function + +-from distutils.spawn import find_executable ++from shutil import which + from subprocess import PIPE, STDOUT + import atexit + import base64 +@@ -212,10 +212,10 @@ + config_file = '\n'.join(config_file) + # autodetect some default paths + config_file = config_file.replace('\'{{{ EMSCRIPTEN_ROOT }}}\'', repr(__rootpath__)) +- llvm_root = os.path.dirname(find_executable('llvm-dis') or '/usr/bin/llvm-dis') ++ llvm_root = os.path.dirname(which('llvm-dis') or '/usr/bin/llvm-dis') + config_file = config_file.replace('\'{{{ LLVM_ROOT }}}\'', repr(llvm_root)) + +- node = find_executable('nodejs') or find_executable('node') or 'node' ++ node = which('nodejs') or which('node') or 'node' + config_file = config_file.replace('\'{{{ NODE }}}\'', repr(node)) + + abspath = os.path.abspath(os.path.expanduser(path)) diff --git a/patch_emscripten.py b/patch_emscripten.py index c3e8947..3c91aa1 100755 --- a/patch_emscripten.py +++ b/patch_emscripten.py @@ -18,11 +18,15 @@ def main(raw_args): args = parser.parse_args(raw_args) + this_script_dir = os.path.dirname(os.path.realpath(__file__)) + patches_dir = os.path.join(this_script_dir, 'files', 'patches') + mono_source_root = args.mono_sources emsdk_root = get_emsdk_root() patches = [ '%s/sdks/builds/fix-emscripten-8511.diff' % mono_source_root, + '%s/emscripten-python-3.12.diff' % patches_dir, ] from subprocess import Popen