Only use relative paths in lockfile (#6490)

For users who were using absolute paths in the `pyproject.toml`
previously, this is a behavior change: We now convert all absolute paths
in `path` entries to relative paths. Since i assume that no-one relies
on absolute path in their lockfiles - they are intended to be portable -
I'm tagging this as a bugfix.

Closes https://github.com/astral-sh/uv/pull/6438
Fixes https://github.com/astral-sh/uv/issues/6371
This commit is contained in:
Charlie Marsh 2024-08-23 22:19:10 -04:00 committed by GitHub
parent 611a9003c9
commit f7835243c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 329 additions and 383 deletions

View file

@ -332,13 +332,13 @@ impl Source {
let source = match source {
RequirementSource::Registry { .. } => return Ok(None),
RequirementSource::Path { lock_path, .. } => Source::Path {
RequirementSource::Path { install_path, .. } => Source::Path {
editable,
path: lock_path.to_string_lossy().into_owned(),
path: install_path.to_string_lossy().into_owned(),
},
RequirementSource::Directory { lock_path, .. } => Source::Path {
RequirementSource::Directory { install_path, .. } => Source::Path {
editable,
path: lock_path.to_string_lossy().into_owned(),
path: install_path.to_string_lossy().into_owned(),
},
RequirementSource::Url {
subdirectory, url, ..