Skip to content

Commit

Permalink
Treat mismatched directory and file urls as unsatisfied requirements (#…
Browse files Browse the repository at this point in the history
…4393)

Closes #4391
  • Loading branch information
zanieb committed Jun 19, 2024
1 parent 0db5ce0 commit 9a3b851
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
8 changes: 4 additions & 4 deletions crates/uv-installer/src/satisfies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ impl RequirementSatisfaction {
trace!(
"Path mismatch: {:?} vs. {:?}",
requested_path,
installed_path
installed_path,
);
return Ok(Self::Satisfied);
return Ok(Self::Mismatch);
}

if !ArchiveTimestamp::up_to_date_with(
Expand Down Expand Up @@ -237,9 +237,9 @@ impl RequirementSatisfaction {
trace!(
"Path mismatch: {:?} vs. {:?}",
requested_path,
installed_path
installed_path,
);
return Ok(Self::Satisfied);
return Ok(Self::Mismatch);
}

if !ArchiveTimestamp::up_to_date_with(
Expand Down
16 changes: 12 additions & 4 deletions crates/uv/tests/pip_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3178,9 +3178,9 @@ requires-python = ">=3.8"
Ok(())
}

/// Install from a direct path (wheel) with changed versions in the path.
/// Install from a direct path (wheel) with changed versions in the file name.
#[test]
fn path_version_change() {
fn path_name_version_change() {
let context = TestContext::new("3.12");

uv_snapshot!(context.filters(), context.install()
Expand Down Expand Up @@ -3218,7 +3218,11 @@ fn path_version_change() {
----- stderr -----
Resolved 1 package in [TIME]
Audited 1 package in [TIME]
Prepared 1 package in [TIME]
Uninstalled 1 package in [TIME]
Installed 1 package in [TIME]
- ok==1.0.0 (from file://[WORKSPACE]/scripts/links/ok-1.0.0-py3-none-any.whl)
+ ok==2.0.0 (from file://[WORKSPACE]/scripts/links/ok-2.0.0-py3-none-any.whl)
"###
);

Expand All @@ -3230,7 +3234,11 @@ fn path_version_change() {
----- stdout -----
----- stderr -----
Audited 1 package in [TIME]
Resolved 1 package in [TIME]
Uninstalled 1 package in [TIME]
Installed 1 package in [TIME]
- ok==2.0.0 (from file://[WORKSPACE]/scripts/links/ok-2.0.0-py3-none-any.whl)
+ ok==1.0.0 (from file://[WORKSPACE]/scripts/links/ok-1.0.0-py3-none-any.whl)
"###
);
}
Expand Down

0 comments on commit 9a3b851

Please sign in to comment.