mirror of
https://github.com/openai/codex.git
synced 2026-05-16 01:02:48 +00:00
Keep Python runtime resources platform neutral
Use generic resource fixture names and comments so runtime package staging can support Linux bwrap as well as Windows helpers. Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -239,9 +239,9 @@ def stage_python_runtime_package(
|
||||
out_bin.stat().st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
|
||||
)
|
||||
for resource_binary in resource_binaries:
|
||||
# Windows sandbox support needs helper executables next to codex.exe.
|
||||
# The option is generic so release workflows own the platform-specific
|
||||
# list without baking Windows names into the staging script.
|
||||
# Some release targets need helper executables beside the main binary
|
||||
# (for example Linux bwrap or Windows sandbox helpers). Keep this
|
||||
# generic so release workflows own the platform-specific list.
|
||||
out_resource = staged_runtime_resource_path(staging_dir, resource_binary)
|
||||
shutil.copy2(resource_binary, out_resource)
|
||||
if not _is_windows():
|
||||
|
||||
@@ -354,17 +354,17 @@ def test_stage_runtime_release_can_pin_wheel_platform_tag(tmp_path: Path) -> Non
|
||||
def test_stage_runtime_release_copies_resource_binaries(tmp_path: Path) -> None:
|
||||
script = _load_update_script_module()
|
||||
fake_binary = tmp_path / script.runtime_binary_name()
|
||||
command_runner = tmp_path / "codex-command-runner.exe"
|
||||
setup = tmp_path / "codex-windows-sandbox-setup.exe"
|
||||
helper = tmp_path / "helper"
|
||||
fallback = tmp_path / "fallback-helper"
|
||||
fake_binary.write_text("fake codex\n")
|
||||
command_runner.write_text("fake command runner\n")
|
||||
setup.write_text("fake setup\n")
|
||||
helper.write_text("fake helper\n")
|
||||
fallback.write_text("fake fallback\n")
|
||||
|
||||
staged = script.stage_python_runtime_package(
|
||||
tmp_path / "runtime-stage",
|
||||
"1.2.3",
|
||||
fake_binary,
|
||||
resource_binaries=(command_runner, setup),
|
||||
resource_binaries=(helper, fallback),
|
||||
)
|
||||
|
||||
assert {
|
||||
@@ -374,8 +374,8 @@ def test_stage_runtime_release_copies_resource_binaries(tmp_path: Path) -> None:
|
||||
for path in (staged / "src" / "codex_cli_bin" / "bin").iterdir()
|
||||
} == {
|
||||
script.runtime_binary_name(): "fake codex\n",
|
||||
"codex-command-runner.exe": "fake command runner\n",
|
||||
"codex-windows-sandbox-setup.exe": "fake setup\n",
|
||||
"fallback-helper": "fake fallback\n",
|
||||
"helper": "fake helper\n",
|
||||
}
|
||||
|
||||
|
||||
@@ -506,11 +506,11 @@ def test_stage_sdk_rejects_mismatched_legacy_versions(tmp_path: Path) -> None:
|
||||
def test_stage_runtime_stages_binary_without_type_generation(tmp_path: Path) -> None:
|
||||
script = _load_update_script_module()
|
||||
fake_binary = tmp_path / script.runtime_binary_name()
|
||||
command_runner = tmp_path / "codex-command-runner.exe"
|
||||
setup = tmp_path / "codex-windows-sandbox-setup.exe"
|
||||
helper = tmp_path / "helper"
|
||||
fallback = tmp_path / "fallback-helper"
|
||||
fake_binary.write_text("fake codex\n")
|
||||
command_runner.write_text("fake command runner\n")
|
||||
setup.write_text("fake setup\n")
|
||||
helper.write_text("fake helper\n")
|
||||
fallback.write_text("fake fallback\n")
|
||||
calls: list[str] = []
|
||||
args = script.parse_args(
|
||||
[
|
||||
@@ -522,9 +522,9 @@ def test_stage_runtime_stages_binary_without_type_generation(tmp_path: Path) ->
|
||||
"--platform-tag",
|
||||
"musllinux_1_1_x86_64",
|
||||
"--resource-binary",
|
||||
str(command_runner),
|
||||
str(helper),
|
||||
"--resource-binary",
|
||||
str(setup),
|
||||
str(fallback),
|
||||
]
|
||||
)
|
||||
|
||||
@@ -560,8 +560,7 @@ def test_stage_runtime_stages_binary_without_type_generation(tmp_path: Path) ->
|
||||
script.run_command(args, ops)
|
||||
|
||||
assert calls == [
|
||||
"stage_runtime:0.116.0a1:musllinux_1_1_x86_64:"
|
||||
"codex-command-runner.exe,codex-windows-sandbox-setup.exe"
|
||||
"stage_runtime:0.116.0a1:musllinux_1_1_x86_64:helper,fallback-helper"
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user