mirror of https://github.com/astral-sh/uv
Add Conda tests to `system-install.yml` (#2281)
Closes https://github.com/astral-sh/uv/issues/2280.
This commit is contained in:
parent
54311c8664
commit
b3ac0e30ec
|
|
@ -231,3 +231,44 @@ jobs:
|
||||||
|
|
||||||
- name: "Validate global Python install"
|
- name: "Validate global Python install"
|
||||||
run: python3.9 scripts/check_system_python.py --uv ./target/debug/uv
|
run: python3.9 scripts/check_system_python.py --uv ./target/debug/uv
|
||||||
|
|
||||||
|
install-conda:
|
||||||
|
name: Install on Conda (${{ matrix.python-version }}, ${{ matrix.os }})
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
|
||||||
|
python-version: ["3.8", "3.11"]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: conda-incubator/setup-miniconda@v3
|
||||||
|
with:
|
||||||
|
miniconda-version: "latest"
|
||||||
|
activate-environment: uv
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
- name: Conda info
|
||||||
|
shell: bash -el {0}
|
||||||
|
run: conda info
|
||||||
|
|
||||||
|
- name: Conda list
|
||||||
|
shell: pwsh
|
||||||
|
run: conda list
|
||||||
|
|
||||||
|
- name: "Install Rust toolchain"
|
||||||
|
run: rustup show
|
||||||
|
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
|
- name: "Build"
|
||||||
|
run: cargo build
|
||||||
|
|
||||||
|
- name: "Print Python path"
|
||||||
|
shell: bash -el {0}
|
||||||
|
run: echo $(which python)
|
||||||
|
|
||||||
|
- name: "Validate global Python install"
|
||||||
|
shell: bash -el {0}
|
||||||
|
run: python ./scripts/check_system_python.py --uv ./target/debug/uv
|
||||||
|
|
|
||||||
|
|
@ -179,18 +179,32 @@ pub fn create_bare_venv(
|
||||||
match fs_err::copy(shim, scripts.join(python_exe)) {
|
match fs_err::copy(shim, scripts.join(python_exe)) {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(err) if err.kind() == io::ErrorKind::NotFound => {
|
Err(err) if err.kind() == io::ErrorKind::NotFound => {
|
||||||
|
let launcher = match python_exe {
|
||||||
|
"python.exe" => "venvwlauncher.exe",
|
||||||
|
"pythonw.exe" => "venvwlauncher.exe",
|
||||||
|
_ => unreachable!(),
|
||||||
|
};
|
||||||
|
|
||||||
// If `python.exe` doesn't exist, try the `venvlaucher.exe` shim.
|
// If `python.exe` doesn't exist, try the `venvlaucher.exe` shim.
|
||||||
let shim = interpreter
|
let shim = interpreter
|
||||||
.stdlib()
|
.stdlib()
|
||||||
.join("venv")
|
.join("venv")
|
||||||
.join("scripts")
|
.join("scripts")
|
||||||
.join("nt")
|
.join("nt")
|
||||||
.join(match python_exe {
|
.join(launcher);
|
||||||
"python.exe" => "venvwlauncher.exe",
|
|
||||||
"pythonw.exe" => "venvwlauncher.exe",
|
// If the `venvwlauncher.exe` shim doesn't exist, then on Conda at least, we
|
||||||
_ => unreachable!(),
|
// can look for it next to the Python executable itself.
|
||||||
});
|
match fs_err::copy(shim, scripts.join(python_exe)) {
|
||||||
fs_err::copy(shim, scripts.join(python_exe))?;
|
Ok(_) => {}
|
||||||
|
Err(err) if err.kind() == io::ErrorKind::NotFound => {
|
||||||
|
let shim = base_python.with_file_name(launcher);
|
||||||
|
fs_err::copy(shim, scripts.join(python_exe))?;
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
return Err(err.into());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
return Err(err.into());
|
return Err(err.into());
|
||||||
|
|
|
||||||
|
|
@ -92,10 +92,18 @@ if __name__ == "__main__":
|
||||||
)
|
)
|
||||||
|
|
||||||
logging.info("Installing into virtual environment...")
|
logging.info("Installing into virtual environment...")
|
||||||
|
|
||||||
|
# Disable the `CONDA_PREFIX` and `VIRTUAL_ENV` environment variables, so that
|
||||||
|
# we only rely on virtual environment discovery via the `.venv` directory.
|
||||||
|
# Our "system Python" here might itself be a Conda environment!
|
||||||
|
env = os.environ.copy()
|
||||||
|
env["CONDA_PREFIX"] = ""
|
||||||
|
env["VIRTUAL_ENV"] = ""
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
[uv, "pip", "install", "pylint"],
|
[uv, "pip", "install", "pylint", "--verbose"],
|
||||||
cwd=temp_dir,
|
cwd=temp_dir,
|
||||||
check=True,
|
check=True,
|
||||||
|
env=env,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Ensure that the package (`pylint`) isn't installed globally.
|
# Ensure that the package (`pylint`) isn't installed globally.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue