mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 02:48:17 +00:00
.
This commit is contained in:
parent
9717fb58af
commit
77055f0c9d
143 changed files with 584 additions and 178 deletions
|
@ -56,6 +56,7 @@ sys-info = { workspace = true }
|
|||
target-lexicon = { workspace = true }
|
||||
tempfile = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
traversable-error = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tokio-util = { workspace = true, features = ["compat"] }
|
||||
tracing = { workspace = true }
|
||||
|
|
|
@ -175,7 +175,7 @@ type FindPythonResult = Result<PythonInstallation, PythonNotFound>;
|
|||
/// The result of failed Python installation discovery.
|
||||
///
|
||||
/// See [`FindPythonResult`].
|
||||
#[derive(Clone, Debug, Error, traversable_error::TraversableError)]
|
||||
#[derive(Clone, Debug, traversable_error::TraversableError, Error)]
|
||||
pub struct PythonNotFound {
|
||||
pub request: PythonRequest,
|
||||
pub python_preference: PythonPreference,
|
||||
|
@ -209,7 +209,7 @@ pub enum PythonSource {
|
|||
ParentInterpreter,
|
||||
}
|
||||
|
||||
#[derive(Error, traversable_error::TraversableError, Debug)]
|
||||
#[derive(traversable_error::TraversableError, Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error(transparent)]
|
||||
Io(#[from] io::Error),
|
||||
|
|
|
@ -38,7 +38,7 @@ use crate::platform::{self, Arch, Libc, Os};
|
|||
use crate::PythonVariant;
|
||||
use crate::{Interpreter, PythonRequest, PythonVersion, VersionRequest};
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
#[derive(traversable_error::TraversableError, Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error(transparent)]
|
||||
Io(#[from] io::Error),
|
||||
|
@ -1042,7 +1042,7 @@ impl Error {
|
|||
pub(crate) fn from_reqwest_middleware(url: Url, err: reqwest_middleware::Error) -> Self {
|
||||
match err {
|
||||
reqwest_middleware::Error::Middleware(error) => {
|
||||
Self::NetworkMiddlewareError(url, error)
|
||||
Self::NetworkMiddlewareError(url, error.into())
|
||||
}
|
||||
reqwest_middleware::Error::Reqwest(error) => {
|
||||
Self::NetworkError(url, WrappedReqwestError::from(error))
|
||||
|
|
|
@ -33,13 +33,13 @@ struct PythonEnvironmentShared {
|
|||
/// The result of failed environment discovery.
|
||||
///
|
||||
/// Generally this is cast from [`PythonNotFound`] by [`PythonEnvironment::find`].
|
||||
#[derive(Clone, Debug, Error, traversable_error::TraversableError)]
|
||||
#[derive(Clone, Debug, traversable_error::TraversableError, Error)]
|
||||
pub struct EnvironmentNotFound {
|
||||
request: PythonRequest,
|
||||
preference: EnvironmentPreference,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Error, traversable_error::TraversableError)]
|
||||
#[derive(Clone, Debug, traversable_error::TraversableError, Error)]
|
||||
pub struct InvalidEnvironment {
|
||||
path: PathBuf,
|
||||
pub kind: InvalidEnvironmentKind,
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::{
|
|||
};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Error, traversable_error::TraversableError, Debug)]
|
||||
#[derive(traversable_error::TraversableError, Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error("Unknown Python implementation `{0}`")]
|
||||
UnknownImplementation(String),
|
||||
|
|
|
@ -253,7 +253,7 @@ impl PythonInstallation {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Error, traversable_error::TraversableError, Debug)]
|
||||
#[derive(traversable_error::TraversableError, Error, Debug)]
|
||||
pub enum PythonInstallationKeyError {
|
||||
#[error("Failed to parse Python installation key `{0}`: {1}")]
|
||||
ParseError(String, String),
|
||||
|
|
|
@ -598,7 +598,7 @@ impl ExternallyManaged {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Error, traversable_error::TraversableError)]
|
||||
#[derive(Debug, traversable_error::TraversableError, Error)]
|
||||
pub struct UnexpectedResponseError {
|
||||
#[source]
|
||||
pub(super) err: serde_json::Error,
|
||||
|
@ -636,7 +636,7 @@ impl Display for UnexpectedResponseError {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Error, traversable_error::TraversableError)]
|
||||
#[derive(Debug, traversable_error::TraversableError, Error)]
|
||||
pub struct StatusCodeError {
|
||||
pub(super) code: ExitStatus,
|
||||
pub(super) stdout: String,
|
||||
|
@ -673,7 +673,7 @@ impl Display for StatusCodeError {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Error, traversable_error::TraversableError)]
|
||||
#[derive(Debug, traversable_error::TraversableError, Error)]
|
||||
pub enum Error {
|
||||
#[error("Failed to query Python interpreter")]
|
||||
Io(#[from] io::Error),
|
||||
|
@ -701,7 +701,7 @@ pub enum Error {
|
|||
Encode(#[from] rmp_serde::encode::Error),
|
||||
}
|
||||
|
||||
#[derive(Debug, Error, traversable_error::TraversableError)]
|
||||
#[derive(Debug, traversable_error::TraversableError, Error)]
|
||||
pub struct BrokenSymlink {
|
||||
pub path: PathBuf,
|
||||
/// Whether the interpreter path looks like a virtual environment.
|
||||
|
@ -735,7 +735,7 @@ enum InterpreterInfoResult {
|
|||
Success(Box<InterpreterInfo>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Error, traversable_error::TraversableError, Deserialize, Serialize)]
|
||||
#[derive(Debug, traversable_error::TraversableError, Error, Deserialize, Serialize)]
|
||||
#[serde(tag = "kind", rename_all = "snake_case")]
|
||||
pub enum InterpreterInfoError {
|
||||
#[error("Could not detect a glibc or a musl libc (while running on Linux)")]
|
||||
|
|
|
@ -63,7 +63,7 @@ pub(crate) fn current_dir() -> Result<std::path::PathBuf, std::io::Error> {
|
|||
.unwrap_or(std::env::current_dir())
|
||||
}
|
||||
|
||||
#[derive(Debug, Error, traversable_error::TraversableError)]
|
||||
#[derive(Debug, traversable_error::TraversableError, Error)]
|
||||
pub enum Error {
|
||||
#[error(transparent)]
|
||||
Io(#[from] std::io::Error),
|
||||
|
|
|
@ -14,7 +14,7 @@ use thiserror::Error;
|
|||
use tracing::trace;
|
||||
use uv_fs::Simplified;
|
||||
|
||||
#[derive(Debug, Error, traversable_error::TraversableError)]
|
||||
#[derive(Debug, traversable_error::TraversableError, Error)]
|
||||
pub enum LibcDetectionError {
|
||||
#[error("Could not detect either glibc version nor musl libc version, at least one of which is required")]
|
||||
NoLibcFound,
|
||||
|
|
|
@ -31,7 +31,7 @@ pub fn patch_dylib_install_name(dylib: PathBuf) -> Result<(), Error> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
#[derive(traversable_error::TraversableError, thiserror::Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error(transparent)]
|
||||
Io(#[from] std::io::Error),
|
||||
|
|
|
@ -27,7 +27,7 @@ use crate::platform::{Arch, Libc, Os};
|
|||
use crate::python_version::PythonVersion;
|
||||
use crate::{macos_dylib, sysconfig, PythonRequest, PythonVariant};
|
||||
|
||||
#[derive(Error, traversable_error::TraversableError, Debug)]
|
||||
#[derive(traversable_error::TraversableError, Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error(transparent)]
|
||||
Io(#[from] io::Error),
|
||||
|
|
|
@ -5,7 +5,7 @@ use std::ops::Deref;
|
|||
use std::{fmt, str::FromStr};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Error, traversable_error::TraversableError, Debug)]
|
||||
#[derive(traversable_error::TraversableError, Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error("Unknown operating system: {0}")]
|
||||
UnknownOs(String),
|
||||
|
|
|
@ -381,7 +381,7 @@ fn patch_pkgconfig(contents: &str) -> Option<String> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
#[derive(traversable_error::TraversableError, thiserror::Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error(transparent)]
|
||||
Io(#[from] std::io::Error),
|
||||
|
|
|
@ -249,7 +249,7 @@ const fn is_python_whitespace(c: char) -> bool {
|
|||
)
|
||||
}
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
#[derive(traversable_error::TraversableError, thiserror::Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error("Missing opening brace")]
|
||||
MissingOpenBrace,
|
||||
|
|
|
@ -48,7 +48,7 @@ pub struct PyVenvConfiguration {
|
|||
pub(crate) version: Option<PythonVersion>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Error, traversable_error::TraversableError)]
|
||||
#[derive(Debug, traversable_error::TraversableError, Error)]
|
||||
pub enum Error {
|
||||
#[error(transparent)]
|
||||
Io(#[from] io::Error),
|
||||
|
|
|
@ -125,7 +125,7 @@ fn read_registry_entry(company: &str, tag: &str, tag_key: &Key) -> Option<Window
|
|||
})
|
||||
}
|
||||
|
||||
#[derive(Debug, Error, traversable_error::TraversableError)]
|
||||
#[derive(Debug, traversable_error::TraversableError, Error)]
|
||||
pub enum ManagedPep514Error {
|
||||
#[error("Windows has an unknown pointer width for arch: `{_0}`")]
|
||||
InvalidPointerSize(Arch),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue