@@ -2,10 +2,11 @@ use crate::Db;
22use crate :: combine:: Combine ;
33use crate :: glob:: { ExcludeFilter , IncludeExcludeFilter , IncludeFilter , PortableGlobKind } ;
44use crate :: metadata:: settings:: { OverrideSettings , SrcSettings } ;
5+
6+ use super :: settings:: { Override , Settings , TerminalSettings } ;
57use crate :: metadata:: value:: {
68 RangedValue , RelativeGlobPattern , RelativePathBuf , ValueSource , ValueSourceGuard ,
79} ;
8-
910use ordermap:: OrderMap ;
1011use ruff_db:: RustDoc ;
1112use ruff_db:: diagnostic:: {
@@ -28,13 +29,11 @@ use std::sync::Arc;
2829use thiserror:: Error ;
2930use ty_python_semantic:: lint:: { GetLintError , Level , LintSource , RuleSelection } ;
3031use ty_python_semantic:: {
31- ProgramSettings , PythonPath , PythonPlatform , PythonVersionFileSource , PythonVersionSource ,
32- PythonVersionWithSource , SearchPathSettings , SearchPathValidationError , SearchPaths ,
33- SysPrefixPathOrigin ,
32+ ProgramSettings , PythonEnvironmentPath , PythonPlatform , PythonVersionFileSource ,
33+ PythonVersionSource , PythonVersionWithSource , SearchPathSettings , SearchPathValidationError ,
34+ SearchPaths , SysPrefixPathOrigin ,
3435} ;
3536
36- use super :: settings:: { Override , Settings , TerminalSettings } ;
37-
3837#[ derive(
3938 Debug , Default , Clone , PartialEq , Eq , Combine , Serialize , Deserialize , OptionsMetadata ,
4039) ]
@@ -231,7 +230,7 @@ impl Options {
231230 . typeshed
232231 . as_ref ( )
233232 . map ( |path| path. absolute ( project_root, system) ) ,
234- python_path : environment
233+ python_environment : environment
235234 . python
236235 . as_ref ( )
237236 . map ( |python_path| {
@@ -242,24 +241,12 @@ impl Options {
242241 python_path. range ( ) ,
243242 ) ,
244243 } ;
245- PythonPath :: sys_prefix ( python_path. absolute ( project_root, system) , origin)
246- } )
247- . or_else ( || {
248- system. env_var ( "VIRTUAL_ENV" ) . ok ( ) . map ( |virtual_env| {
249- PythonPath :: sys_prefix ( virtual_env, SysPrefixPathOrigin :: VirtualEnvVar )
250- } )
251- } )
252- . or_else ( || {
253- system. env_var ( "CONDA_PREFIX" ) . ok ( ) . map ( |path| {
254- PythonPath :: sys_prefix ( path, SysPrefixPathOrigin :: CondaPrefixVar )
255- } )
256- } )
257- . unwrap_or_else ( || {
258- PythonPath :: sys_prefix (
259- project_root. to_path_buf ( ) ,
260- SysPrefixPathOrigin :: LocalVenv ,
244+ PythonEnvironmentPath :: explicit (
245+ python_path. absolute ( project_root, system) ,
246+ origin,
261247 )
262- } ) ,
248+ } )
249+ . unwrap_or_else ( || PythonEnvironmentPath :: Discover ( project_root. to_path_buf ( ) ) ) ,
263250 } ;
264251
265252 settings. to_search_paths ( system, vendored)
0 commit comments