fix(windows): verify launchers after primary install

This commit is contained in:
Gille 2026-06-28 17:02:05 -05:00 committed by Brooklyn Nicholson
parent 76bb8f46a0
commit df8e2523fa
2 changed files with 35 additions and 4 deletions

View file

@ -7182,10 +7182,12 @@ def _hermes_exe_shims(scripts_dir: Path) -> list[Path]:
"""
if not _is_windows():
return []
return [
scripts_dir / "hermes.exe",
scripts_dir / "hermes-gateway.exe",
]
names = set(_load_console_script_names()) or {"hermes", "hermes-agent", "hermes-acp"}
# The gateway shim is not a [project.scripts] entry point, but older
# update/install paths still rewrite and quarantine it.
names.add("hermes-gateway")
return [scripts_dir / f"{name}.exe" for name in sorted(names)]
def _detect_concurrent_hermes_instances(
@ -7629,6 +7631,7 @@ def _install_python_dependencies_with_optional_fallback(
try:
_install(["install", "-e", f".[{group}]"])
_verify_console_scripts_installed(install_cmd_prefix, env=env)
return
except subprocess.CalledProcessError:
print(

View file

@ -86,3 +86,31 @@ class TestVerifyConsoleScriptsInstalled:
names = _load_console_script_names()
assert names == ["hermes", "hermes-agent", "hermes-acp"]
def test_primary_install_success_still_verifies_scripts(self):
import hermes_cli.main as main_mod
with patch("hermes_cli.main._is_windows", return_value=False), \
patch("hermes_cli.main._run_quarantined_install") as mock_install, \
patch("hermes_cli.main._verify_console_scripts_installed") as mock_verify:
main_mod._install_python_dependencies_with_optional_fallback(
["uv", "pip"], env={"VIRTUAL_ENV": "x"}
)
mock_install.assert_called_once_with(
["uv", "pip", "install", "-e", ".[all]"],
env={"VIRTUAL_ENV": "x"},
scripts_dir=None,
)
mock_verify.assert_called_once_with(["uv", "pip"], env={"VIRTUAL_ENV": "x"})
def test_quarantine_shims_include_declared_console_scripts(
self, temp_pyproject, fake_scripts_dir
):
import hermes_cli.main as main_mod
with patch("hermes_cli.main._is_windows", return_value=True):
names = {path.name for path in main_mod._hermes_exe_shims(fake_scripts_dir)}
assert {"hermes.exe", "hermes-agent.exe", "hermes-acp.exe"} <= names
assert "hermes-gateway.exe" in names