Skip to content

Commit 0013ca0

Browse files
authored
Update patch for Python 3.14.0a6 (#258)
* Update patch for v3.14.0a6, * Automate the contents of the modulemap file.
1 parent c794b06 commit 0013ca0

File tree

5 files changed

+60
-327
lines changed

5 files changed

+60
-327
lines changed

Diff for: .github/workflows/ci.yaml

+3-4
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:
@@ -114,6 +110,9 @@ jobs:
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: |

Diff for: Makefile

+19-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ BUILD_NUMBER=custom
1818
# of a release cycle, as official binaries won't be published.
1919
# PYTHON_MICRO_VERSION is the full version number, without any alpha/beta/rc suffix. (e.g., 3.10.0)
2020
# PYTHON_VER is the major/minor version (e.g., 3.10)
21-
PYTHON_VERSION=3.14.0a5
21+
PYTHON_VERSION=3.14.0a6
2222
PYTHON_PKG_VERSION=$(PYTHON_VERSION)
2323
PYTHON_MICRO_VERSION=$(shell echo $(PYTHON_VERSION) | grep -Eo "\d+\.\d+\.\d+")
2424
PYTHON_PKG_MICRO_VERSION=$(shell echo $(PYTHON_PKG_VERSION) | grep -Eo "\d+\.\d+\.\d+")
@@ -426,6 +426,7 @@ PYTHON_FRAMEWORK-$(sdk)=$$(PYTHON_INSTALL-$(sdk))/Python.framework
426426
PYTHON_INSTALL_VERSION-$(sdk)=$$(PYTHON_FRAMEWORK-$(sdk))/Versions/$(PYTHON_VER)
427427
PYTHON_LIB-$(sdk)=$$(PYTHON_INSTALL_VERSION-$(sdk))/Python
428428
PYTHON_INCLUDE-$(sdk)=$$(PYTHON_INSTALL_VERSION-$(sdk))/include/python$(PYTHON_VER)
429+
PYTHON_MODULEMAP-$(sdk)=$$(PYTHON_INCLUDE-$(sdk))/module.modulemap
429430
PYTHON_STDLIB-$(sdk)=$$(PYTHON_INSTALL_VERSION-$(sdk))/lib/python$(PYTHON_VER)
430431

431432
else
@@ -436,6 +437,7 @@ else
436437
# The non-macOS frameworks don't use the versioning structure.
437438

438439
PYTHON_INSTALL-$(sdk)=$(PROJECT_DIR)/install/$(os)/$(sdk)/python-$(PYTHON_VERSION)
440+
PYTHON_MODULEMAP-$(sdk)=$$(PYTHON_INCLUDE-$(sdk))/module.modulemap
439441
PYTHON_FRAMEWORK-$(sdk)=$$(PYTHON_INSTALL-$(sdk))/Python.framework
440442
PYTHON_LIB-$(sdk)=$$(PYTHON_FRAMEWORK-$(sdk))/Python
441443
PYTHON_BIN-$(sdk)=$$(PYTHON_INSTALL-$(sdk))/bin
@@ -466,8 +468,14 @@ $$(PYTHON_INCLUDE-$(sdk))/pyconfig.h: $$(PYTHON_LIB-$(sdk))
466468
# Copy headers as-is from the first target in the $(sdk) SDK
467469
cp -r $$(PYTHON_INCLUDE-$$(firstword $$(SDK_TARGETS-$(sdk)))) $$(PYTHON_INCLUDE-$(sdk))
468470

469-
# Copy in the modulemap file
470-
cp -r patch/Python/module.modulemap $$(PYTHON_INCLUDE-$(sdk))
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))
471479

472480
# Link the PYTHONHOME version of the headers
473481
mkdir -p $$(PYTHON_INSTALL-$(sdk))/include
@@ -585,8 +593,14 @@ $$(PYTHON_XCFRAMEWORK-$(os))/Info.plist: \
585593
# Rewrite the framework to make it standalone
586594
patch/make-relocatable.sh $$(PYTHON_INSTALL_VERSION-macosx) 2>&1 > /dev/null
587595

