Skip to content

Commit 3290b85

Browse files
committed
Corrections to the testbed backport.
1 parent fdbc2e8 commit 3290b85

1 file changed

Lines changed: 28 additions & 15 deletions

File tree

patch/Python/Python.patch

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
+]
4141
--- /dev/null
4242
+++ b/Apple/__main__.py
43-
@@ -0,0 +1,1111 @@
43+
@@ -0,0 +1,1108 @@
4444
+#!/usr/bin/env python3
4545
+##########################################################################
4646
+# Apple XCframework build script
@@ -472,18 +472,15 @@
472472
+ relpath(PYTHON_DIR / "configure"),
473473
+ f"--host={host}",
474474
+ f"--build={sysconfig.get_config_var('BUILD_GNU_TYPE')}",
475-
+ f"--with-build-python={build_python_path()}",
476-
+ "--with-system-libmpdec",
477475
+ "--enable-framework",
476+
+ "PYTHON_FOR_REGEN=../build/python.exe",
478477
+ # Dependent libraries.
479478
+ f"--with-openssl={prefix_dir}",
480-
+ f"LIBLZMA_CFLAGS=-I{prefix_dir}/include",
481-
+ f"LIBLZMA_LIBS=-L{prefix_dir}/lib -llzma",
479+
+ f"CFLAGS=-I{prefix_dir}/include",
480+
+ f"LDFLAGS=-L{prefix_dir}/lib",
482481
+ f"LIBFFI_INCLUDEDIR={prefix_dir}/include",
483482
+ f"LIBFFI_LIBDIR={prefix_dir}/lib",
484483
+ "LIBFFI_LIB=ffi",
485-
+ f"LIBMPDEC_CFLAGS=-I{prefix_dir}/include",
486-
+ f"LIBMPDEC_LDFLAGS=-L{prefix_dir}/lib -lmpdec",
487484
+ ]
488485
+
489486
+ if context.args:
@@ -504,7 +501,7 @@
504501
+ cwd(subdir(host)),
505502
+ ):
506503
+ run(["make"], host=host)
507-
+ run(["make", "install"], host=host)
504+
+ run(["make", "install"], host=host, env={"DESTDIR": f"{Path.cwd()}/"})
508505
+
509506
+
510507
+def framework_path(host_triple: str, multiarch: str) -> Path:
@@ -2241,7 +2238,7 @@
22412238
+@end
22422239
--- /dev/null
22432240
+++ b/Apple/testbed/__main__.py
2244-
@@ -0,0 +1,456 @@
2241+
@@ -0,0 +1,472 @@
22452242
+import argparse
22462243
+import json
22472244
+import os
@@ -2250,6 +2247,7 @@
22502247
+import shutil
22512248
+import subprocess
22522249
+import sys
2250+
+from itertools import chain
22532251
+from pathlib import Path
22542252
+
22552253
+TEST_SLICES = {
@@ -2325,6 +2323,19 @@
23252323
+ return simulator
23262324
+
23272325
+
2326+
+# A backport of Path.relative_to(*, walk_up=True)
2327+
+def relative_to(target, other):
2328+
+ for step, path in enumerate(chain([other], other.parents)):
2329+
+ if path == target or path in target.parents:
2330+
+ break
2331+
+ else:
2332+
+ raise ValueError(
2333+
+ f"{str(target)!r} and {str(other)!r} have different anchors"
2334+
+ )
2335+
+ parts = [".."] * step + list(target.parts[len(path.parts) :])
2336+
+ return Path("/".join(parts))
2337+
+
2338+
+
23282339
+def xcode_test(location: Path, platform: str, simulator: str, verbose: bool):
23292340
+ # Build and run the test suite on the named simulator.
23302341
+ args = [
@@ -2443,7 +2454,7 @@
24432454
+ if framework.suffix == ".xcframework":
24442455
+ print(" Installing XCFramework...", end="")
24452456
+ xc_framework_path.symlink_to(
2446-
+ framework.relative_to(xc_framework_path.parent, walk_up=True)
2457+
+ relative_to(framework, xc_framework_path.parent)
24472458
+ )
24482459
+ print(" done")
24492460
+ else:
@@ -2457,7 +2468,7 @@
24572468
+ else:
24582469
+ test_framework_path.unlink(missing_ok=True)
24592470
+ test_framework_path.symlink_to(
2460-
+ framework.relative_to(test_framework_path.parent, walk_up=True)
2471+
+ relative_to(framework, test_framework_path.parent)
24612472
+ )
24622473
+ print(" done")
24632474
+ else:
@@ -2475,8 +2486,9 @@
24752486
+ ).resolve()
24762487
+ xc_framework_path.unlink()
24772488
+ xc_framework_path.symlink_to(
2478-
+ resolved_xc_framework_path.relative_to(
2479-
+ xc_framework_path.parent, walk_up=True
2489+
+ relative_to(
2490+
+ resolved_xc_framework_path,
2491+
+ xc_framework_path.parent,
24802492
+ )
24812493
+ )
24822494
+ print(" done")
@@ -2492,8 +2504,9 @@
24922504
+ ).resolve()
24932505
+ test_framework_path.unlink()
24942506
+ test_framework_path.symlink_to(
2495-
+ orig_test_framework_path.relative_to(
2496-
+ test_framework_path.parent, walk_up=True
2507+
+ relative_to(
2508+
+ orig_test_framework_path,
2509+
+ test_framework_path.parent,
24972510
+ )
24982511
+ )
24992512
+ print(" done")

0 commit comments

Comments
 (0)