Skip to content

Commit 3a13d56

Browse files
committed
Correct handling of deep cross-build paths.
1 parent 2f6b254 commit 3a13d56

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

iOS/testbed/__main__.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ def clone_testbed(
186186
sys.exit(10)
187187

188188
if framework is None:
189-
if not (source / "Python.xcframework/ios-arm64_x86_64-simulator/bin").is_dir():
189+
if not (
190+
source / "Python.xcframework/ios-arm64_x86_64-simulator/bin"
191+
).is_dir():
190192
print(
191193
f"The testbed being cloned ({source}) does not contain "
192194
f"a simulator framework. Re-run with --framework"
@@ -214,23 +216,27 @@ def clone_testbed(
214216
if framework is not None:
215217
if framework.suffix == ".xcframework":
216218
print(" Installing XCFramework...", end="", flush=True)
217-
xc_framework_path = target / "Python.xcframework"
219+
xc_framework_path = (target / "Python.xcframework").resolve()
218220
if xc_framework_path.is_dir():
219221
shutil.rmtree(xc_framework_path)
220222
else:
221223
xc_framework_path.unlink()
222-
xc_framework_path.symlink_to(framework)
224+
xc_framework_path.symlink_to(
225+
framework.relative_to(xc_framework_path.parent, walk_up=True)
226+
)
223227
print(" done")
224228
else:
225229
print(" Installing simulator framework...", end="", flush=True)
226230
sim_framework_path = (
227231
target / "Python.xcframework" / "ios-arm64_x86_64-simulator"
228-
)
232+
).resolve()
229233
if sim_framework_path.is_dir():
230234
shutil.rmtree(sim_framework_path)
231235
else:
232236
sim_framework_path.unlink()
233-
sim_framework_path.symlink_to(framework)
237+
sim_framework_path.symlink_to(
238+
framework.relative_to(sim_framework_path.parent, walk_up=True)
239+
)
234240
print(" done")
235241
else:
236242
print(" Using pre-existing iOS framework.")
@@ -351,7 +357,7 @@ def main():
351357
clone_testbed(
352358
source=Path(__file__).parent,
353359
target=Path(context.location),
354-
framework=Path(context.framework) if context.framework else None,
360+
framework=Path(context.framework).resolve() if context.framework else None,
355361
apps=[Path(app) for app in context.apps],
356362
)
357363
elif context.subcommand == "run":

0 commit comments

Comments
 (0)