Skip to content

Commit 960c30b

Browse files
authored
Update 3.11 patch with recent changes (#261)
* Adds recent iOS patches from 3.14 development * Adds CI workflow changes from main branch * Adds modulemap generation * Adds new-style platform-site handling
1 parent 1833f11 commit 960c30b

16 files changed

+640
-563
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
name: CI
22
on:
33
pull_request:
4-
push:
5-
branches:
6-
- main
7-
- 3.*
84
workflow_call:
95
inputs:
106
build-number:
@@ -109,19 +105,22 @@ jobs:
109105
- uses: actions/[email protected]
110106

111107
- name: Set up Python
112-
uses: actions/setup-python@v5.3.0
108+
uses: actions/setup-python@v5.4.0
113109
with:
114110
# Appending -dev ensures that we can always build the dev release.
115111
# It's a no-op for versions that have been published.
116112
python-version: ${{ needs.config.outputs.PYTHON_VER }}-dev
113+
# Ensure that we *always* use the latest build, not a cached version.
114+
# It's an edge case, but when a new alpha is released, we need to use it ASAP.
115+
check-latest: true
117116

118117
- name: Build ${{ matrix.target }}
119118
run: |
120119
# Do the build for the requested target.
121120
make ${{ matrix.target }} BUILD_NUMBER=${{ needs.config.outputs.BUILD_NUMBER }}
122121
123122
- name: Upload build artefacts
124-
uses: actions/upload-artifact@v4.4.3
123+
uses: actions/upload-artifact@v4.6.1
125124
with:
126125
name: Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.target }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz
127126
path: dist/Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.target }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz

.github/workflows/publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- uses: actions/checkout@v4
1212

1313
- name: Set up Python environment
14-
uses: actions/setup-python@v5.3.0
14+
uses: actions/setup-python@v5.4.0
1515
with:
1616
python-version: "3.X"
1717

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ jobs:
4040
needs: [ config, ci ]
4141
steps:
4242
- name: Get build artifacts
43-
uses: actions/[email protected].8
43+
uses: actions/[email protected].9
4444
with:
4545
pattern: Python-*
4646
path: dist
4747
merge-multiple: true
4848

4949
- name: Create Release
50-
uses: ncipollo/release-action@v1.14.0
50+
uses: ncipollo/release-action@v1.16.0
5151
with:
5252
name: ${{ needs.ci.outputs.PYTHON_VER }}-${{ needs.config.outputs.BUILD_NUMBER }}
5353
tag: ${{ needs.ci.outputs.PYTHON_VER }}-${{ needs.config.outputs.BUILD_NUMBER }}

Makefile

Lines changed: 63 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ PYTHON_VER=$(basename $(PYTHON_VERSION))
2727
# The binary releases of dependencies, published at:
2828
# https://github.com/beeware/cpython-apple-source-deps/releases
2929
BZIP2_VERSION=1.0.8-1
30-
LIBFFI_VERSION=3.4.6-1
30+
LIBFFI_VERSION=3.4.7-1
3131
MPDECIMAL_VERSION=4.0.0-1
32-
OPENSSL_VERSION=3.0.15-1
33-
XZ_VERSION=5.6.2-1
32+
OPENSSL_VERSION=3.0.16-1
33+
XZ_VERSION=5.6.4-1
3434

3535
# Supported OS
3636
OS_LIST=macOS iOS tvOS watchOS
@@ -40,24 +40,18 @@ CURL_FLAGS=--disable --fail --location --create-dirs --progress-bar
4040
# macOS targets
4141
TARGETS-macOS=macosx.x86_64 macosx.arm64
4242
VERSION_MIN-macOS=11.0
43-
CFLAGS-macOS=-mmacosx-version-min=$(VERSION_MIN-macOS)
4443

4544
# iOS targets
4645
TARGETS-iOS=iphonesimulator.x86_64 iphonesimulator.arm64 iphoneos.arm64
4746
VERSION_MIN-iOS=13.0
48-
CFLAGS-iOS=-mios-version-min=$(VERSION_MIN-iOS)
4947

5048
# tvOS targets
5149
TARGETS-tvOS=appletvsimulator.x86_64 appletvsimulator.arm64 appletvos.arm64
5250
VERSION_MIN-tvOS=12.0
53-
CFLAGS-tvOS=-mtvos-version-min=$(VERSION_MIN-tvOS)
54-
PYTHON_CONFIGURE-tvOS=ac_cv_func_sigaltstack=no
5551

