Respect --index-url provided via requirements.txt (#1719)

## Summary

When we read `--index-url` from a `requirements.txt`, we attempt to
respect the `--index-url` provided by the CLI if it exists.
Unfortunately, `--index-url` from the CLI has a default value... so we
_never_ respect the `--index-url` in the requirements file.

This PR modifies the CLI to use `None`, and moves the default into logic
in the `IndexLocations `struct.

Closes https://github.com/astral-sh/uv/issues/1692.
This commit is contained in:
Charlie Marsh 2024-02-19 19:02:26 -05:00 committed by GitHub
parent 7b2c93f9fb
commit 034f62b24f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 153 additions and 55 deletions

View file

@ -160,7 +160,9 @@ impl RegistryClient {
Err(CachedClientError::Client(err)) => match err.into_kind() {
ErrorKind::Offline(_) => continue,
ErrorKind::RequestError(err) => {
if err.status() == Some(StatusCode::NOT_FOUND) {
if err.status() == Some(StatusCode::NOT_FOUND)
|| err.status() == Some(StatusCode::FORBIDDEN)
{
continue;
}
Err(ErrorKind::RequestError(err).into())