From f6966024e86e2530fb6c7fe26b69e5054fc8e310 Mon Sep 17 00:00:00 2001
From: Stefano Rivera <stefano@rivera.za.net>
Date: Wed, 2 Oct 2024 18:24:57 +0200
Subject: [PATCH] Strip absolute --libdir paths from configure args in
 test_freeze

We are trying to install into a prefix, any absolute path would not
necessarily be writeable. e.g. if Python is configured with
--libdir=/usr/lib/$(MULTIARCH)/ during a Debian build.

Forwarded: https://github.com/python/cpython/pull/124916
---
 Tools/freeze/test/freeze.py | 1 +
 1 file changed, 1 insertion(+)

--- a/Tools/freeze/test/freeze.py
+++ b/Tools/freeze/test/freeze.py
@@ -128,6 +128,7 @@
     # Run configure.
     print(f'configuring python in {builddir}...')
     config_args = shlex.split(sysconfig.get_config_var('CONFIG_ARGS') or '')
+    config_args = [arg for arg in config_args if not arg.startswith("--libdir=/")]
     cmd = [os.path.join(srcdir, 'configure'), *config_args]
     ensure_opt(cmd, 'cache-file', os.path.join(outdir, 'python-config.cache'))
     prefix = os.path.join(outdir, 'python-installation')