588-
# Copy in the modulemap file
589-
cp -r patch/Python/module.modulemap $$(PYTHON_FRAMEWORK-macosx)/Headers
596+
# Create the modulemap file
597+
cp -r patch/Python/module.modulemap.prefix $$(PYTHON_MODULEMAP-macosx)
598+
echo "" >> $$(PYTHON_MODULEMAP-macosx)
599+
cd $$(PYTHON_INCLUDE-macosx) && \
600+
find cpython -name "*.h" | sort | sed -e 's/^/ exclude header "/' | sed 's/$$$$/"/' >> $$(PYTHON_MODULEMAP-macosx) && \
601+
echo "" >> $$(PYTHON_MODULEMAP-macosx) && \
602+
find internal -name "*.h" | sort | sed -e 's/^/ exclude header "/' | sed 's/$$$$/"/' >> $$(PYTHON_MODULEMAP-macosx)
603+
echo "\n}" >> $$(PYTHON_MODULEMAP-macosx)
590604

591605
# Re-apply the signature on the binaries.
592606
codesign -s - --preserve-metadata=identifier,entitlements,flags,runtime -f $$(PYTHON_LIB-macosx) \

Diff for: patch/Python/Python.patch

+18-153
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ index 1f6baed66d3..235dd98c60a 100644
113113
macos_release = mac_ver()[0]
114114
if macos_release:
115115
diff --git a/Lib/sysconfig/__init__.py b/Lib/sysconfig/__init__.py
116-
index 69f72452c40..34ce643340b 100644
116+
index 18e6b8d25e5..4994c56778c 100644
117117
--- a/Lib/sysconfig/__init__.py
118118
+++ b/Lib/sysconfig/__init__.py
119119
@@ -719,6 +719,14 @@
@@ -163,7 +163,7 @@ index ec0857a4a99..2350e9dc821 100644
163163
# elif !defined(TARGET_OS_OSX) || TARGET_OS_OSX
164164
PLATFORM_TRIPLET=darwin
165165
diff --git a/configure b/configure
166-
index d46bc563a67..d5cd81d16a8 100755
166+
index d0ae103014a..308124ef06d 100755
167167
--- a/configure
168168
+++ b/configure
169169
@@ -974,6 +974,8 @@
@@ -588,7 +588,7 @@ index d46bc563a67..d5cd81d16a8 100755
588588
fi
589589
ac_fn_c_check_func "$LINENO" "pread" "ac_cv_func_pread"
590590
if test "x$ac_cv_func_pread" = xyes
591-
@@ -19860,12 +19973,6 @@
591+
@@ -19866,12 +19979,6 @@
592592
then :
593593
printf "%s\n" "#define HAVE_SIGACTION 1" >>confdefs.h
594594

@@ -601,7 +601,7 @@ index d46bc563a67..d5cd81d16a8 100755
601601
fi
602602
ac_fn_c_check_func "$LINENO" "sigfillset" "ac_cv_func_sigfillset"
603603
if test "x$ac_cv_func_sigfillset" = xyes
604-
@@ -20134,11 +20241,11 @@
604+
@@ -20140,11 +20247,11 @@
605605

606606
fi
607607

@@ -615,7 +615,7 @@ index d46bc563a67..d5cd81d16a8 100755
615615
ac_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
616616
if test "x$ac_cv_func_getentropy" = xyes
617617
then :
618-
@@ -20160,6 +20267,53 @@
618+
@@ -20166,6 +20273,53 @@
619619

620620
fi
621621

@@ -669,7 +669,7 @@ index d46bc563a67..d5cd81d16a8 100755
669669
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5
670670
printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
671671
if test ${ac_cv_c_undeclared_builtin_options+y}
672-
@@ -23242,7 +23396,8 @@
672+
@@ -23248,7 +23402,8 @@
673673

674674

675675
# check for openpty, login_tty, and forkpty
@@ -679,7 +679,7 @@ index d46bc563a67..d5cd81d16a8 100755
679679

