mirror of
https://github.com/openai/codex.git
synced 2026-10-20 17:38:45 +00:00
fix code mode host packaging compatibility
This commit is contained in:
@@ -280,9 +280,12 @@ def _validate_codex_package_layout(package_dir: Path, package_archive: Path) ->
|
||||
package_binary = package_dir / "bin" / runtime_binary_name()
|
||||
if not package_binary.is_file():
|
||||
missing_entries.append(str(Path("bin") / runtime_binary_name()))
|
||||
code_mode_host = package_dir / "codex-resources" / runtime_code_mode_host_name()
|
||||
if not code_mode_host.is_file():
|
||||
missing_entries.append(str(Path("codex-resources") / runtime_code_mode_host_name()))
|
||||
code_mode_host_paths = (
|
||||
Path("codex-resources") / runtime_code_mode_host_name(),
|
||||
Path("bin") / runtime_code_mode_host_name(),
|
||||
)
|
||||
if not any((package_dir / path).is_file() for path in code_mode_host_paths):
|
||||
missing_entries.append(" or ".join(map(str, code_mode_host_paths)))
|
||||
if missing_entries:
|
||||
missing = ", ".join(missing_entries)
|
||||
raise RuntimeError(f"Missing Codex package layout entries in {package_archive}: {missing}")
|
||||
|
||||
@@ -51,13 +51,15 @@ def _load_runtime_setup_module():
|
||||
return module
|
||||
|
||||
|
||||
def _write_fake_codex_package(package_dir: Path, script) -> Path:
|
||||
def _write_fake_codex_package(
|
||||
package_dir: Path, script, *, host_dir: str = "codex-resources"
|
||||
) -> Path:
|
||||
(package_dir / "bin").mkdir(parents=True)
|
||||
(package_dir / "codex-resources").mkdir()
|
||||
(package_dir / "codex-path").mkdir()
|
||||
(package_dir / "codex-package.json").write_text('{"variant":"codex"}\n')
|
||||
(package_dir / "bin" / script.runtime_binary_name()).write_text("fake codex\n")
|
||||
(package_dir / "codex-resources" / script.runtime_code_mode_host_name()).write_text(
|
||||
(package_dir / host_dir / script.runtime_code_mode_host_name()).write_text(
|
||||
"fake code mode host\n"
|
||||
)
|
||||
(package_dir / "codex-resources" / "bwrap").write_text("fake bwrap\n")
|
||||
@@ -701,6 +703,26 @@ def test_stage_runtime_release_copies_package_layout_and_sets_version(
|
||||
assert 'version = "1.2.3"' in (staged / "pyproject.toml").read_text()
|
||||
|
||||
|
||||
def test_stage_runtime_release_accepts_legacy_code_mode_host_location(
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
script = _load_update_script_module()
|
||||
package_dir = _write_fake_codex_package(tmp_path / "codex-package", script, host_dir="bin")
|
||||
package_archive = tmp_path / "codex-package.tar.gz"
|
||||
_write_package_archive(package_dir, package_archive)
|
||||
|
||||
staged = script.stage_python_runtime_package(
|
||||
tmp_path / "runtime-stage",
|
||||
"1.2.3",
|
||||
package_archive,
|
||||
)
|
||||
|
||||
package_root = script.staged_runtime_package_root(staged)
|
||||
assert (
|
||||
package_root / "bin" / script.runtime_code_mode_host_name()
|
||||
).read_text() == "fake code mode host\n"
|
||||
|
||||
|
||||
def test_normalize_codex_version_accepts_release_tags_and_pep440_versions() -> None:
|
||||
script = _load_update_script_module()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user