File tree Expand file tree Collapse file tree 1 file changed +11
-13
lines changed
crates/ty_project/src/metadata Expand file tree Collapse file tree 1 file changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -311,32 +311,30 @@ impl Options {
311311 // interpreter does
312312 if let Ok ( python_path) = system. env_var ( EnvVars :: PYTHONPATH ) {
313313 for path in std:: env:: split_paths ( python_path. as_str ( ) ) {
314- let Some ( path) = SystemPath :: from_std_path ( path. as_path ( ) ) else {
315- let path = path. to_string_lossy ( ) ;
316- tracing:: debug!(
317- "Skipping `{path}` listed in `PYTHONPATH` because the path is not valid UTF-8"
318- ) ;
319- continue ;
314+ let path = match SystemPathBuf :: from_path_buf ( path) {
315+ Ok ( path) => path,
316+ Err ( path) => {
317+ tracing:: debug!(
318+ "Skipping `{path}` listed in `PYTHONPATH` because the path is not valid UTF-8" ,
319+ path = path. display( )
320+ ) ;
321+ continue ;
322+ }
320323 } ;
321324
322325 let abspath = SystemPath :: absolute ( path, system. current_directory ( ) ) ;
323326
324- if !system. path_exists ( & abspath) {
325- tracing:: debug!(
326- "Skipping `{abspath}` listed in `PYTHONPATH` because the path does not exist"
327- ) ;
328- continue ;
329- }
330327 if !system. is_directory ( & abspath) {
331328 tracing:: debug!(
332- "Skipping `{abspath}` listed in `PYTHONPATH` because the path is not a directory"
329+ "Skipping `{abspath}` listed in `PYTHONPATH` because the path doesn't exist or isn't a directory"
333330 ) ;
334331 continue ;
335332 }
336333
337334 tracing:: debug!(
338335 "Adding `{abspath}` from the `PYTHONPATH` environment variable to `extra_paths`"
339336 ) ;
337+
340338 extra_paths. push ( abspath) ;
341339 }
342340 }
You can’t perform that action at this time.
0 commit comments