Treat local indexes as registry sources in lockfile (#6016)

## Summary

Closes https://github.com/astral-sh/uv/issues/6013.

Closes https://github.com/astral-sh/uv/issues/6014.

Adds test coverage for https://github.com/astral-sh/uv/issues/6015.
This commit is contained in:
Charlie Marsh 2024-08-11 22:02:39 -04:00 committed by GitHub
parent 0b999557fb
commit e941bb6623
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 484 additions and 13 deletions

View file

@ -1545,16 +1545,7 @@ impl Source {
fn from_index_url(index_url: &IndexUrl) -> Source {
// Remove any sensitive credentials from the index URL.
let redacted = index_url.redacted();
match *index_url {
IndexUrl::Pypi(_) => Source::Registry(UrlString::from(redacted.as_ref())),
IndexUrl::Url(_) => Source::Registry(UrlString::from(redacted.as_ref())),
// TODO(konsti): Retain path on index url without converting to URL.
IndexUrl::Path(_) => Source::Path(
redacted
.to_file_path()
.expect("Could not convert index URL to path"),
),
}
Source::Registry(UrlString::from(redacted.as_ref()))
}
fn from_git_dist(git_dist: &GitSourceDist) -> Source {