mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 14:52:01 +00:00
Change EnvironmentOptions::venv-path
to Option<SystemPathBuf>
(#15631)
## Summary The `Options` struct is intended to capture the user's configuration options but `EnvironmentOptions::venv_path` supports both a `SitePackages::Known` and `SitePackages::Derived`. Users should only be able to provide `SitePackages::Derived`—they specify a path to a venv, and Red Knot derives the path to the site-packages directory. We'll only use the `Known` variant once we automatically discover the Python installation. That's why this PR changes `EnvironmentOptions::venv_path` from `Option<SitePackages>` to `Option<SystemPathBuf>`. This requires making some changes to the file watcher test, and I decided to use `extra_paths` over venv path because our venv validation is annoyingly correct -- making mocking a venv rather involved. ## Test Plan `cargo test`
This commit is contained in:
parent
4366473d9b
commit
067c6de465
5 changed files with 19 additions and 27 deletions
|
@ -134,12 +134,3 @@ pub enum SitePackages {
|
|||
/// Resolved site packages paths
|
||||
Known(Vec<SystemPathBuf>),
|
||||
}
|
||||
|
||||
impl SitePackages {
|
||||
pub fn paths(&self) -> &[SystemPathBuf] {
|
||||
match self {
|
||||
SitePackages::Derived { venv_path } => std::slice::from_ref(venv_path),
|
||||
SitePackages::Known(paths) => paths,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue