mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-15 17:25:26 -04:00
Expose Cookbook user-install CLIs in Docker (#887)
Ensure pip --user console scripts like vLLM are visible to Docker runtime and dependency probes by adding the user install bin directory to PATH.
This commit is contained in:
committed by
GitHub
parent
9a1893760d
commit
e58e4a185d
@@ -3,6 +3,7 @@
|
||||
import builtins
|
||||
import importlib.util
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
@@ -14,7 +15,9 @@ from routes.shell_routes import (
|
||||
_running_in_container,
|
||||
_docker_row_status,
|
||||
_package_installed_from_probe,
|
||||
_package_probe_script,
|
||||
_package_status_note,
|
||||
_prepend_user_install_bins_to_path,
|
||||
_reject_cross_site,
|
||||
_ssh_base_argv,
|
||||
_venv_activate_prefix,
|
||||
@@ -247,6 +250,26 @@ class TestPackageProbeStatus:
|
||||
assert _package_installed_from_probe("diffusers", missing_torch) is False
|
||||
assert _package_installed_from_probe("diffusers", ready) is True
|
||||
|
||||
def test_local_user_install_bin_is_added_to_path(self, monkeypatch, tmp_path):
|
||||
user_base = tmp_path / "user-base"
|
||||
monkeypatch.setattr("site.USER_BASE", str(user_base))
|
||||
monkeypatch.setenv("HOME", str(tmp_path / "home"))
|
||||
monkeypatch.setenv("PATH", "/usr/bin")
|
||||
|
||||
_prepend_user_install_bins_to_path()
|
||||
|
||||
parts = os.environ["PATH"].split(os.pathsep)
|
||||
assert str(user_base / "bin") in parts
|
||||
assert str(tmp_path / "home" / ".local" / "bin") in parts
|
||||
|
||||
def test_remote_package_probe_checks_user_install_bin(self):
|
||||
script = _package_probe_script(["vllm"])
|
||||
|
||||
assert "site.USER_BASE" in script
|
||||
assert "os.path.expanduser('~/.local/bin')" in script
|
||||
assert "add_user_install_bins_to_path()" in script
|
||||
assert "shutil.which(b)" in script
|
||||
|
||||
|
||||
class TestSshBaseArgv:
|
||||
def test_basic_host_no_port(self):
|
||||
|
||||
Reference in New Issue
Block a user