Use simplified paths in lockfile (#6049)

## Summary

Closes https://github.com/astral-sh/uv/issues/6048.
This commit is contained in:
Charlie Marsh 2024-08-12 19:34:29 -04:00 committed by GitHub
parent e71bb0afb8
commit 4be8301935
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View File

@ -34,7 +34,7 @@ use pypi_types::{
};
use uv_configuration::{ExtrasSpecification, Upgrade};
use uv_distribution::{ArchiveMetadata, Metadata};
use uv_fs::{PortablePath, PortablePathBuf};
use uv_fs::{PortablePath, PortablePathBuf, Simplified};
use uv_git::{GitReference, GitSha, RepositoryReference, ResolvedRepositoryReference};
use uv_normalize::{ExtraName, GroupName, PackageName};
use uv_workspace::VirtualProject;
@ -1519,18 +1519,21 @@ impl Source {
}
fn from_path_built_dist(path_dist: &PathBuiltDist) -> Source {
Source::Path(path_dist.lock_path.clone())
let path = path_dist.lock_path.simplified().to_path_buf();
Source::Path(path)
}
fn from_path_source_dist(path_dist: &PathSourceDist) -> Source {
Source::Path(path_dist.install_path.clone())
let path = path_dist.install_path.simplified().to_path_buf();
Source::Path(path)
}
fn from_directory_source_dist(directory_dist: &DirectorySourceDist) -> Source {
let path = directory_dist.lock_path.simplified().to_path_buf();
if directory_dist.editable {
Source::Editable(directory_dist.lock_path.clone())
Source::Editable(path)
} else {
Source::Directory(directory_dist.lock_path.clone())
Source::Directory(path)
}
}

View File

@ -6695,7 +6695,6 @@ fn lock_sources_url() -> Result<()> {
///
/// When resolving, we should ignore the `tool.uv.sources` and instead pull in `anyio` from PyPI.
#[test]
#[cfg(not(windows))] // TODO(charlie): Fix file paths on Windows.
fn lock_sources_archive() -> Result<()> {
let context = TestContext::new("3.12");