mirror of
https://github.com/openai/codex.git
synced 2026-12-04 00:51:02 +00:00
Expose package assembly helpers and support gzip DotSlash artifacts (#51575)
## What changed - Extract `create_parser()`, `assemble_package()`, and `archive_package()` from the packaging CLI so callers can assemble a package directory, add files, and archive it separately. - Support DotSlash artifacts with `format: "gz"` by decompressing the executable directly to its destination. ## Testing Extend the zsh manifest override test to verify executable contents for both `tar.gz` and `gz` artifacts. GitOrigin-RevId: 3542b795eea1f2320bef1402d575a9396be43df2
This commit is contained in:
@@ -45,6 +45,10 @@ def parse_package_version(value: str) -> str:
|
||||
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
return create_parser().parse_args()
|
||||
|
||||
|
||||
def create_parser() -> argparse.ArgumentParser:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Build a canonical Codex package directory and optional archive.",
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||
@@ -169,11 +173,18 @@ def parse_args() -> argparse.Namespace:
|
||||
"scripts/codex_package/rg."
|
||||
),
|
||||
)
|
||||
return parser.parse_args()
|
||||
return parser
|
||||
|
||||
|
||||
def main() -> int:
|
||||
args = parse_args()
|
||||
package_dir = assemble_package(args)
|
||||
archive_package(package_dir, args)
|
||||
return 0
|
||||
|
||||
|
||||
def assemble_package(args: argparse.Namespace) -> Path:
|
||||
"""Build the directory before optional downstream additions and archiving."""
|
||||
spec = TARGET_SPECS[getattr(args, "target", None) or default_target()]
|
||||
variant = PACKAGE_VARIANTS[args.variant]
|
||||
package_dir_arg = getattr(args, "package_dir", None)
|
||||
@@ -228,14 +239,16 @@ def main() -> int:
|
||||
validate_package_dir(
|
||||
package_dir, variant, spec, include_zsh=inputs.zsh_bin is not None
|
||||
)
|
||||
return package_dir
|
||||
|
||||
|
||||
def archive_package(package_dir: Path, args: argparse.Namespace) -> None:
|
||||
for archive_output in args.archive_output:
|
||||
archive_path = archive_output.resolve()
|
||||
write_archive(package_dir, archive_path, force=args.force)
|
||||
print(f"Built Codex package archive at {archive_path}")
|
||||
|
||||
print(f"Built Codex package directory at {package_dir}")
|
||||
return 0
|
||||
|
||||
|
||||
def resolve_optional_input_path(
|
||||
|
||||
Reference in New Issue
Block a user