@@ -10,7 +10,7 @@ use uv_distribution_filename::SourceDistExtension;
1010use uv_distribution_types:: { DependencyMetadata , IndexLocations } ;
1111use uv_install_wheel:: linker:: LinkMode ;
1212
13- use uv_auth:: store_credentials_from_url;
13+ use uv_auth:: { store_credentials , store_credentials_from_url} ;
1414use uv_cache:: Cache ;
1515use uv_client:: { BaseClientBuilder , Connectivity , FlatIndexClient , RegistryClientBuilder } ;
1616use uv_configuration:: {
@@ -400,8 +400,13 @@ async fn build_package(
400400 . into_interpreter ( ) ;
401401
402402 // Add all authenticated sources to the cache.
403- for url in index_locations. allowed_urls ( ) {
404- store_credentials_from_url ( url) ;
403+ for index in index_locations. allowed_indexes ( ) {
404+ if let Some ( credentials) = index. credentials ( ) {
405+ store_credentials ( index. raw_url ( ) , credentials) ;
406+ }
407+ }
408+ for index in index_locations. flat_indexes ( ) {
409+ store_credentials_from_url ( index. url ( ) ) ;
405410 }
406411
407412 // Read build constraints.
@@ -454,7 +459,7 @@ async fn build_package(
454459 // Resolve the flat indexes from `--find-links`.
455460 let flat_index = {
456461 let client = FlatIndexClient :: new ( & client, cache) ;
457- let entries = client. fetch ( index_locations. flat_index ( ) ) . await ?;
462+ let entries = client. fetch ( index_locations. flat_indexes ( ) ) . await ?;
458463 FlatIndex :: from_entries ( entries, None , & hasher, build_options)
459464 } ;
460465
0 commit comments