680680
for ac_func in openpty
681681
do :
682-
@@ -23356,7 +23511,7 @@
682+
@@ -23362,7 +23517,7 @@
683683
fi
684684

685685
done
@@ -688,15 +688,15 @@ index d46bc563a67..d5cd81d16a8 100755
688688
printf %s "checking for library containing login_tty... " >&6; }
689689
if test ${ac_cv_search_login_tty+y}
690690
then :
691-
@@ -23539,6 +23694,7 @@
691+
@@ -23545,6 +23700,7 @@
692692
fi
693693

694694
done
695695
+fi
696696

697697
# check for long file support functions
698698
ac_fn_c_check_func "$LINENO" "fseek64" "ac_cv_func_fseek64"
699-
@@ -23804,10 +23960,10 @@
699+
@@ -23810,10 +23966,10 @@
700700

701701
done
702702

@@ -709,7 +709,7 @@ index d46bc563a67..d5cd81d16a8 100755
709709
then
710710

711711
for ac_func in clock_settime
712-
@@ -26146,8 +26302,8 @@
712+
@@ -26152,8 +26308,8 @@
713713
LIBPYTHON="\$(BLDLIBRARY)"
714714
fi
715715

@@ -720,7 +720,7 @@ index d46bc563a67..d5cd81d16a8 100755
720720
MODULE_DEPS_SHARED="$MODULE_DEPS_SHARED \$(PYTHONFRAMEWORKDIR)/\$(PYTHONFRAMEWORK)"
721721
fi
722722

723-
@@ -29017,7 +29173,7 @@
723+
@@ -29023,7 +29179,7 @@
724724
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for device files" >&5
725725
printf "%s\n" "$as_me: checking for device files" >&6;}
726726

@@ -729,7 +729,7 @@ index d46bc563a67..d5cd81d16a8 100755
729729
ac_cv_file__dev_ptmx=no
730730
ac_cv_file__dev_ptc=no
731731
else
732-
@@ -29510,7 +29666,7 @@
732+
@@ -29504,7 +29660,7 @@
733733
with_ensurepip=no ;; #(
734734
WASI) :
735735
with_ensurepip=no ;; #(
@@ -738,7 +738,7 @@ index d46bc563a67..d5cd81d16a8 100755
738738
with_ensurepip=no ;; #(
739739
*) :
740740
with_ensurepip=upgrade
741-
@@ -30490,7 +30646,7 @@
741+
@@ -30484,7 +30640,7 @@
742742
;; #(
743743
Darwin) :
744744
;; #(
@@ -747,7 +747,7 @@ index d46bc563a67..d5cd81d16a8 100755
747747

748748

749749

