diff --git a/Cargo.lock b/Cargo.lock index b92921242f59d..bd5adfd797b45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2832,7 +2832,7 @@ dependencies = [ [[package]] name = "pubgrub" version = "0.3.0" -source = "git+https://github.com/astral-sh/pubgrub?rev=a3b4db3abb1829ce889fb89fa6d157fef529ef7e#a3b4db3abb1829ce889fb89fa6d157fef529ef7e" +source = "git+https://github.com/astral-sh/pubgrub?rev=73d6ecf5a4e4eb1c754b8c3255c4d31bdc266fdb#73d6ecf5a4e4eb1c754b8c3255c4d31bdc266fdb" dependencies = [ "indexmap", "log", @@ -5979,7 +5979,7 @@ checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" [[package]] name = "version-ranges" version = "0.1.1" -source = "git+https://github.com/astral-sh/pubgrub?rev=a3b4db3abb1829ce889fb89fa6d157fef529ef7e#a3b4db3abb1829ce889fb89fa6d157fef529ef7e" +source = "git+https://github.com/astral-sh/pubgrub?rev=73d6ecf5a4e4eb1c754b8c3255c4d31bdc266fdb#73d6ecf5a4e4eb1c754b8c3255c4d31bdc266fdb" dependencies = [ "smallvec", ] diff --git a/Cargo.toml b/Cargo.toml index 09d782523b3fc..d0f7d769c24cc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -135,7 +135,7 @@ percent-encoding = { version = "2.3.1" } petgraph = { version = "0.8.0" } proc-macro2 = { version = "1.0.86" } procfs = { version = "0.17.0", default-features = false, features = ["flate2"] } -pubgrub = { git = "https://github.com/astral-sh/pubgrub", rev = "a3b4db3abb1829ce889fb89fa6d157fef529ef7e" } +pubgrub = { git = "https://github.com/astral-sh/pubgrub", rev = "73d6ecf5a4e4eb1c754b8c3255c4d31bdc266fdb" } quote = { version = "1.0.37" } rayon = { version = "1.10.0" } reflink-copy = { version = "0.1.19" } @@ -180,7 +180,7 @@ tracing-tree = { version = "0.4.0" } unicode-width = { version = "0.2.0" } unscanny = { version = "0.1.0" } url = { version = "2.5.2", features = ["serde"] } -version-ranges = { git = "https://github.com/astral-sh/pubgrub", rev = "a3b4db3abb1829ce889fb89fa6d157fef529ef7e" } +version-ranges = { git = "https://github.com/astral-sh/pubgrub", rev = "73d6ecf5a4e4eb1c754b8c3255c4d31bdc266fdb" } walkdir = { version = "2.5.0" } which = { version = "7.0.0", features = ["regex"] } windows-registry = { version = "0.5.0" } diff --git a/crates/uv/tests/it/pip_compile.rs b/crates/uv/tests/it/pip_compile.rs index 99f0e61e326fc..71fd472d42377 100644 --- a/crates/uv/tests/it/pip_compile.rs +++ b/crates/uv/tests/it/pip_compile.rs @@ -17403,3 +17403,92 @@ fn compile_broken_active_venv() -> Result<()> { Ok(()) } + +/// +#[test] +fn pubgrub_panic_double_self_dependency() -> Result<()> { + let context = TestContext::new("3.12"); + context + .temp_dir + .child("pyproject.toml") + .write_str(indoc! {r#" + [project] + name = "foo" + version = "0.1.0" + dependencies = [ + "foo", + "foo", + ] + + [build-system] + requires = ["hatchling"] + build-backend = "hatchling.build" + "#})?; + + let requirements_in = context.temp_dir.child("requirements.in"); + requirements_in.write_str(".")?; + + uv_snapshot!(context.filters(), context + .pip_compile() + .arg(requirements_in.path()), @r" + success: true + exit_code: 0 + ----- stdout ----- + # This file was autogenerated by uv via the following command: + # uv pip compile --cache-dir [CACHE_DIR] [TEMP_DIR]/requirements.in + . + # via -r requirements.in + + ----- stderr ----- + Resolved 1 package in [TIME] + "); + + Ok(()) +} + +/// +#[test] +fn pubgrub_panic_double_self_dependency_extra() -> Result<()> { + let context = TestContext::new("3.12"); + context + .temp_dir + .child("pyproject.toml") + .write_str(indoc! {r#" + [project] + name = "foo" + version = "0.1.0" + dependencies = [ + "foo[test]", + "foo[test]", + ] + + [project.optional-dependencies] + test = ["iniconfig"] + + [build-system] + requires = ["hatchling"] + build-backend = "hatchling.build" + "#})?; + + let requirements_in = context.temp_dir.child("requirements.in"); + requirements_in.write_str(".")?; + + uv_snapshot!(context.filters(), context + .pip_compile() + .arg(requirements_in.path()), @r" + success: true + exit_code: 0 + ----- stdout ----- + # This file was autogenerated by uv via the following command: + # uv pip compile --cache-dir [CACHE_DIR] [TEMP_DIR]/requirements.in + . + # via -r requirements.in + iniconfig==2.0.0 + # via foo + + ----- stderr ----- + Resolved 2 packages in [TIME] + "); + + Ok(()) +}