5652
# watchOS targets
5753
TARGETS-watchOS=watchsimulator.x86_64 watchsimulator.arm64 watchos.arm64_32
5854
VERSION_MIN-watchOS=4.0
59-
CFLAGS-watchOS=-mwatchos-version-min=$(VERSION_MIN-watchOS)
60-
PYTHON_CONFIGURE-watchOS=ac_cv_func_sigaltstack=no
6155

6256
# The architecture of the machine doing the build
6357
HOST_ARCH=$(shell uname -m)
@@ -72,7 +66,7 @@ PATH=/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
7266
all: $(OS_LIST)
7367

7468
.PHONY: \
75-
all clean distclean update-patch vars \
69+
all clean distclean update-patch vars config \
7670
$(foreach os,$(OS_LIST),$(os) clean-$(os) dev-clean-$(os) vars-$(os)) \
7771
$(foreach os,$(OS_LIST),$(foreach sdk,$$(sort $$(basename $$(TARGETS-$(os)))),$(sdk) vars-$(sdk)))
7872
$(foreach os,$(OS_LIST),$(foreach target,$$(TARGETS-$(os)),$(target) vars-$(target)))
@@ -135,10 +129,10 @@ ARCH-$(target)=$$(subst .,,$$(suffix $(target)))
135129
ifneq ($(os),macOS)
136130
ifeq ($$(findstring simulator,$$(SDK-$(target))),)
137131
TARGET_TRIPLE-$(target)=$$(ARCH-$(target))-apple-$$(OS_LOWER-$(target))$$(VERSION_MIN-$(os))
138-
IS_SIMULATOR-$(target)="False"
132+
IS_SIMULATOR-$(target)=False
139133
else
140134
TARGET_TRIPLE-$(target)=$$(ARCH-$(target))-apple-$$(OS_LOWER-$(target))$$(VERSION_MIN-$(os))-simulator
141-
IS_SIMULATOR-$(target)="True"
135+
IS_SIMULATOR-$(target)=True
142136
endif
143137
endif
144138

@@ -267,6 +261,9 @@ PYTHON_LIB-$(target)=$$(PYTHON_FRAMEWORK-$(target))/Python
267261
PYTHON_BIN-$(target)=$$(PYTHON_INSTALL-$(target))/bin
268262
PYTHON_INCLUDE-$(target)=$$(PYTHON_FRAMEWORK-$(target))/Headers
269263
PYTHON_STDLIB-$(target)=$$(PYTHON_INSTALL-$(target))/lib/python$(PYTHON_VER)
264+
PYTHON_PLATFORM_CONFIG-$(target)=$$(PYTHON_INSTALL-$(target))/platform-config/$$(ARCH-$(target))-$$(SDK-$(target))
265+
PYTHON_PLATFORM_SITECUSTOMIZE-$(target)=$$(PYTHON_PLATFORM_CONFIG-$(target))/sitecustomize.py
266+
270267

271268
$$(PYTHON_SRCDIR-$(target))/configure: \
272269
downloads/Python-$(PYTHON_VERSION).tar.gz \
@@ -325,23 +322,35 @@ $$(PYTHON_LIB-$(target)): $$(PYTHON_SRCDIR-$(target))/python.exe
325322
# Remove any .orig files produced by the compliance patching process
326323
find $$(PYTHON_INSTALL-$(target)) -name "*.orig" -exec rm {} \;
327324

328-
endif
329-
330-
PYTHON_SITECUSTOMIZE-$(target)=$(PROJECT_DIR)/support/$(PYTHON_VER)/$(os)/platform-site/$(target)/sitecustomize.py
331325

332-
$$(PYTHON_SITECUSTOMIZE-$(target)):
333-
@echo ">>> Create cross-platform sitecustomize.py for $(target)"
334-
mkdir -p $$(dir $$(PYTHON_SITECUSTOMIZE-$(target)))
335-
cat $(PROJECT_DIR)/patch/Python/sitecustomize.$(os).py \
326+
$$(PYTHON_PLATFORM_SITECUSTOMIZE-$(target)):
327+
@echo ">>> Create cross-plaform config for $(target)"
328+
mkdir -p $$(PYTHON_PLATFORM_CONFIG-$(target))
329+
# Create the cross-platform site definition
330+
echo "import _cross_$$(ARCH-$(target))_$$(SDK-$(target)); import _cross_venv;" \
331+
> $$(PYTHON_PLATFORM_CONFIG-$(target))/_cross_venv.pth
332+
cp $(PROJECT_DIR)/patch/Python/make_cross_venv.py \
333+
$$(PYTHON_PLATFORM_CONFIG-$(target))/make_cross_venv.py
334+
cp $(PROJECT_DIR)/patch/Python/_cross_venv.py \
335+
$$(PYTHON_PLATFORM_CONFIG-$(target))/_cross_venv.py
336+
cp $$(PYTHON_STDLIB-$(target))/_sysconfig* \
337+
$$(PYTHON_PLATFORM_CONFIG-$(target))
338+
cat $(PROJECT_DIR)/patch/Python/_cross_target.py.tmpl \
336339
| sed -e "s/{{os}}/$(os)/g" \
340+
| sed -e "s/{{platform}}/$$(OS_LOWER-$(target))/g" \
337341
| sed -e "s/{{arch}}/$$(ARCH-$(target))/g" \
342+
| sed -e "s/{{sdk}}/$$(SDK-$(target))/g" \
338343
| sed -e "s/{{version_min}}/$$(VERSION_MIN-$(os))/g" \
339344
| sed -e "s/{{is_simulator}}/$$(IS_SIMULATOR-$(target))/g" \
340-
| sed -e "s/{{multiarch}}/$$(ARCH-$(target))-$$(SDK-$(target))/g" \
341-
| sed -e "s/{{tag}}/$$(OS_LOWER-$(target))-$$(VERSION_MIN-$(os))-$$(ARCH-$(target))-$$(SDK-$(target))/g" \
342-
> $$(PYTHON_SITECUSTOMIZE-$(target))
345+
> $$(PYTHON_PLATFORM_CONFIG-$(target))/_cross_$$(ARCH-$(target))_$$(SDK-$(target)).py
346+
cat $(PROJECT_DIR)/patch/Python/sitecustomize.py.tmpl \
347+
| sed -e "s/{{arch}}/$$(ARCH-$(target))/g" \
348+
| sed -e "s/{{sdk}}/$$(SDK-$(target))/g" \
349+
> $$(PYTHON_PLATFORM_SITECUSTOMIZE-$(target))
350+
351+
endif
343352

344-
$(target): $$(PYTHON_SITECUSTOMIZE-$(target)) $$(PYTHON_LIB-$(target))
353+
$(target): $$(PYTHON_PLATFORM_SITECUSTOMIZE-$(target)) $$(PYTHON_LIB-$(target))
345354

346355
###########################################################################
347356
# Target: Debug
@@ -370,6 +379,8 @@ vars-$(target):
370379
@echo "PYTHON_BIN-$(target): $$(PYTHON_BIN-$(target))"
371380
@echo "PYTHON_INCLUDE-$(target): $$(PYTHON_INCLUDE-$(target))"
372381
@echo "PYTHON_STDLIB-$(target): $$(PYTHON_STDLIB-$(target))"
382+
@echo "PYTHON_PLATFORM_CONFIG-$(target): $$(PYTHON_PLATFORM_CONFIG-$(target))"
383+
@echo "PYTHON_PLATFORM_SITECUSTOMIZE-$(target): $$(PYTHON_PLATFORM_SITECUSTOMIZE-$(target))"
373384
@echo
374385

375386
endef # build-target
@@ -415,6 +426,7 @@ PYTHON_FRAMEWORK-$(sdk)=$$(PYTHON_INSTALL-$(sdk))/Python.framework
415426
PYTHON_INSTALL_VERSION-$(sdk)=$$(PYTHON_FRAMEWORK-$(sdk))/Versions/$(PYTHON_VER)
416427
PYTHON_LIB-$(sdk)=$$(PYTHON_INSTALL_VERSION-$(sdk))/Python
417428
PYTHON_INCLUDE-$(sdk)=$$(PYTHON_INSTALL_VERSION-$(sdk))/include/python$(PYTHON_VER)
429+
PYTHON_MODULEMAP-$(sdk)=$$(PYTHON_INCLUDE-$(sdk))/module.modulemap
418430
PYTHON_STDLIB-$(sdk)=$$(PYTHON_INSTALL_VERSION-$(sdk))/lib/python$(PYTHON_VER)
419431

420432
else
@@ -425,11 +437,13 @@ else
425437
# The non-macOS frameworks don't use the versioning structure.
426438

