Skip to content

Use shutil.which for the build backend #10028

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions python/uv/_build_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,17 @@ def warn_config_settings(config_settings: "dict | None" = None):

def call(args: "list[str]", config_settings: "dict | None" = None) -> str:
"""Invoke a uv subprocess and return the filename from stdout."""
import shutil
import subprocess
import sys

from ._find_uv import find_uv_bin

warn_config_settings(config_settings)
# Unlike `find_uv_bin`, this mechanism must work according to PEP 517
uv_bin = shutil.which("uv")
if uv_bin is None:
raise RuntimeError("uv was not properly installed")
# Forward stderr, capture stdout for the filename
result = subprocess.run([find_uv_bin()] + args, stdout=subprocess.PIPE)
result = subprocess.run([uv_bin] + args, stdout=subprocess.PIPE)
if result.returncode != 0:
sys.exit(result.returncode)
# If there was extra stdout, forward it (there should not be extra stdout)
Expand Down
Loading