Preserve given for tool.uv.sources paths (#3412)

We now correctly emit relative paths in `uv pip compile` with
`tool.uv.sources` path inputs.

`tool.uv.sources` is mainly intended to be used with the uv lock file
over requirements.txt, but it's good to have basic `uv pip` support
working.

Fixes #3366
This commit is contained in:
konsti 2024-05-07 11:00:02 +02:00 committed by GitHub
parent 18516b4e41
commit 24f38d7c22
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 84 additions and 1 deletions

View file

@ -530,7 +530,7 @@ fn path_source(
project_dir: &Path,
editable: Option<bool>,
) -> Result<RequirementSource, LoweringError> {
let url = VerbatimUrl::parse_path(&path, project_dir);
let url = VerbatimUrl::parse_path(&path, project_dir).with_given(path.clone());
let path_buf = PathBuf::from(&path);
let path_buf = path_buf
.absolutize_from(project_dir)