mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-19 11:35:36 +00:00
Consolidate logic for checking for a virtual environment (#14214)
We were checking whether a path was an executable in a virtual environment or the base directory of a virtual environment in multiple places in the codebase. This PR consolidates this logic into one place. Closes #13947.
This commit is contained in:
parent
a9a9e71481
commit
6481aa3e64
5 changed files with 30 additions and 16 deletions
|
|
@ -85,7 +85,7 @@ pub(crate) fn create(
|
|||
} else if metadata.is_dir() {
|
||||
if allow_existing {
|
||||
debug!("Allowing existing directory");
|
||||
} else if location.join("pyvenv.cfg").is_file() {
|
||||
} else if uv_fs::is_virtualenv_base(location) {
|
||||
debug!("Removing existing directory");
|
||||
|
||||
// On Windows, if the current executable is in the directory, guard against
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue