diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index f3b95e6..5b7e004 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -55,9 +55,11 @@ jobs: } - name: Set up Python + shell: bash run: uv python install ${{ env.PYTHON_VERSION }} - name: Build sidecar + shell: bash working-directory: python run: uv run --python ${{ env.PYTHON_VERSION }} python build_sidecar.py --cpu-only diff --git a/python/build_sidecar.py b/python/build_sidecar.py index d38699a..6445de5 100644 --- a/python/build_sidecar.py +++ b/python/build_sidecar.py @@ -96,30 +96,31 @@ def create_venv_and_install(cpu_only: bool) -> Path: else: python = str(venv_dir / "bin" / "python") - def pkg_install(*args: str) -> None: + def pip_install(*args: str) -> None: + """Install packages. Pass package names and flags only, not 'install'.""" if use_uv: subprocess.run(["uv", "pip", "install", "--python", python, *args], check=True) else: - subprocess.run([python, "-m", "pip", *args], check=True) + subprocess.run([python, "-m", "pip", "install", *args], check=True) if not use_uv: # Upgrade pip (uv doesn't need this) - pkg_install("install", "--upgrade", "pip", "setuptools", "wheel") + pip_install("--upgrade", "pip", "setuptools", "wheel") # Install torch (CPU-only to avoid bundling ~2GB of CUDA libs) if cpu_only: print("[build] Installing PyTorch (CPU-only)") - pkg_install( - "install", "torch", "torchaudio", + pip_install( + "torch", "torchaudio", "--index-url", "https://download.pytorch.org/whl/cpu", ) else: print("[build] Installing PyTorch (default, may include CUDA)") - pkg_install("install", "torch", "torchaudio") + pip_install("torch", "torchaudio") # Install project and dev deps (includes pyinstaller) print("[build] Installing project dependencies") - pkg_install("install", "-e", f"{SCRIPT_DIR}[dev]") + pip_install("-e", f"{SCRIPT_DIR}[dev]") return Path(python)