750-
@@ -34493,6 +34649,8 @@
750+
@@ -34487,6 +34643,8 @@
751751
"Mac/Resources/framework/Info.plist") CONFIG_FILES="$CONFIG_FILES Mac/Resources/framework/Info.plist" ;;
752752
"Mac/Resources/app/Info.plist") CONFIG_FILES="$CONFIG_FILES Mac/Resources/app/Info.plist" ;;
753753
"iOS/Resources/Info.plist") CONFIG_FILES="$CONFIG_FILES iOS/Resources/Info.plist" ;;
@@ -757,7 +757,7 @@ index d46bc563a67..d5cd81d16a8 100755
757757
"Misc/python.pc") CONFIG_FILES="$CONFIG_FILES Misc/python.pc" ;;
758758
"Misc/python-embed.pc") CONFIG_FILES="$CONFIG_FILES Misc/python-embed.pc" ;;
759759
diff --git a/configure.ac b/configure.ac
760-
index faa89095303..9bd51f7da97 100644
760+
index 8bb0f1c6ef4..bfd67de48bb 100644
761761
--- a/configure.ac
762762
+++ b/configure.ac
763763
@@ -330,6 +330,12 @@
@@ -1128,7 +1128,7 @@ index faa89095303..9bd51f7da97 100644
11281128
+ pipe2 plock poll posix_fadvise posix_fallocate posix_openpt \
11291129
pread preadv preadv2 process_vm_readv \
11301130
pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_init \
1131-
pthread_kill pthread_getname_np pthread_setname_np \
1131+
pthread_kill pthread_getname_np pthread_setname_np pthread_getattr_np \
11321132
@@ -5153,7 +5283,7 @@
11331133
sched_setparam sched_setscheduler sem_clockwait sem_getvalue sem_open \
11341134
sem_timedwait sem_unlink sendfile setegid seteuid setgid sethostname \
@@ -1232,7 +1232,7 @@ index faa89095303..9bd51f7da97 100644
12321232
ac_cv_file__dev_ptmx=no
12331233
ac_cv_file__dev_ptc=no
12341234
else
1235-
@@ -7187,7 +7327,7 @@
1235+
@@ -7174,7 +7314,7 @@
12361236
AS_CASE([$ac_sys_system],
12371237
[Emscripten], [with_ensurepip=no],
12381238
[WASI], [with_ensurepip=no],
@@ -1241,7 +1241,7 @@ index faa89095303..9bd51f7da97 100644
12411241
[with_ensurepip=upgrade]
12421242
)
12431243
])
1244-
@@ -7598,7 +7738,7 @@
1244+
@@ -7585,7 +7725,7 @@
12451245
[VxWorks*], [PY_STDLIB_MOD_SET_NA([_scproxy], [termios], [grp])],
12461246
dnl The _scproxy module is available on macOS
12471247
[Darwin], [],
@@ -1270,141 +1270,6 @@ index c3e261ecd9e..26ef7a95de4 100644
12701270
<key>CFBundleSupportedPlatforms</key>
12711271
<array>
12721272
<string>iPhoneOS</string>
1273-
diff --git a/iOS/testbed/__main__.py b/iOS/testbed/__main__.py
1274-
index b4499f5ac17..d12a5ab065b 100644
1275-
--- a/iOS/testbed/__main__.py
1276-
+++ b/iOS/testbed/__main__.py
1277-
@@ -82,19 +82,29 @@
1278-
1279-
# Return a list of UDIDs associated with booted simulators
1280-
async def list_devices():
1281-
- # List the testing simulators, in JSON format
1282-
- raw_json = await async_check_output(
1283-
- "xcrun", "simctl", "--set", "testing", "list", "-j"
1284-
- )
1285-
- json_data = json.loads(raw_json)
1286-
-
1287-
- # Filter out the booted iOS simulators
1288-
- return [
1289-
- simulator["udid"]
1290-
- for runtime, simulators in json_data["devices"].items()
1291-
- for simulator in simulators
1292-
- if runtime.split(".")[-1].startswith("iOS") and simulator["state"] == "Booted"
1293-
- ]
1294-
+ try:
1295-
+ # List the testing simulators, in JSON format
1296-
+ raw_json = await async_check_output(
1297-
+ "xcrun", "simctl", "--set", "testing", "list", "-j"
1298-
+ )
1299-
+ json_data = json.loads(raw_json)
1300-
+
1301-
+ # Filter out the booted iOS simulators
1302-
+ return [
1303-
+ simulator["udid"]
1304-
+ for runtime, simulators in json_data["devices"].items()
1305-
+ for simulator in simulators
1306-
+ if runtime.split(".")[-1].startswith("iOS") and simulator["state"] == "Booted"
1307-
+ ]
1308-
+ except subprocess.CalledProcessError as e:
1309-
+ # If there's no ~/Library/Developer/XCTestDevices folder (which is the
1310-
+ # case on fresh installs, and in some CI environments), `simctl list`
1311-
+ # returns error code 1, rather than an empty list. Handle that case,
1312-
+ # but raise all other errors.
1313-
+ if e.returncode == 1:
1314-
+ return []
1315-
+ else:
1316-
+ raise
1317-
1318-
1319-
async def find_device(initial_devices):
1320-
@@ -230,33 +240,69 @@
1321-
shutil.copytree(source, target, symlinks=True)
1322-
print(" done")
1323-
1324-
+ xc_framework_path = target / "Python.xcframework"
1325-
+ sim_framework_path = xc_framework_path / "ios-arm64_x86_64-simulator"
1326-
if framework is not None:
1327-
if framework.suffix == ".xcframework":
1328-
print(" Installing XCFramework...", end="", flush=True)
1329-
- xc_framework_path = (target / "Python.xcframework").resolve()
1330-
if xc_framework_path.is_dir():
1331-
shutil.rmtree(xc_framework_path)
1332-
else:
1333-
- xc_framework_path.unlink()
1334-
+ xc_framework_path.unlink(missing_ok=True)
1335-
xc_framework_path.symlink_to(
1336-
framework.relative_to(xc_framework_path.parent, walk_up=True)
1337-
)
1338-
print(" done")
1339-
else:
1340-
print(" Installing simulator framework...", end="", flush=True)
1341-
- sim_framework_path = (
1342-
- target / "Python.xcframework" / "ios-arm64_x86_64-simulator"
1343-
- ).resolve()
1344-
if sim_framework_path.is_dir():
1345-
shutil.rmtree(sim_framework_path)
1346-
else:
1347-
- sim_framework_path.unlink()
1348-
+ sim_framework_path.unlink(missing_ok=True)
1349-
sim_framework_path.symlink_to(
1350-
framework.relative_to(sim_framework_path.parent, walk_up=True)
1351-
)
1352-
print(" done")
1353-
else:
1354-
- print(" Using pre-existing iOS framework.")
1355-
+ if (
1356-
+ xc_framework_path.is_symlink()
1357-
+ and not xc_framework_path.readlink().is_absolute()
1358-
+ ):
1359-
+ # XCFramework is a relative symlink. Rewrite the symlink relative
1360-
+ # to the new location.
1361-
+ print(" Rewriting symlink to XCframework...", end="", flush=True)
1362-
+ orig_xc_framework_path = (
1363-
+ source
1364-
+ / xc_framework_path.readlink()
1365-
+ ).resolve()
1366-
+ xc_framework_path.unlink()
1367-
+ xc_framework_path.symlink_to(
1368-
+ orig_xc_framework_path.relative_to(
1369-
+ xc_framework_path.parent, walk_up=True
1370-
+ )
1371-
+ )
1372-
+ print(" done")
1373-
+ elif (
1374-
+ sim_framework_path.is_symlink()
1375-
+ and not sim_framework_path.readlink().is_absolute()
1376-
+ ):
1377-
+ print(" Rewriting symlink to simulator framework...", end="", flush=True)
1378-
+ # Simulator framework is a relative symlink. Rewrite the symlink
1379-
+ # relative to the new location.
1380-
+ orig_sim_framework_path = (
1381-
+ source
1382-
+ / "Python.XCframework"
1383-
+ / sim_framework_path.readlink()
1384-
+ ).resolve()
1385-
+ sim_framework_path.unlink()
1386-
+ sim_framework_path.symlink_to(
1387-
+ orig_sim_framework_path.relative_to(
1388-
+ sim_framework_path.parent, walk_up=True
1389-
+ )
1390-
+ )
1391-
+ print(" done")
1392-
+ else:
1393-
+ print(" Using pre-existing iOS framework.")
1394-
1395-
for app_src in apps:
1396-
print(f" Installing app {app_src.name!r}...", end="", flush=True)
1397-
@@ -372,8 +418,8 @@
1398-
1399-
if context.subcommand == "clone":
1400-
clone_testbed(
1401-
- source=Path(__file__).parent,
1402-
- target=Path(context.location),
1403-
+ source=Path(__file__).parent.resolve(),
1404-
+ target=Path(context.location).resolve(),
1405-
framework=Path(context.framework).resolve() if context.framework else None,
1406-
apps=[Path(app) for app in context.apps],
1407-
)
14081273
--- /dev/null
14091274
+++ b/tvOS/README.rst
14101275
@@ -0,0 +1,108 @@

0 commit comments

Comments
 (0)