mirror of
https://github.com/openai/codex.git
synced 2026-11-10 21:00:47 +00:00
package: include zsh fork in Codex package
Summary: - add a checked-in codex-zsh DotSlash manifest for supported Unix targets - fetch the matching zsh fork artifact during package builds and install it at codex-resources/zsh/bin/zsh when available - expose the bundled zsh fork through install-context and have Config use it as the runtime zsh path for packaged installs - remove the user/profile zsh_path config override now that the fork is package-managed - update app-server zsh-fork integration tests to spawn from a temporary package layout instead of configuring zsh_path directly - use copyfile for package executable staging so local package smoke tests do not preserve platform-specific source metadata Test Plan: - just fmt - just write-config-schema - just bazel-lock-update - just bazel-lock-check - just fix -p codex-config -p codex-core -p codex-exec - just fix -p codex-app-server - just fix -p codex-core -p codex-app-server -p codex-cli -p codex-exec -p codex-mcp-server -p codex-tui - python3 -m py_compile scripts/codex_package/cli.py scripts/codex_package/layout.py scripts/codex_package/zsh.py - python3 -m unittest discover scripts/codex_package - cargo test -p codex-core default_zsh_path_sets_runtime_zsh_path - cargo test -p codex-core session_new_fails_when_zsh_fork_enabled_without_packaged_zsh - cargo test -p codex-core restricted_read_implicitly_allows_helper_executables - cargo test -p codex-config - cargo test -p codex-app-server turn_start_shell_zsh_fork_executes_command_v2 - cargo test -p codex-app-server turn_start_shell_zsh_fork - cargo check -p codex-cli -p codex-exec -p codex-mcp-server
This commit is contained in:
@@ -8,6 +8,7 @@ from pathlib import Path
|
||||
from .targets import PackageInputs
|
||||
from .targets import PackageVariant
|
||||
from .targets import TargetSpec
|
||||
from .zsh import ZSH_RESOURCE_PATH
|
||||
|
||||
|
||||
LAYOUT_VERSION = 1
|
||||
@@ -50,6 +51,13 @@ def build_package_dir(
|
||||
)
|
||||
copy_executable(inputs.rg_bin, path_dir / spec.rg_name, is_windows=spec.is_windows)
|
||||
|
||||
if inputs.zsh_bin is not None:
|
||||
copy_executable(
|
||||
inputs.zsh_bin,
|
||||
resources_dir / ZSH_RESOURCE_PATH,
|
||||
is_windows=False,
|
||||
)
|
||||
|
||||
if inputs.bwrap_bin is not None:
|
||||
copy_executable(inputs.bwrap_bin, resources_dir / "bwrap", is_windows=False)
|
||||
|
||||
@@ -83,6 +91,8 @@ def validate_package_dir(
|
||||
package_dir: Path,
|
||||
variant: PackageVariant,
|
||||
spec: TargetSpec,
|
||||
*,
|
||||
include_zsh: bool,
|
||||
) -> None:
|
||||
required_dirs = [
|
||||
Path("bin"),
|
||||
@@ -122,6 +132,11 @@ def validate_package_dir(
|
||||
]
|
||||
executable_files = list(required_files)
|
||||
|
||||
if include_zsh:
|
||||
zsh_path = Path("codex-resources") / ZSH_RESOURCE_PATH
|
||||
required_files.append(zsh_path)
|
||||
executable_files.append(zsh_path)
|
||||
|
||||
if spec.is_linux:
|
||||
required_files.append(Path("codex-resources") / "bwrap")
|
||||
executable_files.append(Path("codex-resources") / "bwrap")
|
||||
@@ -148,7 +163,7 @@ def validate_package_dir(
|
||||
|
||||
def copy_executable(src: Path, dest: Path, *, is_windows: bool) -> None:
|
||||
dest.parent.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copy2(src, dest)
|
||||
shutil.copyfile(src, dest)
|
||||
if not is_windows:
|
||||
mode = dest.stat().st_mode
|
||||
dest.chmod(mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
|
||||
|
||||
Reference in New Issue
Block a user