From 8abd235d39351621f3c83fd7a31285c8e3f5bd79 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Wed, 27 Nov 2024 22:16:23 -0500 Subject: [PATCH] Allow file: URLs to include package names --- crates/uv-resolver/src/resolution/requirements_txt.rs | 5 +++-- crates/uv/tests/it/pip_compile.rs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/uv-resolver/src/resolution/requirements_txt.rs b/crates/uv-resolver/src/resolution/requirements_txt.rs index 6a956ce9d091d..b48046ab85685 100644 --- a/crates/uv-resolver/src/resolution/requirements_txt.rs +++ b/crates/uv-resolver/src/resolution/requirements_txt.rs @@ -45,7 +45,7 @@ impl<'dist> RequirementsTxtDist<'dist> { } } - // If the URL is not _definitively_ an absolute `file://` URL, write it as a relative path. + // If the URL is not _definitively_ a `file://` URL, write it as a relative path. if self.dist.is_local() { if let VersionOrUrlRef::Url(url) = self.dist.version_or_url() { let given = url.verbatim(); @@ -72,11 +72,12 @@ impl<'dist> RequirementsTxtDist<'dist> { { Some(Cow::Owned(path.to_string())) } else { + // Ex) `file:///flask-3.0.3-py3-none-any.whl` None } } else { // Ex) `file:./flask-3.0.3-py3-none-any.whl` - Some(given) + None } } Some(_) => None, diff --git a/crates/uv/tests/it/pip_compile.rs b/crates/uv/tests/it/pip_compile.rs index 74bd57cbaed0e..b8b2db1012848 100644 --- a/crates/uv/tests/it/pip_compile.rs +++ b/crates/uv/tests/it/pip_compile.rs @@ -2887,7 +2887,7 @@ fn compile_wheel_path_dependency() -> Result<()> { # via flask click==8.1.7 # via flask - file:flask-3.0.0-py3-none-any.whl + flask @ file:flask-3.0.0-py3-none-any.whl # via -r requirements.in itsdangerous==2.1.2 # via flask