mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-24 13:20:53 +00:00
Add check for using minor version link when creating a venv on Windows (#14252)
There was a regression introduced in #13954 on Windows where creating a venv behaved as if there was a minor version link even if none existed. This PR adds a check to fix this. Closes #14249.
This commit is contained in:
parent
5b2c3595a7
commit
177df19f30
2 changed files with 41 additions and 6 deletions
|
|
@ -147,6 +147,7 @@ pub(crate) fn create(
|
|||
// Create a `.gitignore` file to ignore all files in the venv.
|
||||
fs::write(location.join(".gitignore"), "*")?;
|
||||
|
||||
let mut using_minor_version_link = false;
|
||||
let executable_target = if upgradeable && interpreter.is_standalone() {
|
||||
if let Some(minor_version_link) = PythonMinorVersionLink::from_executable(
|
||||
base_python.as_path(),
|
||||
|
|
@ -167,6 +168,7 @@ pub(crate) fn create(
|
|||
&minor_version_link.symlink_directory.display(),
|
||||
&base_python.display()
|
||||
);
|
||||
using_minor_version_link = true;
|
||||
minor_version_link.symlink_executable.clone()
|
||||
}
|
||||
} else {
|
||||
|
|
@ -228,7 +230,7 @@ pub(crate) fn create(
|
|||
// interpreters, this target path includes a minor version junction to enable
|
||||
// transparent upgrades.
|
||||
if cfg!(windows) {
|
||||
if interpreter.is_standalone() {
|
||||
if using_minor_version_link {
|
||||
let target = scripts.join(WindowsExecutable::Python.exe(interpreter));
|
||||
create_link_to_executable(target.as_path(), executable_target.clone())
|
||||
.map_err(Error::Python)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue