python-runtime: prepare openai-codex-cli-bin package

This commit is contained in:
Shaqayeq
2026-04-12 23:17:17 -07:00
parent d626dc3895
commit f412b39118
8 changed files with 436 additions and 80 deletions

View File

@@ -3,12 +3,25 @@ from __future__ import annotations
import os
from pathlib import Path
PACKAGE_NAME = "codex-cli-bin"
PACKAGE_NAME = "openai-codex-cli-bin"
def bundled_bin_dir() -> Path:
return Path(__file__).resolve().parent / "bin"
def bundled_runtime_files() -> tuple[Path, ...]:
names = (
("codex.exe", "codex-command-runner.exe", "codex-windows-sandbox-setup.exe")
if os.name == "nt"
else ("codex",)
)
return tuple(bundled_bin_dir() / name for name in names)
def bundled_codex_path() -> Path:
exe = "codex.exe" if os.name == "nt" else "codex"
path = Path(__file__).resolve().parent / "bin" / exe
path = bundled_bin_dir() / exe
if not path.is_file():
raise FileNotFoundError(
f"{PACKAGE_NAME} is installed but missing its packaged codex binary at {path}"
@@ -16,4 +29,9 @@ def bundled_codex_path() -> Path:
return path
__all__ = ["PACKAGE_NAME", "bundled_codex_path"]
__all__ = [
"PACKAGE_NAME",
"bundled_bin_dir",
"bundled_codex_path",
"bundled_runtime_files",
]