| 69 | |
| 70 | |
| 71 | def build_pex_scie( |
| 72 | platform_info: tuple[PlatformConfig, Path], |
| 73 | *, |
| 74 | lock: Path, |
| 75 | pex_requirement: str, |
| 76 | verbosity: int = 0, |
| 77 | env: Optional[Dict[str, str]] = None, |
| 78 | ) -> SpawnedJob[tuple[str, PlatformConfig]]: |
| 79 | platform_config, complete_platform = platform_info |
| 80 | command = [ |
| 81 | sys.executable, |
| 82 | "-m", |
| 83 | "pex", |
| 84 | *["-v" for _ in range(verbosity)], |
| 85 | "--disable-cache", |
| 86 | "--no-build", |
| 87 | "--no-compile", |
| 88 | "--no-use-system-time", |
| 89 | "--record-git-state", |
| 90 | "--venv", |
| 91 | "--no-strip-pex-env", |
| 92 | "--complete-platform", |
| 93 | str(complete_platform), |
| 94 | "--lock", |
| 95 | str(lock), |
| 96 | "--scie", |
| 97 | "eager", |
| 98 | "--scie-only", |
| 99 | "--scie-name-style", |
| 100 | "platform-file-suffix", |
| 101 | "--scie-platform", |
| 102 | platform_config.name, |
| 103 | "--scie-pbs-release", |
| 104 | platform_config.pbs_release, |
| 105 | "--scie-python-version", |
| 106 | platform_config.python_version, |
| 107 | "--scie-pbs-stripped", |
| 108 | "--scie-hash-alg", |
| 109 | "sha256", |
| 110 | "--scie-busybox", |
| 111 | "@pex", |
| 112 | "--scie-busybox-pex-entrypoint-env-passthrough", |
| 113 | "--pip-version", |
| 114 | PipVersion.LATEST_COMPATIBLE.value, |
| 115 | "-o", |
| 116 | os.path.join(safe_mkdtemp(), "pex"), |
| 117 | "-c", |
| 118 | "pex", |
| 119 | "--project", |
| 120 | pex_requirement, |
| 121 | ] |
| 122 | return SpawnedJob.stdout( |
| 123 | job=Job( |
| 124 | command=command, process=subprocess.Popen(args=command, env=env, stdout=subprocess.PIPE) |
| 125 | ), |
| 126 | result_func=lambda stdout: (stdout.decode("utf-8").strip(), platform_config), |
| 127 | ) |
| 128 | |