@@ -8,7 +8,7 @@ use distribution_types::{DependencyMetadata, IndexLocations};
88use install_wheel_rs:: linker:: LinkMode ;
99use owo_colors:: OwoColorize ;
1010
11- use uv_auth:: store_credentials_from_url;
11+ use uv_auth:: { store_credentials , store_credentials_from_url} ;
1212use uv_cache:: Cache ;
1313use uv_client:: { BaseClientBuilder , Connectivity , FlatIndexClient , RegistryClientBuilder } ;
1414use uv_configuration:: {
@@ -391,8 +391,13 @@ async fn build_package(
391391 . into_interpreter ( ) ;
392392
393393 // Add all authenticated sources to the cache.
394- for url in index_locations. allowed_urls ( ) {
395- store_credentials_from_url ( url) ;
394+ for index in index_locations. allowed_indexes ( ) {
395+ if let Some ( credentials) = index. credentials ( ) {
396+ store_credentials ( index. raw_url ( ) , credentials) ;
397+ }
398+ }
399+ for index in index_locations. flat_indexes ( ) {
400+ store_credentials_from_url ( index. url ( ) ) ;
396401 }
397402
398403 // Read build constraints.
@@ -445,7 +450,7 @@ async fn build_package(
445450 // Resolve the flat indexes from `--find-links`.
446451 let flat_index = {
447452 let client = FlatIndexClient :: new ( & client, cache) ;
448- let entries = client. fetch ( index_locations. flat_index ( ) ) . await ?;
453+ let entries = client. fetch ( index_locations. flat_indexes ( ) ) . await ?;
449454 FlatIndex :: from_entries ( entries, None , & hasher, build_options)
450455 } ;
451456
0 commit comments