mirror of
				https://github.com/astral-sh/uv.git
				synced 2025-10-29 19:17:26 +00:00 
			
		
		
		
	Search PATH when python can't be found with py (#1711)
				
					
				
			This commit is contained in:
		
							parent
							
								
									12462e5730
								
							
						
					
					
						commit
						9f3ccf7fe1
					
				
					 6 changed files with 537 additions and 272 deletions
				
			
		|  | @ -2,11 +2,8 @@ use std::ffi::OsString; | |||
| use std::io; | ||||
| use std::path::PathBuf; | ||||
| 
 | ||||
| use pep440_rs::Version; | ||||
| use thiserror::Error; | ||||
| 
 | ||||
| use uv_fs::Normalized; | ||||
| 
 | ||||
| pub use crate::cfg::Configuration; | ||||
| pub use crate::interpreter::Interpreter; | ||||
| pub use crate::python_query::{find_default_python, find_requested_python}; | ||||
|  | @ -43,14 +40,18 @@ pub enum Error { | |||
|     #[error("Failed to run `py --list-paths` to find Python installations. Is Python installed?")] | ||||
|     PyList(#[source] io::Error), | ||||
|     #[cfg(windows)] | ||||
|     #[error("No Python {0} found through `py --list-paths`. Is Python {0} installed?")] | ||||
|     #[error(
 | ||||
|         "No Python {0} found through `py --list-paths` or in `PATH`. Is Python {0} installed?" | ||||
|     )] | ||||
|     NoSuchPython(String), | ||||
|     #[cfg(unix)] | ||||
|     #[error("No Python {0} In `PATH`. Is Python {0} installed?")] | ||||
|     NoSuchPython(String), | ||||
|     #[error("Neither `python` nor `python3` are in `PATH`. Is Python installed?")] | ||||
|     NoPythonInstalledUnix, | ||||
|     #[error("Could not find `python.exe` in PATH and `py --list-paths` did not list any Python versions. Is Python installed?")] | ||||
|     #[error(
 | ||||
|         "Could not find `python.exe` through `py --list-paths` or in 'PATH'. Is Python installed?" | ||||
|     )] | ||||
|     NoPythonInstalledWindows, | ||||
|     #[error("{message}:\n--- stdout:\n{stdout}\n--- stderr:\n{stderr}\n---")] | ||||
|     PythonSubcommandOutput { | ||||
|  | @ -64,6 +65,4 @@ pub enum Error { | |||
|     Cfg(#[from] cfg::Error), | ||||
|     #[error("Error finding `{}` in PATH", _0.to_string_lossy())] | ||||
|     WhichError(OsString, #[source] which::Error), | ||||
|     #[error("Interpreter at `{}` has the wrong patch version. Expected: {}, actual: {}", _0.normalized_display(), _1, _2)] | ||||
|     PatchVersionMismatch(PathBuf, String, Version), | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Micha Reiser
						Micha Reiser