mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-29 19:17:26 +00:00
Use UnusableDependencies for URL dependency conflicts (#425)
Extends #424 with support for URL dependency incompatibilities. Requires changes to `miette` to prevent URLs from being word wrapped; accepted upstream in https://github.com/zkat/miette/pull/321
This commit is contained in:
parent
2094680cdd
commit
221751487c
8 changed files with 60 additions and 15 deletions
30
Cargo.lock
generated
30
Cargo.lock
generated
|
|
@ -412,7 +412,7 @@ dependencies = [
|
||||||
"hex",
|
"hex",
|
||||||
"libc",
|
"libc",
|
||||||
"memmap2 0.5.10",
|
"memmap2 0.5.10",
|
||||||
"miette",
|
"miette 5.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"reflink-copy",
|
"reflink-copy",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
|
|
@ -1791,11 +1791,22 @@ name = "miette"
|
||||||
version = "5.10.0"
|
version = "5.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "59bb584eaeeab6bd0226ccf3509a69d7936d148cf3d036ad350abe35e8c6856e"
|
checksum = "59bb584eaeeab6bd0226ccf3509a69d7936d148cf3d036ad350abe35e8c6856e"
|
||||||
|
dependencies = [
|
||||||
|
"miette-derive 5.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"once_cell",
|
||||||
|
"thiserror",
|
||||||
|
"unicode-width",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "miette"
|
||||||
|
version = "5.10.0"
|
||||||
|
source = "git+https://github.com/zkat/miette.git?rev=fd77257cee0f5d03aa7dccb4ba8cbaa40c1a88c6#fd77257cee0f5d03aa7dccb4ba8cbaa40c1a88c6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backtrace",
|
"backtrace",
|
||||||
"backtrace-ext",
|
"backtrace-ext",
|
||||||
"is-terminal",
|
"is-terminal",
|
||||||
"miette-derive",
|
"miette-derive 5.10.0 (git+https://github.com/zkat/miette.git?rev=fd77257cee0f5d03aa7dccb4ba8cbaa40c1a88c6)",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"owo-colors",
|
"owo-colors",
|
||||||
"supports-color",
|
"supports-color",
|
||||||
|
|
@ -1818,6 +1829,16 @@ dependencies = [
|
||||||
"syn 2.0.39",
|
"syn 2.0.39",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "miette-derive"
|
||||||
|
version = "5.10.0"
|
||||||
|
source = "git+https://github.com/zkat/miette.git?rev=fd77257cee0f5d03aa7dccb4ba8cbaa40c1a88c6#fd77257cee0f5d03aa7dccb4ba8cbaa40c1a88c6"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.39",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mimalloc"
|
name = "mimalloc"
|
||||||
version = "0.1.39"
|
version = "0.1.39"
|
||||||
|
|
@ -2359,7 +2380,7 @@ dependencies = [
|
||||||
"insta-cmd",
|
"insta-cmd",
|
||||||
"install-wheel-rs",
|
"install-wheel-rs",
|
||||||
"itertools 0.11.0",
|
"itertools 0.11.0",
|
||||||
"miette",
|
"miette 5.10.0 (git+https://github.com/zkat/miette.git?rev=fd77257cee0f5d03aa7dccb4ba8cbaa40c1a88c6)",
|
||||||
"mimalloc",
|
"mimalloc",
|
||||||
"pep440_rs 0.3.12",
|
"pep440_rs 0.3.12",
|
||||||
"pep508_rs",
|
"pep508_rs",
|
||||||
|
|
@ -2380,6 +2401,7 @@ dependencies = [
|
||||||
"pyproject-toml",
|
"pyproject-toml",
|
||||||
"requirements-txt",
|
"requirements-txt",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
|
"textwrap",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tikv-jemallocator",
|
"tikv-jemallocator",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
|
@ -3345,7 +3367,7 @@ dependencies = [
|
||||||
"base64 0.21.5",
|
"base64 0.21.5",
|
||||||
"digest",
|
"digest",
|
||||||
"hex",
|
"hex",
|
||||||
"miette",
|
"miette 5.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde",
|
"serde",
|
||||||
"sha-1",
|
"sha-1",
|
||||||
"sha2",
|
"sha2",
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,8 @@ indicatif = { version = "0.17.7" }
|
||||||
indoc = { version = "2.0.4" }
|
indoc = { version = "2.0.4" }
|
||||||
itertools = { version = "0.11.0" }
|
itertools = { version = "0.11.0" }
|
||||||
mailparse = { version = "0.14.0" }
|
mailparse = { version = "0.14.0" }
|
||||||
miette = { version = "5.10.0" }
|
# For additional textwrap options: https://github.com/zkat/miette/pull/321
|
||||||
|
miette = { git = "https://github.com/zkat/miette.git", rev = "fd77257cee0f5d03aa7dccb4ba8cbaa40c1a88c6" }
|
||||||
once_cell = { version = "1.18.0" }
|
once_cell = { version = "1.18.0" }
|
||||||
petgraph = { version = "0.6.4" }
|
petgraph = { version = "0.6.4" }
|
||||||
platform-info = { version = "2.0.2" }
|
platform-info = { version = "2.0.2" }
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ name = "puffin"
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
textwrap = { version = "0.15.2" }
|
||||||
|
|
||||||
gourgeist = { path = "../gourgeist" }
|
gourgeist = { path = "../gourgeist" }
|
||||||
install-wheel-rs = { path = "../install-wheel-rs", default-features = false }
|
install-wheel-rs = { path = "../install-wheel-rs", default-features = false }
|
||||||
pep440_rs = { path = "../pep440-rs" }
|
pep440_rs = { path = "../pep440-rs" }
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,16 @@ pub(crate) async fn pip_compile(
|
||||||
cache: &Path,
|
cache: &Path,
|
||||||
mut printer: Printer,
|
mut printer: Printer,
|
||||||
) -> Result<ExitStatus> {
|
) -> Result<ExitStatus> {
|
||||||
|
miette::set_hook(Box::new(|_| {
|
||||||
|
Box::new(
|
||||||
|
miette::MietteHandlerOpts::new()
|
||||||
|
.break_words(false)
|
||||||
|
.word_separator(textwrap::WordSeparator::AsciiSpace)
|
||||||
|
.word_splitter(textwrap::WordSplitter::NoHyphenation)
|
||||||
|
.build(),
|
||||||
|
)
|
||||||
|
}))?;
|
||||||
|
|
||||||
let start = std::time::Instant::now();
|
let start = std::time::Instant::now();
|
||||||
|
|
||||||
// If the user requests `extras` but does not provide a pyproject toml source
|
// If the user requests `extras` but does not provide a pyproject toml source
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,17 @@ info:
|
||||||
- pip-compile
|
- pip-compile
|
||||||
- requirements.in
|
- requirements.in
|
||||||
- "--cache-dir"
|
- "--cache-dir"
|
||||||
- /var/folders/nt/6gf2v7_s3k13zq_t3944rwz40000gn/T/.tmpIZhaps
|
- /var/folders/bc/qlsk3t6x7c9fhhbvvcg68k9c0000gp/T/.tmpPPS74q
|
||||||
env:
|
env:
|
||||||
VIRTUAL_ENV: /var/folders/nt/6gf2v7_s3k13zq_t3944rwz40000gn/T/.tmpKUYHgL/.venv
|
VIRTUAL_ENV: /var/folders/bc/qlsk3t6x7c9fhhbvvcg68k9c0000gp/T/.tmplYH9yM/.venv
|
||||||
---
|
---
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
error: Conflicting URLs for package `werkzeug`: git+https://github.com/pallets/werkzeug.git@2.0.0 and https://files.pythonhosted.org/packages/ff/1d/960bb4017c68674a1cb099534840f18d3def3ce44aed12b5ed8b78e0153e/Werkzeug-2.0.0-py3-none-any.whl
|
× No solution found when resolving dependencies:
|
||||||
|
╰─▶ root dependencies are unusable: Conflicting URLs for package `werkzeug`:
|
||||||
|
- git+https://github.com/pallets/werkzeug.git@2.0.0
|
||||||
|
- https://files.pythonhosted.org/packages/ff/1d/960bb4017c68674a1cb099534840f18d3def3ce44aed12b5ed8b78e0153e/Werkzeug-2.0.0-py3-none-any.whl
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,17 @@ info:
|
||||||
- pip-compile
|
- pip-compile
|
||||||
- requirements.in
|
- requirements.in
|
||||||
- "--cache-dir"
|
- "--cache-dir"
|
||||||
- /var/folders/nt/6gf2v7_s3k13zq_t3944rwz40000gn/T/.tmpPGmK15
|
- /var/folders/bc/qlsk3t6x7c9fhhbvvcg68k9c0000gp/T/.tmptRvh60
|
||||||
env:
|
env:
|
||||||
VIRTUAL_ENV: /var/folders/nt/6gf2v7_s3k13zq_t3944rwz40000gn/T/.tmpgXUIr9/.venv
|
VIRTUAL_ENV: /var/folders/bc/qlsk3t6x7c9fhhbvvcg68k9c0000gp/T/.tmpNKU4Z0/.venv
|
||||||
---
|
---
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
error: Conflicting URLs for package `werkzeug`: https://files.pythonhosted.org/packages/bd/24/11c3ea5a7e866bf2d97f0501d0b4b1c9bbeade102bb4b588f0d2919a5212/Werkzeug-2.0.1-py3-none-any.whl and https://files.pythonhosted.org/packages/ff/1d/960bb4017c68674a1cb099534840f18d3def3ce44aed12b5ed8b78e0153e/Werkzeug-2.0.0-py3-none-any.whl
|
× No solution found when resolving dependencies:
|
||||||
|
╰─▶ root dependencies are unusable: Conflicting URLs for package `werkzeug`:
|
||||||
|
- https://files.pythonhosted.org/packages/bd/24/11c3ea5a7e866bf2d97f0501d0b4b1c9bbeade102bb4b588f0d2919a5212/Werkzeug-2.0.1-py3-none-any.whl
|
||||||
|
- https://files.pythonhosted.org/packages/ff/1d/960bb4017c68674a1cb099534840f18d3def3ce44aed12b5ed8b78e0153e/Werkzeug-2.0.0-py3-none-any.whl
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ pub enum ResolveError {
|
||||||
#[error("~= operator requires at least two release segments: {0}")]
|
#[error("~= operator requires at least two release segments: {0}")]
|
||||||
InvalidTildeEquals(pep440_rs::VersionSpecifier),
|
InvalidTildeEquals(pep440_rs::VersionSpecifier),
|
||||||
|
|
||||||
#[error("Conflicting URLs for package `{0}`: {1} and {2}")]
|
#[error("Conflicting URLs for package `{0}`:\n- {1}\n- {2}")]
|
||||||
ConflictingUrls(PackageName, String, String),
|
ConflictingUrls(PackageName, String, String),
|
||||||
|
|
||||||
#[error("Conflicting versions for `{0}`: {1}")]
|
#[error("Conflicting versions for `{0}`: {1}")]
|
||||||
|
|
|
||||||
|
|
@ -466,7 +466,11 @@ impl<'a, Context: BuildContext + Sync> Resolver<'a, Context> {
|
||||||
None,
|
None,
|
||||||
self.markers,
|
self.markers,
|
||||||
);
|
);
|
||||||
if let Err(err @ ResolveError::ConflictingVersions(..)) = constraints {
|
if let Err(
|
||||||
|
err @ (ResolveError::ConflictingVersions(..)
|
||||||
|
| ResolveError::ConflictingUrls(..)),
|
||||||
|
) = constraints
|
||||||
|
{
|
||||||
return Ok(Dependencies::Unusable(Some(err.to_string())));
|
return Ok(Dependencies::Unusable(Some(err.to_string())));
|
||||||
}
|
}
|
||||||
let constraints = constraints?;
|
let constraints = constraints?;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue