Skip to content

Commit 21a5845

Browse files
committed
Use symlinks to install iOS framework into testbed clone.
1 parent c84928e commit 21a5845

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

iOS/testbed/__main__.py

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -202,33 +202,44 @@ def clone_testbed(
202202
)
203203
sys.exit(13)
204204

205-
print("Cloning testbed project...")
206-
shutil.copytree(source, target)
205+
print("Cloning testbed project:")
206+
print(f" Cloning {source}...", end="", flush=True)
207+
shutil.copytree(source, target, symlinks=True)
208+
print(" done")
207209

208210
if framework is not None:
209211
if framework.suffix == ".xcframework":
210-
print("Installing XCFramework...")
212+
print(" Installing XCFramework...", end="", flush=True)
211213
xc_framework_path = target / "Python.xcframework"
212-
shutil.rmtree(xc_framework_path)
213-
shutil.copytree(framework, xc_framework_path)
214+
if xc_framework_path.is_dir():
215+
shutil.rmtree(xc_framework_path)
216+
else:
217+
xc_framework_path.unlink()
218+
xc_framework_path.symlink_to(framework)
219+
print(" done")
214220
else:
215-
print("Installing simulator Framework...")
221+
print(" Installing simulator framework...", end="", flush=True)
216222
sim_framework_path = (
217223
target / "Python.xcframework" / "ios-arm64_x86_64-simulator"
218224
)
219-
shutil.rmtree(sim_framework_path)
220-
shutil.copytree(framework, sim_framework_path)
225+
if sim_framework_path.is_dir():
226+
shutil.rmtree(sim_framework_path)
227+
else:
228+
sim_framework_path.unlink()
229+
sim_framework_path.symlink_to(framework)
230+
print(" done")
221231
else:
222-
print("Using pre-existing iOS framework.")
232+
print(" Using pre-existing iOS framework.")
223233

224234
for app_src in apps:
225-
print(f"Installing app {app_src.name!r}...")
235+
print(f" Installing app {app_src.name!r}...", end="", flush=True)
226236
app_target = target / f"iOSTestbed/app/{app_src.name}"
227237
if app_target.is_dir():
228238
shutil.rmtree(app_target)
229239
shutil.copytree(app_src, app_target)
240+
print(" done")
230241

231-
print(f"Testbed project created in {target}")
242+
print(f"Successfully cloned testbed: {target.resolve()}")
232243

233244

234245
def update_plist(testbed_path, args):

0 commit comments

Comments
 (0)