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

Function build_pex_scies

scripts/create-packages.py:130–190  ·  view source on GitHub ↗
(
    dist_dir: Path,
    scie_choice: ScieChoice,
    verbosity: int = 0,
    env: Optional[Dict[str, str]] = None,
)

Source from the content-addressed store, hash-verified

128
129
130def build_pex_scies(
131 dist_dir: Path,
132 scie_choice: ScieChoice,
133 verbosity: int = 0,
134 env: Optional[Dict[str, str]] = None,
135) -> Iterator[tuple[Path, PlatformConfig]]:
136 scie_config = ScieConfig.load()
137
138 pex_requirement = f".[{','.join(scie_config.pex_extras)}]"
139
140 lock = PACKAGE_DIR / "pex-scie.lock"
141 if not lock.exists():
142 raise SystemExit(
143 f"The Pex scie lock at {lock} does not exist.\n"
144 f"Run `uv run dev-cmd gen-scie-platform -- --all ...` to generate it."
145 )
146
147 missing_platforms: list[str] = []
148 platforms: list[tuple[PlatformConfig, Path]] = []
149 for platform_config in scie_config.platforms:
150 if (
151 scie_choice is ScieChoice.CURRENT
152 and platform_config.platform is not SysPlatform.CURRENT
153 ):
154 continue
155
156 complete_platform = PACKAGE_DIR / "complete-platforms" / f"{platform_config.name}.json"
157 if complete_platform.exists():
158 platforms.append((platform_config, complete_platform))
159 elif platform_config.required:
160 missing_platforms.append(platform_config.name)
161
162 if missing_platforms:
163 missing = "\n".join(
164 f"{index}. {missing_platform}"
165 for index, missing_platform in enumerate(missing_platforms, start=1)
166 )
167 raise SystemExit(
168 f"Of the {len(scie_config.platforms)} expected Pex scie complete platforms, "
169 f"{len(missing_platforms)} {'is' if len(missing_platforms) == 1 else 'are'} missing:\n"
170 f"{missing}"
171 )
172
173 for output_file, platform_config in execute_parallel(
174 platforms,
175 spawn_func=functools.partial(
176 build_pex_scie, verbosity=verbosity, lock=lock, pex_requirement=pex_requirement, env=env
177 ),
178 ):
179 artifacts = glob.glob(f"{output_file}*")
180 scie_artifacts = [artifact for artifact in artifacts if not artifact.endswith(".sha256")]
181 if len(scie_artifacts) != 1:
182 artifact_lines = "\n".join(sorted(artifacts))
183 raise SystemExit(
184 f"Found unexpected artifacts after generating Pex scie:\n{artifact_lines}"
185 )
186 scie_name = os.path.basename(scie_artifacts[0])
187 for artifact in artifacts:

Callers 1

mainFunction · 0.85

Calls 4

execute_parallelFunction · 0.90
appendMethod · 0.80
loadMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected