Skip to content

Commit 2defc88

Browse files
authored
fix: target specific inline variants (#4803)
1 parent e7f7aef commit 2defc88

File tree

1 file changed

+31
-38
lines changed
  • crates/pixi_core/src/workspace

1 file changed

+31
-38
lines changed

crates/pixi_core/src/workspace/mod.rs

Lines changed: 31 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,6 @@ pub struct Workspace {
172172
/// The concurrent request semaphore
173173
concurrent_downloads_semaphore: OnceCell<Arc<Semaphore>>,
174174

175-
variants: OnceCell<VariantConfig>,
176-
177175
/// Optional backend override for testing purposes
178176
backend_override: Option<BackendOverride>,
179177
}
@@ -246,7 +244,6 @@ impl Workspace {
246244
s3_config,
247245
repodata_gateway: Default::default(),
248246
concurrent_downloads_semaphore: OnceCell::default(),
249-
variants: OnceCell::default(),
250247
backend_override: None,
251248
}
252249
}
@@ -488,43 +485,39 @@ impl Workspace {
488485

489486
/// Returns the resolved variant configuration for a given platform.
490487
pub fn variants(&self, platform: Platform) -> Result<VariantConfig, VariantsError> {
491-
self.variants
492-
.get_or_try_init(|| {
493-
// Get inline variants for all targets
494-
let mut variants = BTreeMap::new();
495-
// Resolves from most specific to least specific.
496-
for build_variants in self
497-
.workspace
498-
.value
499-
.workspace
500-
.build_variants
501-
.resolve(Some(platform))
502-
.flatten()
503-
{
504-
// Update the hash map, but only items that are not already in the map.
505-
for (key, value) in build_variants {
506-
variants.entry(key.clone()).or_insert_with(|| value.clone());
507-
}
508-
}
488+
// Get inline variants for all targets
489+
let mut variants = BTreeMap::new();
490+
// Resolves from most specific to least specific.
491+
for build_variants in self
492+
.workspace
493+
.value
494+
.workspace
495+
.build_variants
496+
.resolve(Some(platform))
497+
.flatten()
498+
{
499+
// Update the hash map, but only items that are not already in the map.
500+
for (key, value) in build_variants {
501+
variants.entry(key.clone()).or_insert_with(|| value.clone());
502+
}
503+
}
509504

510-
// Collect absolute variant file paths without reading their content.
511-
let variant_files = self
512-
.workspace
513-
.value
514-
.workspace
515-
.build_variant_files
516-
.iter()
517-
.map(|source| match source {
518-
BuildVariantSource::File(path) => self.root.join(path),
519-
})
520-
.collect();
521-
522-
Ok(VariantConfig {
523-
variants,
524-
variant_files,
525-
})
505+
// Collect absolute variant file paths without reading their content.
506+
let variant_files = self
507+
.workspace
508+
.value
509+
.workspace
510+
.build_variant_files
511+
.iter()
512+
.map(|source| match source {
513+
BuildVariantSource::File(path) => self.root.join(path),
526514
})
527-
.cloned()
515+
.collect();
516+
517+
Ok(VariantConfig {
518+
variants,
519+
variant_files,
520+
})
528521
}
529522

530523
// /// Returns the reqwest client used for http networking

0 commit comments

Comments
 (0)