Skip to content

Commit 0b59ac9

Browse files
committed
More minor patch updates.
1 parent 07b0841 commit 0b59ac9

1 file changed

Lines changed: 119 additions & 12 deletions

File tree

patch/Python/Python.patch

Lines changed: 119 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,9 @@ index ad91fe68a33..25dffd4d899 100644
436436
+ )
437437
+ shutil.unpack_archive(archive_path, prefix_dir)
438438
+
439-
+ # Dynamic libraries will be preferentially linked over static; On non-macOS
440-
+ # platforms, ensure that no dylibs are available in the prefix folder.
441-
+ if platform != "macOS":
439+
+ # Dynamic libraries will be preferentially linked over static;
440+
+ # On iOS, ensure that no dylibs are available in the prefix folder.
441+
+ if platform == "iOS":
442442
+ for dylib in prefix_dir.glob("**/*.dylib"):
443443
+ dylib.unlink()
444444
+
@@ -940,7 +940,7 @@ index ad91fe68a33..25dffd4d899 100644
940940
+ + [
941941
+ "--",
942942
+ "test",
943-
+ f"--{context.ci_mode or 'fast'}-ci",
943+
+ # f"--{context.ci_mode}-ci",
944944
+ "-uall",
945945
+ "--rerun",
946946
+ "--single-process",
@@ -1643,7 +1643,7 @@ index ad91fe68a33..25dffd4d899 100644
16431643
+#endif
16441644
--- /dev/null
16451645
+++ b/Apple/testbed/Python.xcframework/Info.plist
1646-
@@ -0,0 +1,44 @@
1646+
@@ -0,0 +1,106 @@
16471647
+<?xml version="1.0" encoding="UTF-8"?>
16481648
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
16491649
+<plist version="1.0">
@@ -1681,6 +1681,68 @@ index ad91fe68a33..25dffd4d899 100644
16811681
+ <key>SupportedPlatformVariant</key>
16821682
+ <string>simulator</string>
16831683
+ </dict>
1684+
+ <dict>
1685+
+ <key>BinaryPath</key>
1686+
+ <string>Python.framework/Python</string>
1687+
+ <key>LibraryIdentifier</key>
1688+
+ <string>tvos-arm64</string>
1689+
+ <key>LibraryPath</key>
1690+
+ <string>Python.framework</string>
1691+
+ <key>SupportedArchitectures</key>
1692+
+ <array>
1693+
+ <string>arm64</string>
1694+
+ </array>
1695+
+ <key>SupportedPlatform</key>
1696+
+ <string>tvos</string>
1697+
+ </dict>
1698+
+ <dict>
1699+
+ <key>BinaryPath</key>
1700+
+ <string>Python.framework/Python</string>
1701+
+ <key>LibraryIdentifier</key>
1702+
+ <string>tvos-arm64_x86_64-simulator</string>
1703+
+ <key>LibraryPath</key>
1704+
+ <string>Python.framework</string>
1705+
+ <key>SupportedArchitectures</key>
1706+
+ <array>
1707+
+ <string>arm64</string>
1708+
+ <string>x86_64</string>
1709+
+ </array>
1710+
+ <key>SupportedPlatform</key>
1711+
+ <string>tvos</string>
1712+
+ <key>SupportedPlatformVariant</key>
1713+
+ <string>simulator</string>
1714+
+ </dict>
1715+
+ <dict>
1716+
+ <key>BinaryPath</key>
1717+
+ <string>Python.framework/Python</string>
1718+
+ <key>LibraryIdentifier</key>
1719+
+ <string>watchos-arm64_x86_64-simulator</string>
1720+
+ <key>LibraryPath</key>
1721+
+ <string>Python.framework</string>
1722+
+ <key>SupportedArchitectures</key>
1723+
+ <array>
1724+
+ <string>arm64</string>
1725+
+ <string>x86_64</string>
1726+
+ </array>
1727+
+ <key>SupportedPlatform</key>
1728+
+ <string>watchos</string>
1729+
+ <key>SupportedPlatformVariant</key>
1730+
+ <string>simulator</string>
1731+
+ </dict>
1732+
+ <dict>
1733+
+ <key>BinaryPath</key>
1734+
+ <string>Python.framework/Python</string>
1735+
+ <key>LibraryIdentifier</key>
1736+
+ <string>watchos-arm64_32</string>
1737+
+ <key>LibraryPath</key>
1738+
+ <string>Python.framework</string>
1739+
+ <key>SupportedArchitectures</key>
1740+
+ <array>
1741+
+ <string>arm64_32</string>
1742+
+ </array>
1743+
+ <key>SupportedPlatform</key>
1744+
+ <string>watchos</string>
1745+
+ </dict>
16841746
+ </array>
16851747
+ <key>CFBundlePackageType</key>
16861748
+ <string>XFWK</string>
@@ -1748,7 +1810,7 @@ index ad91fe68a33..25dffd4d899 100644
17481810
+</plist>
17491811
--- /dev/null
17501812
+++ b/Apple/testbed/Python.xcframework/build/utils.sh
1751-
@@ -0,0 +1,151 @@
1813+
@@ -0,0 +1,174 @@
17521814
+# Utility methods for use in an Xcode project.
17531815
+#
17541816
+# An iOS XCframework cannot include any content other than the library binary
@@ -1785,9 +1847,32 @@ index ad91fe68a33..25dffd4d899 100644
17851847
+ else
17861848
+ SLICE_FOLDER="ios-arm64_x86_64-simulator"
17871849
+ fi
1788-
+ else
1850+
+ elif [ "$EFFECTIVE_PLATFORM_NAME" = "-iphoneos" ]; then
17891851
+ echo "Installing Python modules for iOS Device"
17901852
+ SLICE_FOLDER="ios-arm64"
1853+
+ elif [ "$EFFECTIVE_PLATFORM_NAME" = "-appletvsimulator" ]; then
1854+
+ echo "Installing Python modules for tvOS Simulator"
1855+
+ if [ -d "$PROJECT_DIR/$PYTHON_XCFRAMEWORK_PATH/tvos-arm64-simulator" ]; then
1856+
+ SLICE_FOLDER="tvos-arm64-simulator"
1857+
+ else
1858+
+ SLICE_FOLDER="tvos-arm64_x86_64-simulator"
1859+
+ fi
1860+
+ elif [ "$EFFECTIVE_PLATFORM_NAME" = "-appletvos" ]; then
1861+
+ echo "Installing Python modules for tvOS Device"
1862+
+ SLICE_FOLDER="tvos-arm64"
1863+
+ elif [ "$EFFECTIVE_PLATFORM_NAME" = "-watchsimulator" ]; then
1864+
+ echo "Installing Python modules for watchOS Simulator"
1865+
+ if [ -d "$PROJECT_DIR/$PYTHON_XCFRAMEWORK_PATH/watchos-arm64-simulator" ]; then
1866+
+ SLICE_FOLDER="watchos-arm64-simulator"
1867+
+ else
1868+
+ SLICE_FOLDER="watchos-arm64_x86_64-simulator"
1869+
+ fi
1870+
+ elif [ "$EFFECTIVE_PLATFORM_NAME" = "-watchos" ]; then
1871+
+ echo "Installing Python modules for watchOS Device"
1872+
+ SLICE_FOLDER="watchos-arm64"
1873+
+ else
1874+
+ echo "Unsupported platform name $EFFECTIVE_PLATFORM_NAME"
1875+
+ exit 1
17911876
+ fi
17921877
+
17931878
+ # If the XCframework has a shared lib folder, then it's a full framework.
@@ -2181,18 +2266,22 @@ index ad91fe68a33..25dffd4d899 100644
21812266
+@end
21822267
--- /dev/null
21832268
+++ b/Apple/testbed/__main__.py
2184-
@@ -0,0 +1,434 @@
2269+
@@ -0,0 +1,456 @@
21852270
+import argparse
21862271
+import json
21872272
+import os
21882273
+import re
2274+
+import shlex
21892275
+import shutil
21902276
+import subprocess
21912277
+import sys
21922278
+from pathlib import Path
21932279
+
21942280
+TEST_SLICES = {
21952281
+ "iOS": "ios-arm64_x86_64-simulator",
2282+
+ "tvOS": "tvos-arm64_x86_64-simulator",
2283+
+ "visionOS": "xros-arm64-simulator",
2284+
+ "watchOS": "watchos-arm64_x86_64-simulator",
21962285
+}
21972286
+
21982287
+DECODE_ARGS = ("UTF-8", "backslashreplace")
@@ -2204,7 +2293,7 @@ index ad91fe68a33..25dffd4d899 100644
22042293
+LOG_PREFIX_REGEX = re.compile(
22052294
+ r"^\d{4}-\d{2}-\d{2}" # YYYY-MM-DD
22062295
+ r"\s+\d+:\d{2}:\d{2}\.\d+\+\d{4}" # HH:MM:SS.ssssss+ZZZZ
2207-
+ r"\s+iOSTestbed\[\d+:\w+\]" # Process/thread ID
2296+
+ r"\s+.*Testbed\[\d+:\w+\]" # Process/thread ID
22082297
+)
22092298
+
22102299
+
@@ -2237,6 +2326,24 @@ index ad91fe68a33..25dffd4d899 100644
22372326
+ )
22382327
+ )
22392328
+ simulator = se_simulators[-1][1]
2329+
+ elif platform == "tvOS":
2330+
+ # Find the most recent tvOS release.
2331+
+ simulators = sorted(
2332+
+ (devicetype["minRuntimeVersion"], devicetype["name"])
2333+
+ for devicetype in json_data["devicetypes"]
2334+
+ if devicetype["productFamily"] == "Apple TV"
2335+
+ )
2336+
+ simulator = simulators[-1][1]
2337+
+ elif platform == "visionOS":
2338+
+ # Find the most recent visionOS release.
2339+
+ simulators = sorted(
2340+
+ (devicetype["minRuntimeVersion"], devicetype["name"])
2341+
+ for devicetype in json_data["devicetypes"]
2342+
+ if devicetype["productFamily"] == "Apple Vision"
2343+
+ )
2344+
+ simulator = simulators[-1][1]
2345+
+ elif platform == "watchOS":
2346+
+ raise NotImplementedError("Don't know how to launch watchOS (yet)")
22402347
+ else:
22412348
+ raise ValueError(f"Unknown platform {platform}")
22422349
+
@@ -2436,7 +2543,7 @@ index ad91fe68a33..25dffd4d899 100644
24362543
+ test_plan = json.load(f)
24372544
+
24382545
+ test_plan["defaultOptions"]["commandLineArgumentEntries"] = [
2439-
+ {"argument": arg} for arg in args
2546+
+ {"argument": shlex.quote(arg)} for arg in args
24402547
+ ]
24412548
+
24422549
+ with test_plan_path.open("w", encoding="utf-8") as f:
@@ -2472,7 +2579,7 @@ index ad91fe68a33..25dffd4d899 100644
24722579
+ # many platforms, but when cloned, only one platform is preserved.
24732580
+ available_platforms = [
24742581
+ platform
2475-
+ for platform in ["iOS"]
2582+
+ for platform in ["iOS", "tvOS", "visionOS", "watchOS"]
24762583
+ if (Path(__file__).parent / f"{platform}Testbed").is_dir()
24772584
+ ]
24782585
+
@@ -2526,7 +2633,7 @@ index ad91fe68a33..25dffd4d899 100644
25262633
+ ),
25272634
+ description=(
25282635
+ "Run a testbed project. The arguments provided after `--` will be "
2529-
+ "passed to the running iOS process as if they were arguments to "
2636+
+ "passed to the running test process as if they were arguments to "
25302637
+ "`python -m`."
25312638
+ ),
25322639
+ help="Run a testbed project",

0 commit comments

Comments
 (0)