mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 10:58:28 +00:00
Simpler and more resilient pip compile tests (#426)
The pip compile test now explicitly set their python version and `puffin venv` resolves e.g. `python3.12` correctly now. The venv creation is moved to a shared method
This commit is contained in:
parent
a20325f184
commit
1147a4de14
3 changed files with 159 additions and 542 deletions
|
@ -1,5 +1,5 @@
|
|||
use std::fmt::Write;
|
||||
use std::path::Path;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use anyhow::Result;
|
||||
use colored::Colorize;
|
||||
|
@ -37,6 +37,10 @@ enum VenvError {
|
|||
#[diagnostic(code(puffin::venv::python_not_found))]
|
||||
PythonNotFound,
|
||||
|
||||
#[error("Unable to find a Python interpreter {0}")]
|
||||
#[diagnostic(code(puffin::venv::python_not_found))]
|
||||
UserPythonNotFound(PathBuf),
|
||||
|
||||
#[error("Failed to extract Python interpreter info")]
|
||||
#[diagnostic(code(puffin::venv::interpreter))]
|
||||
InterpreterError(#[source] anyhow::Error),
|
||||
|
@ -54,7 +58,11 @@ fn venv_impl(
|
|||
) -> miette::Result<ExitStatus> {
|
||||
// Locate the Python interpreter.
|
||||
let base_python = if let Some(base_python) = base_python {
|
||||
fs::canonicalize(base_python).into_diagnostic()?
|
||||
fs::canonicalize(
|
||||
which::which_global(base_python)
|
||||
.map_err(|_| VenvError::UserPythonNotFound(base_python.to_path_buf()))?,
|
||||
)
|
||||
.into_diagnostic()?
|
||||
} else {
|
||||
fs::canonicalize(
|
||||
which::which_global("python3")
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue