mirror of
https://github.com/openai/codex.git
synced 2026-10-23 18:08:45 +00:00
fix: stage selected standalone archives once
This commit is contained in:
@@ -143,18 +143,20 @@ def stage_standalone_installer_archives(
|
||||
release_version: str,
|
||||
vendor_src: Path,
|
||||
output_dir: Path,
|
||||
packages: list[str],
|
||||
) -> None:
|
||||
run_command(
|
||||
[
|
||||
str(STAGE_STANDALONE_INSTALLER_ARCHIVES),
|
||||
"--release-version",
|
||||
release_version,
|
||||
"--vendor-src",
|
||||
str(vendor_src),
|
||||
"--output-dir",
|
||||
str(output_dir),
|
||||
]
|
||||
)
|
||||
cmd = [
|
||||
str(STAGE_STANDALONE_INSTALLER_ARCHIVES),
|
||||
"--release-version",
|
||||
release_version,
|
||||
"--vendor-src",
|
||||
str(vendor_src),
|
||||
"--output-dir",
|
||||
str(output_dir),
|
||||
]
|
||||
for package in packages:
|
||||
cmd.extend(["--package", package])
|
||||
run_command(cmd)
|
||||
|
||||
|
||||
def tarball_name_for_package(package: str, version: str) -> str:
|
||||
@@ -226,6 +228,14 @@ def main() -> int:
|
||||
"--standalone-output-dir requires staged native binaries, but no selected "
|
||||
"package installed native components."
|
||||
)
|
||||
standalone_packages = [
|
||||
package for package in packages if package in CODEX_PLATFORM_PACKAGES
|
||||
]
|
||||
if not standalone_packages:
|
||||
raise RuntimeError(
|
||||
"--standalone-output-dir requires at least one selected Codex platform "
|
||||
"package."
|
||||
)
|
||||
|
||||
standalone_output_dir = args.standalone_output_dir
|
||||
standalone_output_dir.mkdir(parents=True, exist_ok=True)
|
||||
@@ -233,6 +243,7 @@ def main() -> int:
|
||||
args.release_version,
|
||||
vendor_src,
|
||||
standalone_output_dir,
|
||||
standalone_packages,
|
||||
)
|
||||
final_messages.append(
|
||||
f"Staged standalone installer archives in {standalone_output_dir}"
|
||||
|
||||
@@ -41,6 +41,16 @@ def parse_args() -> argparse.Namespace:
|
||||
default=REPO_ROOT / "dist" / "installer",
|
||||
help="Directory where standalone archives should be written.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--package",
|
||||
dest="packages",
|
||||
action="append",
|
||||
choices=sorted(CODEX_PLATFORM_PACKAGES),
|
||||
help=(
|
||||
"Codex platform package to stage. May be provided multiple times. "
|
||||
"Defaults to all platform packages."
|
||||
),
|
||||
)
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
@@ -85,7 +95,7 @@ def write_archive(staging_dir: Path, output_path: Path) -> None:
|
||||
output_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
with tarfile.open(output_path, "w:gz") as archive:
|
||||
for path in sorted(staging_dir.rglob("*")):
|
||||
archive.add(path, arcname=path.relative_to(staging_dir))
|
||||
archive.add(path, arcname=path.relative_to(staging_dir), recursive=False)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
@@ -94,7 +104,8 @@ def main() -> int:
|
||||
output_dir = args.output_dir.resolve()
|
||||
output_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
for package in sorted(CODEX_PLATFORM_PACKAGES):
|
||||
packages = args.packages or sorted(CODEX_PLATFORM_PACKAGES)
|
||||
for package in sorted(set(packages)):
|
||||
package_config = CODEX_PLATFORM_PACKAGES[package]
|
||||
platform_tag = package_config["npm_tag"]
|
||||
target = package_config["target_triple"]
|
||||
|
||||
Reference in New Issue
Block a user