Files
codex/scripts/codex_package/ripgrep.py
Adam Perry @ OpenAI 8e2265196e Add a just recipe for assembling Codex packages (#39584)
## What changed

- Add `just assemble-codex-package` as the documented entry point for the package builder.
- Export `CODEX_REPO_ROOT` from `just` and release CI, and require the package builder to use it for repository-relative inputs.
- Resolve the ripgrep and zsh manifests relative to their Python modules.

GitOrigin-RevId: 039d12107a49171f064b0119adc6b99cf97c6c1e
2026-08-20 04:55:47 +00:00

33 lines
862 B
Python

"""Fetch ripgrep from the DotSlash manifest used by the package builder."""
from pathlib import Path
from .dotslash import fetch_dotslash_executable
from .targets import TargetSpec, resolve_input_path
RG_MANIFEST = Path(__file__).with_name("rg")
def resolve_rg_bin(spec: TargetSpec, rg_bin: Path | None) -> Path:
if rg_bin is not None:
return resolve_input_path(rg_bin, "ripgrep executable", "--rg-bin")
return fetch_rg(spec)
def fetch_rg(
spec: TargetSpec,
*,
manifest_path: Path = RG_MANIFEST,
) -> Path:
rg_bin = fetch_dotslash_executable(
spec,
manifest_path=manifest_path,
artifact_label="ripgrep",
cache_key=f"{spec.target}-rg",
dest_name=spec.rg_name,
)
if rg_bin is None:
raise AssertionError("ripgrep is required for all package targets")
return rg_bin