https://github.com/python/cpython/commit/4811058e510892831694508475d103489050a208
commit: 4811058e510892831694508475d103489050a208
branch: 3.14
author: Russell Keith-Magee <[email protected]>
committer: hugovk <[email protected]>
date: 2026-11-18T19:17:18+02:00
summary:

[3.14] gh-162034: Quote paths in the Apple testbed's utils.sh (GH-162161) 
(#162181)

Add additional protection against spaces and other special characters in
iOS Xcode build scripts.
(cherry picked from commit 3ad9316217ba4e2788abc7d19f469762c6c38309)

Co-authored-by: Ferdinando Ametrano <[email protected]>

files:
A Misc/NEWS.d/next/Tests/2026-11-17-00-39-51.gh-issue-162034.FmiuNi.rst
M Apple/testbed/Python.xcframework/build/utils.sh

diff --git a/Apple/testbed/Python.xcframework/build/utils.sh 
b/Apple/testbed/Python.xcframework/build/utils.sh
index 7b905640cfa192..16cdb8314ce214 100755
--- a/Apple/testbed/Python.xcframework/build/utils.sh
+++ b/Apple/testbed/Python.xcframework/build/utils.sh
@@ -72,9 +72,9 @@ install_dylib () {
     MODULE_PATH=$(dirname "$FULL_EXT")
     MODULE_NAME=$(echo $EXT | cut -d "." -f 1)
     # The location of the extension file, relative to the bundle
-    RELATIVE_EXT=${FULL_EXT#$CODESIGNING_FOLDER_PATH/}
+    RELATIVE_EXT=${FULL_EXT#"$CODESIGNING_FOLDER_PATH"/}
     # The path to the extension file, relative to the install base
-    PYTHON_EXT=${RELATIVE_EXT/$INSTALL_BASE/}
+    PYTHON_EXT=${RELATIVE_EXT/"$INSTALL_BASE"/}
     # The full dotted name of the extension module, constructed from the file 
path.
     FULL_MODULE_NAME=$(echo $PYTHON_EXT | cut -d "." -f 1 | tr "/" ".");
     # A bundle identifier; not actually used, but required by Xcode framework 
packaging
@@ -123,8 +123,8 @@ install_dylib () {
 process_dylibs () {
     PYTHON_XCFRAMEWORK_PATH=$1
     LIB_PATH=$2
-    find "$CODESIGNING_FOLDER_PATH/$LIB_PATH" -name "*.so" | while read 
FULL_EXT; do
-        install_dylib $PYTHON_XCFRAMEWORK_PATH "$LIB_PATH/" "$FULL_EXT"
+    find "$CODESIGNING_FOLDER_PATH/$LIB_PATH" -name "*.so" | while read -r 
FULL_EXT; do
+        install_dylib "$PYTHON_XCFRAMEWORK_PATH" "$LIB_PATH/" "$FULL_EXT"
     done
 }
 
@@ -139,13 +139,13 @@ install_python() {
     PYTHON_XCFRAMEWORK_PATH=$1
     shift
 
-    install_stdlib $PYTHON_XCFRAMEWORK_PATH
+    install_stdlib "$PYTHON_XCFRAMEWORK_PATH"
     PYTHON_VER=$(ls -1 "$CODESIGNING_FOLDER_PATH/python/lib" | grep -E 
"^python3\.\d+$")
     echo "Install Python $PYTHON_VER standard library extension modules..."
-    process_dylibs $PYTHON_XCFRAMEWORK_PATH python/lib/$PYTHON_VER/lib-dynload
+    process_dylibs "$PYTHON_XCFRAMEWORK_PATH" 
python/lib/$PYTHON_VER/lib-dynload
 
-    for package_path in $@; do
+    for package_path in "$@"; do
         echo "Installing $package_path extension modules ..."
-        process_dylibs $PYTHON_XCFRAMEWORK_PATH $package_path
+        process_dylibs "$PYTHON_XCFRAMEWORK_PATH" "$package_path"
     done
 }
diff --git 
a/Misc/NEWS.d/next/Tests/2026-11-17-00-39-51.gh-issue-162034.FmiuNi.rst 
b/Misc/NEWS.d/next/Tests/2026-11-17-00-39-51.gh-issue-162034.FmiuNi.rst
new file mode 100644
index 00000000000000..1764fa2a458e59
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2026-11-17-00-39-51.gh-issue-162034.FmiuNi.rst
@@ -0,0 +1,2 @@
+Fix the Apple testbed's extension module processing for an XCframework or
+package path with a space, or a build path with brackets or a backslash.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to