mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Multiple entries in PUFFIN_PYTHON_PATH for windows tests (#1254)
There are no binary installers for the latests patch versions of cpython for windows, and building them is hard. As an alternative, we download python-build-standanlone cpythons and put them into `<project root>/bin`. On unix, we can symlink `pythonx.y.z` into this directory and point `PUFFIN_PYTHON_PATH` to it. On windows, all pythons are called `python.exe` and they don't like being linked. Instead, we add the path to each directory containing a `python.exe` to `PUFFIN_PYTHON_PATH`, similar to the regular `PATH`. The python discovery on windows was extended to respect `PUFFIN_PYTHON_PATH` where needed. These changes mean that we don't need to (sym)link pythons anymore and could drop that part to the script. 435 tests run: 389 passed (21 slow), 46 failed, 1 skipped
This commit is contained in:
parent
91118a962a
commit
ac49dec4a2
4 changed files with 108 additions and 5 deletions
|
@ -5,6 +5,7 @@
|
|||
//!
|
||||
#![cfg(all(feature = "python", feature = "pypi"))]
|
||||
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
|
@ -17,7 +18,7 @@ use fs_err::os::unix::fs::symlink as symlink_file;
|
|||
use fs_err::os::windows::fs::symlink_file;
|
||||
use predicates::prelude::predicate;
|
||||
|
||||
use common::{get_bin, puffin_snapshot, TestContext, INSTA_FILTERS};
|
||||
use common::{bootstrapped_pythons, get_bin, puffin_snapshot, TestContext, INSTA_FILTERS};
|
||||
use puffin_interpreter::find_requested_python;
|
||||
|
||||
mod common;
|
||||
|
@ -27,6 +28,18 @@ pub(crate) fn create_bin_with_executables(
|
|||
temp_dir: &assert_fs::TempDir,
|
||||
python_versions: &[&str],
|
||||
) -> Result<PathBuf> {
|
||||
if let Some(bootstrapped_pythons) = bootstrapped_pythons() {
|
||||
let selected_pythons = bootstrapped_pythons.into_iter().filter(|path| {
|
||||
python_versions.iter().any(|python_version| {
|
||||
// Good enough since we control the directory
|
||||
path.to_str()
|
||||
.unwrap()
|
||||
.contains(&format!("@{python_version}"))
|
||||
})
|
||||
});
|
||||
return Ok(env::join_paths(selected_pythons)?.into());
|
||||
}
|
||||
|
||||
let bin = temp_dir.child("bin");
|
||||
fs_err::create_dir(&bin)?;
|
||||
for request in python_versions {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue