mirror of
https://github.com/astral-sh/uv.git
synced 2025-09-26 12:09:12 +00:00
Remove unused thiserror
variants in resolver (#7717)
## Summary While looking at something else, I noticed that these are not used.
This commit is contained in:
parent
df45b9ac25
commit
fe88c10813
3 changed files with 7 additions and 27 deletions
|
@ -36,12 +36,6 @@ pub enum ResolveError {
|
||||||
#[error("Attempted to wait on an unregistered task: `{_0}`")]
|
#[error("Attempted to wait on an unregistered task: `{_0}`")]
|
||||||
UnregisteredTask(String),
|
UnregisteredTask(String),
|
||||||
|
|
||||||
#[error("Package metadata name `{metadata}` does not match given name `{given}`")]
|
|
||||||
NameMismatch {
|
|
||||||
given: PackageName,
|
|
||||||
metadata: PackageName,
|
|
||||||
},
|
|
||||||
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
PubGrubSpecifier(#[from] PubGrubSpecifierError),
|
PubGrubSpecifier(#[from] PubGrubSpecifierError),
|
||||||
|
|
||||||
|
@ -61,9 +55,6 @@ pub enum ResolveError {
|
||||||
#[error("Package `{0}` attempted to resolve via URL: {1}. URL dependencies must be expressed as direct requirements or constraints. Consider adding `{0} @ {1}` to your dependencies or constraints file.")]
|
#[error("Package `{0}` attempted to resolve via URL: {1}. URL dependencies must be expressed as direct requirements or constraints. Consider adding `{0} @ {1}` to your dependencies or constraints file.")]
|
||||||
DisallowedUrl(PackageName, String),
|
DisallowedUrl(PackageName, String),
|
||||||
|
|
||||||
#[error("There are conflicting editable requirements for package `{0}`:\n- {1}\n- {2}")]
|
|
||||||
ConflictingEditables(PackageName, String, String),
|
|
||||||
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
DistributionType(#[from] distribution_types::Error),
|
DistributionType(#[from] distribution_types::Error),
|
||||||
|
|
||||||
|
@ -89,14 +80,6 @@ pub enum ResolveError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
NoSolution(#[from] NoSolutionError),
|
NoSolution(#[from] NoSolutionError),
|
||||||
|
|
||||||
#[error("{package} {version} depends on itself")]
|
|
||||||
SelfDependency {
|
|
||||||
/// Package whose dependencies we want.
|
|
||||||
package: Box<PubGrubPackage>,
|
|
||||||
/// Version of the package for which we want the dependencies.
|
|
||||||
version: Box<Version>,
|
|
||||||
},
|
|
||||||
|
|
||||||
#[error("Attempted to construct an invalid version specifier")]
|
#[error("Attempted to construct an invalid version specifier")]
|
||||||
InvalidVersion(#[from] pep440_rs::VersionSpecifierBuildError),
|
InvalidVersion(#[from] pep440_rs::VersionSpecifierBuildError),
|
||||||
|
|
||||||
|
@ -106,9 +89,8 @@ pub enum ResolveError {
|
||||||
#[error("found conflicting distribution in resolution: {0}")]
|
#[error("found conflicting distribution in resolution: {0}")]
|
||||||
ConflictingDistribution(ConflictingDistributionError),
|
ConflictingDistribution(ConflictingDistributionError),
|
||||||
|
|
||||||
/// Something unexpected happened.
|
#[error("Package `{0}` is unavailable")]
|
||||||
#[error("{0}")]
|
PackageUnavailable(PackageName),
|
||||||
Failure(String),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> From<tokio::sync::mpsc::error::SendError<T>> for ResolveError {
|
impl<T> From<tokio::sync::mpsc::error::SendError<T>> for ResolveError {
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::python_requirement::PythonRequirement;
|
||||||
|
|
||||||
/// [`Arc`] wrapper around [`PubGrubPackageInner`] to make cloning (inside PubGrub) cheap.
|
/// [`Arc`] wrapper around [`PubGrubPackageInner`] to make cloning (inside PubGrub) cheap.
|
||||||
#[derive(Debug, Clone, Eq, Hash, PartialEq, PartialOrd, Ord)]
|
#[derive(Debug, Clone, Eq, Hash, PartialEq, PartialOrd, Ord)]
|
||||||
pub struct PubGrubPackage(Arc<PubGrubPackageInner>);
|
pub(crate) struct PubGrubPackage(Arc<PubGrubPackageInner>);
|
||||||
|
|
||||||
impl Deref for PubGrubPackage {
|
impl Deref for PubGrubPackage {
|
||||||
type Target = PubGrubPackageInner;
|
type Target = PubGrubPackageInner;
|
||||||
|
@ -38,7 +38,7 @@ impl From<PubGrubPackageInner> for PubGrubPackage {
|
||||||
/// package (e.g., `black[colorama]`), and mark it as a dependency of the real package (e.g.,
|
/// package (e.g., `black[colorama]`), and mark it as a dependency of the real package (e.g.,
|
||||||
/// `black`). We then discard the virtual packages at the end of the resolution process.
|
/// `black`). We then discard the virtual packages at the end of the resolution process.
|
||||||
#[derive(Debug, Clone, Eq, Hash, PartialEq, PartialOrd, Ord)]
|
#[derive(Debug, Clone, Eq, Hash, PartialEq, PartialOrd, Ord)]
|
||||||
pub enum PubGrubPackageInner {
|
pub(crate) enum PubGrubPackageInner {
|
||||||
/// The root package, which is used to start the resolution process.
|
/// The root package, which is used to start the resolution process.
|
||||||
Root(Option<PackageName>),
|
Root(Option<PackageName>),
|
||||||
/// A Python version.
|
/// A Python version.
|
||||||
|
@ -167,7 +167,7 @@ impl PubGrubPackage {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` if this PubGrub package is a proxy package.
|
/// Returns `true` if this PubGrub package is a proxy package.
|
||||||
pub fn is_proxy(&self) -> bool {
|
pub(crate) fn is_proxy(&self) -> bool {
|
||||||
matches!(
|
matches!(
|
||||||
&**self,
|
&**self,
|
||||||
PubGrubPackageInner::Extra { .. }
|
PubGrubPackageInner::Extra { .. }
|
||||||
|
@ -219,7 +219,7 @@ impl PubGrubPackage {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Eq, PartialEq, PartialOrd, Hash, Ord)]
|
#[derive(Debug, Copy, Clone, Eq, PartialEq, PartialOrd, Hash, Ord)]
|
||||||
pub enum PubGrubPython {
|
pub(crate) enum PubGrubPython {
|
||||||
/// The Python version installed in the current environment.
|
/// The Python version installed in the current environment.
|
||||||
Installed,
|
Installed,
|
||||||
/// The Python version for which dependencies are being resolved.
|
/// The Python version for which dependencies are being resolved.
|
||||||
|
|
|
@ -1216,9 +1216,7 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
|
||||||
false,
|
false,
|
||||||
"Dependencies were requested for a package that is not available"
|
"Dependencies were requested for a package that is not available"
|
||||||
);
|
);
|
||||||
return Err(ResolveError::Failure(format!(
|
return Err(ResolveError::PackageUnavailable(name.clone()));
|
||||||
"The package is unavailable: {name}"
|
|
||||||
)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for the metadata to be available.
|
// Wait for the metadata to be available.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue