mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-29 03:02:55 +00:00
Centralize virtualenv path construction (#2102)
## Summary Right now, we have virtualenv construction encoded in a few different places. Namely, it happens in both `gourgeist` and `virtualenv_layout.rs` -- _and_ `interpreter.rs` also encodes some knowledge about how they work, by way of reconstructing the `SysconfigPaths`. Instead, `gourgeist` now returns the complete layout, enumerating all the directories it created. So, rather than returning a root directory, and re-creating all those paths in `uv-interpreter`, we pass the data directly back to it.
This commit is contained in:
parent
c579e6f6bf
commit
c9ffe976f9
8 changed files with 159 additions and 207 deletions
|
|
@ -9,20 +9,21 @@ pub use crate::interpreter::Interpreter;
|
|||
pub use crate::python_environment::PythonEnvironment;
|
||||
pub use crate::python_query::{find_default_python, find_requested_python};
|
||||
pub use crate::python_version::PythonVersion;
|
||||
pub use crate::sysconfig::SysconfigPaths;
|
||||
pub use crate::virtualenv::Virtualenv;
|
||||
|
||||
mod cfg;
|
||||
mod interpreter;
|
||||
mod python_environment;
|
||||
mod python_query;
|
||||
mod python_version;
|
||||
mod virtualenv_layout;
|
||||
mod sysconfig;
|
||||
mod virtualenv;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum Error {
|
||||
#[error("Expected `{0}` to be a virtualenv, but pyvenv.cfg is missing")]
|
||||
#[error("Expected `{0}` to be a virtualenv, but `pyvenv.cfg` is missing")]
|
||||
MissingPyVenvCfg(PathBuf),
|
||||
#[error("Broken virtualenv `{0}`, it contains a pyvenv.cfg but no Python binary at `{1}`")]
|
||||
BrokenVenv(PathBuf, PathBuf),
|
||||
#[error("Both VIRTUAL_ENV and CONDA_PREFIX are set. Please unset one of them.")]
|
||||
Conflict,
|
||||
#[error("No versions of Python could be found. Is Python installed?")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue