Move cache sharding below `prepare_metadata_for_build_wheel` (#15029)

## Summary

No change in behavior. This logic just isn't needed until the next
block, and as-written, it's hard to tell.
This commit is contained in:
Charlie Marsh 2025-08-02 14:08:49 -04:00 committed by GitHub
parent 3dc921d89c
commit 025d209735
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 9 deletions

View File

@ -629,15 +629,6 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
}
}
// If there are build settings or extra build dependencies, we need to scope to a cache shard.
let config_settings = self.config_settings_for(source.name());
let extra_build_deps = self.extra_build_dependencies_for(source.name());
let cache_shard = if config_settings.is_empty() && extra_build_deps.is_empty() {
cache_shard
} else {
cache_shard.shard(cache_digest(&(&config_settings, extra_build_deps)))
};
// Otherwise, we either need to build the metadata.
// If the backend supports `prepare_metadata_for_build_wheel`, use it.
if let Some(metadata) = self
@ -674,6 +665,15 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
});
}
// If there are build settings or extra build dependencies, we need to scope to a cache shard.
let config_settings = self.config_settings_for(source.name());
let extra_build_deps = self.extra_build_dependencies_for(source.name());
let cache_shard = if config_settings.is_empty() && extra_build_deps.is_empty() {
cache_shard
} else {
cache_shard.shard(cache_digest(&(&config_settings, extra_build_deps)))
};
let task = self
.reporter
.as_ref()