427439
PYTHON_INSTALL-$(sdk)=$(PROJECT_DIR)/install/$(os)/$(sdk)/python-$(PYTHON_VERSION)
440+
PYTHON_MODULEMAP-$(sdk)=$$(PYTHON_INCLUDE-$(sdk))/module.modulemap
428441
PYTHON_FRAMEWORK-$(sdk)=$$(PYTHON_INSTALL-$(sdk))/Python.framework
429442
PYTHON_LIB-$(sdk)=$$(PYTHON_FRAMEWORK-$(sdk))/Python
430443
PYTHON_BIN-$(sdk)=$$(PYTHON_INSTALL-$(sdk))/bin
431444
PYTHON_INCLUDE-$(sdk)=$$(PYTHON_FRAMEWORK-$(sdk))/Headers
432445
PYTHON_STDLIB-$(sdk)=$$(PYTHON_INSTALL-$(sdk))/lib/python$(PYTHON_VER)
446+
PYTHON_PLATFORM_CONFIG-$(sdk)=$$(PYTHON_INSTALL-$(sdk))/platform-config
433447

434448
$$(PYTHON_LIB-$(sdk)): $$(foreach target,$$(SDK_TARGETS-$(sdk)),$$(PYTHON_LIB-$$(target)))
435449
@echo ">>> Build Python fat library for the $(sdk) SDK"
@@ -454,6 +468,15 @@ $$(PYTHON_INCLUDE-$(sdk))/pyconfig.h: $$(PYTHON_LIB-$(sdk))
454468
# Copy headers as-is from the first target in the $(sdk) SDK
455469
cp -r $$(PYTHON_INCLUDE-$$(firstword $$(SDK_TARGETS-$(sdk)))) $$(PYTHON_INCLUDE-$(sdk))
456470

471+
# Create the modulemap file
472+
cp -r patch/Python/module.modulemap.prefix $$(PYTHON_MODULEMAP-$(sdk))
473+
echo "" >> $$(PYTHON_MODULEMAP-$(sdk))
474+
cd $$(PYTHON_SRCDIR-$$(firstword $$(SDK_TARGETS-$(sdk))))/Include && \
475+
find cpython -name "*.h" | sort | sed -e 's/^/ exclude header "/' | sed 's/$$$$/"/' >> $$(PYTHON_MODULEMAP-$(sdk)) && \
476+
echo "" >> $$(PYTHON_MODULEMAP-$(sdk)) && \
477+
find internal -name "*.h" | sort | sed -e 's/^/ exclude header "/' | sed 's/$$$$/"/' >> $$(PYTHON_MODULEMAP-$(sdk))
478+
echo "\n}" >> $$(PYTHON_MODULEMAP-$(sdk))
479+
457480
# Link the PYTHONHOME version of the headers
458481
mkdir -p $$(PYTHON_INSTALL-$(sdk))/include
459482
ln -si ../Python.framework/Headers $$(PYTHON_INSTALL-$(sdk))/include/python$(PYTHON_VER)
@@ -465,7 +488,7 @@ $$(PYTHON_INCLUDE-$(sdk))/pyconfig.h: $$(PYTHON_LIB-$(sdk))
465488
cp $$(PYTHON_SRCDIR-$$(firstword $$(SDK_TARGETS-$(sdk))))/$(os)/Resources/pyconfig.h $$(PYTHON_INCLUDE-$(sdk))/pyconfig.h
466489

467490

