MCPcopy
hub / github.com/pex-tool/pex / build_pex_dists

Function build_pex_dists

scripts/create-packages.py:258–284  ·  view source on GitHub ↗
(
    dist_dir: Path,
    dist_fmt: Format,
    *additional_dist_fmts: Format,
    verbose: bool = False,
    env: Optional[Dict[str, str]] = None
)

Source from the content-addressed store, hash-verified

256
257
258def build_pex_dists(
259 dist_dir: Path,
260 dist_fmt: Format,
261 *additional_dist_fmts: Format,
262 verbose: bool = False,
263 env: Optional[Dict[str, str]] = None
264) -> Iterator[PurePath]:
265 tmp_dir = dist_dir / ".tmp"
266 tmp_dir.mkdir(parents=True, exist_ok=True)
267 atexit.register(shutil.rmtree, tmp_dir, ignore_errors=True)
268 out_dir = tempfile.mkdtemp(dir=tmp_dir)
269
270 output = None if verbose else subprocess.DEVNULL
271
272 for fmt in [dist_fmt, *additional_dist_fmts]:
273 subprocess.run(
274 args=[sys.executable, "-m", "build", "--outdir", out_dir, *fmt.build_args],
275 env=fmt.add_build_env(env),
276 stdout=output,
277 stderr=output,
278 check=True,
279 )
280
281 for dist in os.listdir(out_dir):
282 built = dist_dir / dist
283 shutil.move(os.path.join(out_dir, dist), built)
284 yield built
285
286
287def main(

Callers 1

mainFunction · 0.85

Calls 4

add_build_envMethod · 0.80
registerMethod · 0.45
runMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected