Support workspace to workspace path dependencies (#4833)

Add support for path dependencies from a package in one workspace to a
package in another workspace, which it self has workspace dependencies.

Say we have a main workspace with packages `a` and `b`, and a second
workspace with `c` and `d`. We have `a -> b`, `b -> c`, `c -> d`. This
would previously lead to a mangled path for `d`, which is now fixed.

Like distribution paths, we split workspace paths into an absolute
install path and a relative (or absolute, if the user provided an
absolute path) lock path.

Part of https://github.com/astral-sh/uv/issues/3943
This commit is contained in:
konsti 2024-07-16 22:38:46 +02:00 committed by GitHub
parent b5ec859273
commit abb6ac5127
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 410 additions and 88 deletions

View file

@ -8,7 +8,7 @@ use regex::Regex;
use thiserror::Error;
use url::{ParseError, Url};
use uv_fs::{normalize_path, normalize_url_path};
use uv_fs::{normalize_absolute_path, normalize_url_path};
use crate::Pep508Url;
@ -42,7 +42,7 @@ impl VerbatimUrl {
let path = path.as_ref();
// Normalize the path.
let path = normalize_path(path)
let path = normalize_absolute_path(path)
.map_err(|err| VerbatimUrlError::Normalization(path.to_path_buf(), err))?;
// Extract the fragment, if it exists.
@ -83,7 +83,7 @@ impl VerbatimUrl {
};
// Normalize the path.
let path = normalize_path(&path)
let path = normalize_absolute_path(&path)
.map_err(|err| VerbatimUrlError::Normalization(path.clone(), err))?;
// Extract the fragment, if it exists.
@ -113,7 +113,7 @@ impl VerbatimUrl {
};
// Normalize the path.
let Ok(path) = normalize_path(&path) else {
let Ok(path) = normalize_absolute_path(&path) else {
return Err(VerbatimUrlError::WorkingDirectory(path));
};