468-
$$(PYTHON_STDLIB-$(sdk))/LICENSE.TXT: $$(PYTHON_LIB-$(sdk)) $$(PYTHON_FRAMEWORK-$(sdk))/Info.plist $$(PYTHON_INCLUDE-$(sdk))/pyconfig.h
491+
$$(PYTHON_STDLIB-$(sdk))/LICENSE.TXT: $$(PYTHON_LIB-$(sdk)) $$(PYTHON_FRAMEWORK-$(sdk))/Info.plist $$(PYTHON_INCLUDE-$(sdk))/pyconfig.h $$(foreach target,$$(SDK_TARGETS-$(sdk)),$$(PYTHON_PLATFORM_SITECUSTOMIZE-$$(target)))
469492
@echo ">>> Build Python stdlib for the $(sdk) SDK"
470493
mkdir -p $$(PYTHON_STDLIB-$(sdk))/lib-dynload
471494
# Copy stdlib from the first target associated with the $(sdk) SDK
@@ -480,6 +503,10 @@ $$(PYTHON_STDLIB-$(sdk))/LICENSE.TXT: $$(PYTHON_LIB-$(sdk)) $$(PYTHON_FRAMEWORK-
480503
# Copy the individual _sysconfigdata modules into names that include the architecture
481504
$$(foreach target,$$(SDK_TARGETS-$(sdk)),cp $$(PYTHON_STDLIB-$$(target))/_sysconfigdata_* $$(PYTHON_STDLIB-$(sdk))/; )
482505

506+
# Copy the platform site folders for each architecture
507+
mkdir -p $$(PYTHON_PLATFORM_CONFIG-$(sdk))
508+
$$(foreach target,$$(SDK_TARGETS-$(sdk)),cp -r $$(PYTHON_PLATFORM_CONFIG-$$(target)) $$(PYTHON_PLATFORM_CONFIG-$(sdk)); )
509+
483510
# Merge the binary modules from each target in the $(sdk) SDK into a single binary
484511
$$(foreach module,$$(wildcard $$(PYTHON_STDLIB-$$(firstword $$(SDK_TARGETS-$(sdk))))/lib-dynload/*),lipo -create -output $$(PYTHON_STDLIB-$(sdk))/lib-dynload/$$(notdir $$(module)) $$(foreach target,$$(SDK_TARGETS-$(sdk)),$$(PYTHON_STDLIB-$$(target))/lib-dynload/$$(notdir $$(module))); )
485512

@@ -564,6 +591,15 @@ $$(PYTHON_XCFRAMEWORK-$(os))/Info.plist: \
564591
# Rewrite the framework to make it standalone
565592
patch/make-relocatable.sh $$(PYTHON_INSTALL_VERSION-macosx) 2>&1 > /dev/null
566593

594+
# Create the modulemap file
595+
cp -r patch/Python/module.modulemap.prefix $$(PYTHON_MODULEMAP-macosx)
596+
echo "" >> $$(PYTHON_MODULEMAP-macosx)
597+
cd $$(PYTHON_INCLUDE-macosx) && \
598+
find cpython -name "*.h" | sort | sed -e 's/^/ exclude header "/' | sed 's/$$$$/"/' >> $$(PYTHON_MODULEMAP-macosx) && \
599+
echo "" >> $$(PYTHON_MODULEMAP-macosx) && \
600+
find internal -name "*.h" | sort | sed -e 's/^/ exclude header "/' | sed 's/$$$$/"/' >> $$(PYTHON_MODULEMAP-macosx)
601+
echo "\n}" >> $$(PYTHON_MODULEMAP-macosx)
602+
567603
# Re-apply the signature on the binaries.
568604
codesign -s - --preserve-metadata=identifier,entitlements,flags,runtime -f $$(PYTHON_LIB-macosx) \
569605
2>&1 | tee $$(PYTHON_INSTALL-macosx)/python-$(os).codesign.log
@@ -587,7 +623,7 @@ support/$(PYTHON_VER)/macOS/VERSIONS:
587623
dist/Python-$(PYTHON_VER)-macOS-support.$(BUILD_NUMBER).tar.gz: \
588624
$$(PYTHON_XCFRAMEWORK-macOS)/Info.plist \
589625
support/$(PYTHON_VER)/macOS/VERSIONS \
590-
$$(foreach target,$$(TARGETS-macOS), $$(PYTHON_SITECUSTOMIZE-$$(target)))
626+
$$(foreach target,$$(TARGETS-macOS), $$(PYTHON_PLATFORM_SITECUSTOMIZE-$$(target)))
591627

592628
@echo ">>> Create final distribution artefact for macOS"
593629
mkdir -p dist
@@ -610,9 +646,7 @@ $$(PYTHON_XCFRAMEWORK-$(os))/Info.plist: \
610646
$$(foreach sdk,$$(SDKS-$(os)),cp -r $$(PYTHON_INSTALL-$$(sdk))/include $$(PYTHON_XCFRAMEWORK-$(os))/$$(SDK_SLICE-$$(sdk)); )
611647
$$(foreach sdk,$$(SDKS-$(os)),cp -r $$(PYTHON_INSTALL-$$(sdk))/bin $$(PYTHON_XCFRAMEWORK-$(os))/$$(SDK_SLICE-$$(sdk)); )
612648
$$(foreach sdk,$$(SDKS-$(os)),cp -r $$(PYTHON_INSTALL-$$(sdk))/lib $$(PYTHON_XCFRAMEWORK-$(os))/$$(SDK_SLICE-$$(sdk)); )
613-
614-
@echo ">>> Create helper links in XCframework for $(os)"
615-
$$(foreach sdk,$$(SDKS-$(os)),ln -si $$(SDK_SLICE-$$(sdk)) $$(PYTHON_XCFRAMEWORK-$(os))/$$(sdk); )
649+
$$(foreach sdk,$$(SDKS-$(os)),cp -r $$(PYTHON_INSTALL-$$(sdk))/platform-config $$(PYTHON_XCFRAMEWORK-$(os))/$$(SDK_SLICE-$$(sdk)); )
616650

617651
ifeq ($(os),iOS)
618652
@echo ">>> Clone testbed project for $(os)"
@@ -632,7 +666,7 @@ endif
632666

633667
dist/Python-$(PYTHON_VER)-$(os)-support.$(BUILD_NUMBER).tar.gz: \
634668
$$(PYTHON_XCFRAMEWORK-$(os))/Info.plist \
635-
$$(foreach target,$$(TARGETS-$(os)), $$(PYTHON_SITECUSTOMIZE-$$(target)))
669+
$$(foreach target,$$(TARGETS-$(os)), $$(PYTHON_PLATFORM_SITECUSTOMIZE-$$(target)))
636670

637671
@echo ">>> Create final distribution artefact for $(os)"
638672
mkdir -p dist

README.rst

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,6 @@ Each support package contains:
8383

8484
* ``VERSIONS``, a text file describing the specific versions of code used to build the
8585
support package;
86-
* ``platform-site``, a folder that contains site customization scripts that can be used
87-
to make your local Python install look like it is an on-device install for each of the
88-
underlying target architectures supported by the platform. This is needed because when
89-
you run ``pip`` you'll be on a macOS machine with a specific architecture; if ``pip``
90-
tries to install a binary package, it will install a macOS binary wheel (which won't
91-
work on iOS/tvOS/watchOS). However, if you add the ``platform-site`` folder to your
92-
``PYTHONPATH`` when invoking pip, the site customization will make your Python install
93-
return ``platform`` and ``sysconfig`` responses consistent with on-device behavior,
94-
which will cause ``pip`` to install platform-appropriate packages.
9586
* ``Python.xcframework``, a multi-architecture build of the Python runtime library
9687

9788
On iOS/tvOS/watchOS, the ``Python.xcframework`` contains a
@@ -105,6 +96,32 @@ needed to build packages. This is required because Xcode uses the ``xcrun``
10596
alias to dynamically generate the name of binaries, but a lot of C tooling
10697
expects that ``CC`` will not contain spaces.
10798

99+
Each slice of an iOS/tvOS/watchOS XCframework also contains a
100+
``platform-config`` folder with a subfolder for each supported architecture in
101+
that slice. These subfolders can be used to make a macOS Python environment
102+
behave as if it were on an iOS/tvOS/watchOS device. This works in one of two
103+
ways:
104+
105+
1. **A sitecustomize.py script**. If the ``platform-config`` subfolder is on
106+
your ``PYTHONPATH`` when a Python interpreter is started, a site
107+
customization will be applied that patches methods in ``sys``, ``sysconfig``
108+
and ``platform`` that are used to identify the system.
109+
110+
2. **A make_cross_venv.py script**. If you call ``make_cross_venv.py``,
111+
providing the location of a virtual environment, the script will add some
112+
files to the ``site-packages`` folder of that environment that will
113+
automatically apply the same set of patches as the ``sitecustomize.py``
114+
script whenever the environment is activated, without any need to modify
115+
``PYTHONPATH``. If you use ``build`` to create an isolated PEP 517
116+
environment to build a wheel, these patches will also be applied to the
117+
isolated build environment that is created.
118+
119+
iOS distributions also contain a copy of the iOS ``testbed`` project - an Xcode
120+
project that can be used to run test suites of Python code. See the `CPython
121+
documentation on testing packages
122+
<https://docs.python.org/3/using/ios.html#testing-a-python-package>`__ for
123+
details on how to use this testbed.
124+
108125
For a detailed instructions on using the support package in your own project,
109126
see the `usage guide <./USAGE.md>`__
110127

0 commit comments

Comments
 (0)