MCPcopy Index your code
hub / github.com/python/cpython / clone_testbed

Function clone_testbed

Platforms/Apple/testbed/__main__.py:122–246  ·  view source on GitHub ↗
(
    source: Path,
    target: Path,
    framework: Path,
    platform: str,
    apps: list[Path],
)

Source from the content-addressed store, hash-verified

120
121
122def clone_testbed(
123 source: Path,
124 target: Path,
125 framework: Path,
126 platform: str,
127 apps: list[Path],
128) -> None:
129 if target.exists():
130 print(f"{target} already exists; aborting without creating project.")
131 sys.exit(10)
132
133 if framework is None:
134 if not (
135 source / "Python.xcframework" / TEST_SLICES[platform] / "bin"
136 ).is_dir():
137 print(
138 f"The testbed being cloned ({source}) does not contain "
139 "a framework with slices. Re-run with --framework"
140 )
141 sys.exit(11)
142 else:
143 if not framework.is_dir():
144 print(f"{framework} does not exist.")
145 sys.exit(12)
146 elif not (
147 framework.suffix == ".xcframework"
148 or (framework / "Python.framework").is_dir()
149 ):
150 print(
151 f"{framework} is not an XCframework, "
152 f"or a simulator slice of a framework build."
153 )
154 sys.exit(13)
155
156 print("Cloning testbed project:")
157 print(f" Cloning {source}...", end="")
158 # Only copy the files for the platform being cloned plus the files common
159 # to all platforms. The XCframework will be copied later, if needed.
160 target.mkdir(parents=True)
161
162 for name in [
163 "__main__.py",
164 "TestbedTests",
165 "Testbed.lldbinit",
166 f"{platform}Testbed",
167 f"{platform}Testbed.xcodeproj",
168 f"{platform}Testbed.xctestplan",
169 ]:
170 copy(source / name, target / name)
171
172 print(" done")
173
174 orig_xc_framework_path = source / "Python.xcframework"
175 xc_framework_path = target / "Python.xcframework"
176 test_framework_path = xc_framework_path / TEST_SLICES[platform]
177 if framework is not None:
178 if framework.suffix == ".xcframework":
179 print(" Installing XCFramework...", end="")

Callers 1

mainFunction · 0.85

Calls 12

is_absoluteMethod · 0.80
copyFunction · 0.70
existsMethod · 0.45
exitMethod · 0.45
is_dirMethod · 0.45
mkdirMethod · 0.45
symlink_toMethod · 0.45
relative_toMethod · 0.45
unlinkMethod · 0.45
is_symlinkMethod · 0.45
readlinkMethod · 0.45
resolveMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…