Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
958 changes: 518 additions & 440 deletions Cargo.lock

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ serde-value = "0.7.0"
serde_derive = "*"
serde_ignored = "0.1.10"
serde_json = "1.0.139"
serde_with = "=3.16.1"
serde_with = "3.18.0"
serde_yaml = "0.9.34"
sevenz-rust2 = "0.20.0"
shlex = "1.3.0"
Expand Down Expand Up @@ -220,30 +220,30 @@ zstd = { version = "0.13.3", default-features = false }
# Rattler crates
coalesced_map = "0.1.2"
file_url = "0.2.7"
rattler = { version = "0.39.15", default-features = false }
rattler = { version = "0.40.0", default-features = false }
rattler_cache = { version = "0.6.14", default-features = false }
rattler_conda_types = { version = "0.43.5", default-features = false, features = [
rattler_conda_types = { version = "0.44.0", default-features = false, features = [
"rayon",
] }
rattler_digest = { version = "1.2.2", default-features = false }
rattler_lock = { version = "0.26.16", default-features = false }
rattler_lock = { version = "0.27.0", default-features = false }
rattler_menuinst = { version = "0.2.49", default-features = false }
rattler_networking = { version = "0.26.2", default-features = false, features = [
"dirs",
"google-cloud-auth",
] }
rattler_package_streaming = { version = "0.24.2", default-features = false }
rattler_repodata_gateway = { version = "0.26.2", default-features = false }
rattler_repodata_gateway = { version = "0.27.0", default-features = false }
rattler_shell = { version = "0.26.2", default-features = false }
rattler_solve = { version = "4.2.6", default-features = false }
rattler_upload = { version = "0.4.15", default-features = false, features = [
rattler_solve = { version = "5.0.0", default-features = false }
rattler_upload = { version = "0.5.0", default-features = false, features = [
"s3",
] }
rattler_virtual_packages = { version = "2.3.11", default-features = false }
simple_spawn_blocking = { version = "1.1.0", default-features = false }

# Rattler build crates
rattler_build_core = { version = "0.1.0", default-features = false, features = [
rattler_build_core = { version = "0.2.0", default-features = false, features = [
"s3",
] }
rattler_build_jinja = { version = "0.1.0" }
Expand Down
22 changes: 7 additions & 15 deletions crates/pixi_build_backend/src/dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl<'a> MatchspecExtractor<'a> {
.context("failed to convert variant to matchspec")?;
specs.push(MatchSpec::from_nameless(
spec,
Some(PackageNameMatcher::Exact(name)),
PackageNameMatcher::Exact(name),
));
continue;
}
Expand Down Expand Up @@ -184,7 +184,7 @@ fn convert_nameless_matchspec(spec: NamelessMatchSpec) -> pbt::BinaryPackageSpec
fn can_apply_variant(spec: &MatchSpec) -> Option<&PackageName> {
match &spec {
MatchSpec {
name: Some(name),
name,
version: None,
build: None,
build_number: None,
Expand Down Expand Up @@ -249,10 +249,7 @@ fn convert_dependency(
if let Some(source_package) =
spec.url.clone().and_then(from_source_url_to_source_package)
{
let Some(name_matcher) = spec.name else {
return Err(ConvertDependencyError::MissingName);
};
let Some(name) = name_matcher.as_exact() else {
let Some(name) = spec.name.as_exact() else {
return Err(ConvertDependencyError::MissingName);
};
return Ok(pbt::NamedSpec {
Expand Down Expand Up @@ -295,9 +292,7 @@ fn convert_dependency(
}
};

let (Some(name_matcher), spec) = match_spec.into_nameless() else {
return Err(ConvertDependencyError::MissingName);
};
let (name_matcher, spec) = match_spec.into_nameless();
let Some(name) = name_matcher.as_exact() else {
return Err(ConvertDependencyError::MissingName);
};
Expand Down Expand Up @@ -372,9 +367,7 @@ fn convert_constraint_dependency(
});
}

let (Some(name_matcher), spec) = match_spec.into_nameless() else {
return Err(ConvertDependencyError::MissingName);
};
let (name_matcher, spec) = match_spec.into_nameless();
let Some(name) = name_matcher.as_exact() else {
return Err(ConvertDependencyError::MissingName);
};
Expand Down Expand Up @@ -426,8 +419,7 @@ pub fn apply_variant(
if build_time
&& m.version.is_none()
&& m.build.is_none()
&& let Some(name_matcher) = &m.name
&& let Some(exact_name) = name_matcher.as_exact()
&& let Some(exact_name) = m.name.as_exact()
&& let Some(version) = variant.get(&exact_name.into())
{
// if the variant starts with an alphanumeric character,
Expand All @@ -445,7 +437,7 @@ pub fn apply_variant(
.parse()
.map_err(|e| ResolveError::VariantSpecParseError(variant.clone(), e))?;

let spec = MatchSpec::from_nameless(spec, Some(name_matcher.clone()));
let spec = MatchSpec::from_nameless(spec, exact_name.clone().into());

return Ok(VariantDependency { spec, variant }.into());
}
Expand Down
3 changes: 1 addition & 2 deletions crates/pixi_build_backend/src/intermediate_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use rattler_build_core::{
DiscoveredOutput,
build::{WorkingDirectoryBehavior, run_build},
console_utils::LoggingOutputHandler,
metadata::{BuildConfiguration, Debug, Output, PlatformWithVirtualPackages},
metadata::{BuildConfiguration, Output, PlatformWithVirtualPackages},
tool_configuration::Configuration,
types::{Directories, PackageIdentifier, PackagingSettings},
};
Expand Down Expand Up @@ -772,7 +772,6 @@ where
store_recipe: false,
force_colors: true,
sandbox_config: None,
debug: Debug::new(false),
exclude_newer: None,
},
finalized_dependencies: Some(from_build_v1_args_to_finalized_dependencies(
Expand Down
3 changes: 1 addition & 2 deletions crates/pixi_build_backend/src/rattler_build_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{collections::BTreeMap, path::PathBuf, str::FromStr, sync::Arc};
use miette::IntoDiagnostic;
use rattler_build_core::{
DiscoveredOutput,
metadata::{BuildConfiguration, Debug, Output, PlatformWithVirtualPackages},
metadata::{BuildConfiguration, Output, PlatformWithVirtualPackages},
render::resolved_dependencies::RunExportsDownload,
system_tools::SystemTools,
tool_configuration,
Expand Down Expand Up @@ -194,7 +194,6 @@ pub async fn get_build_output(
store_recipe: false,
force_colors: false,
sandbox_config: None,
debug: Debug::default(),
solve_strategy: Default::default(),
exclude_newer: None,
},
Expand Down
4 changes: 2 additions & 2 deletions crates/pixi_build_backend/src/specs_conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ pub(crate) fn source_package_spec_to_package_dependency(
source_spec: SourcePackageSpec,
) -> miette::Result<SourceMatchSpec> {
let spec = MatchSpec {
name: Some(PackageNameMatcher::Exact(name)),
name: PackageNameMatcher::Exact(name),
..Default::default()
};

Expand Down Expand Up @@ -214,7 +214,7 @@ fn binary_package_spec_to_package_dependency(
let version = version.filter(|v| v != &rattler_conda_types::VersionSpec::Any);

PackageDependency::Binary(MatchSpec {
name: Some(PackageNameMatcher::Exact(name)),
name: PackageNameMatcher::Exact(name),
version,
build,
build_number,
Expand Down
3 changes: 1 addition & 2 deletions crates/pixi_build_backend/src/tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use indexmap::IndexSet;
use miette::IntoDiagnostic;
use rattler_build_core::{
DiscoveredOutput,
metadata::{BuildConfiguration, Debug, Output, PlatformWithVirtualPackages},
metadata::{BuildConfiguration, Output, PlatformWithVirtualPackages},
system_tools::SystemTools,
types::{Directories, PackageIdentifier, PackagingSettings},
};
Expand Down Expand Up @@ -353,7 +353,6 @@ impl RattlerBuild {
store_recipe: false,
force_colors: true,
sandbox_config: None,
debug: Debug::new(false),
exclude_newer: None,
},
finalized_dependencies: None,
Expand Down
16 changes: 5 additions & 11 deletions crates/pixi_build_backend/src/traits/package_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ impl PackageSpec for pbt::PackageSpec {
// Always use to_nameless() to preserve all fields including build constraints
let match_spec = MatchSpec::from_nameless(
binary_spec.to_nameless(),
Some(PackageNameMatcher::Exact(name)),
PackageNameMatcher::Exact(name),
);
Ok((match_spec, None))
}
pbt::PackageSpec::Source(source_spec) => Ok((
MatchSpec {
name: Some(PackageNameMatcher::Exact(name)),
name: PackageNameMatcher::Exact(name),
..MatchSpec::default()
},
Some(source_spec.clone()),
Expand Down Expand Up @@ -174,9 +174,7 @@ mod tests {
// Verify the build constraint is preserved
assert_eq!(
match_spec.name,
Some(PackageNameMatcher::Exact(
PackageName::try_from("tk").unwrap()
))
PackageNameMatcher::Exact(PackageName::try_from("tk").unwrap())
);
assert_eq!(match_spec.version, Some(VersionSpec::Any));
assert_eq!(match_spec.build, Some(build_matcher));
Expand Down Expand Up @@ -209,9 +207,7 @@ mod tests {
// Verify both version and build constraint are preserved
assert_eq!(
match_spec.name,
Some(PackageNameMatcher::Exact(
PackageName::try_from("tk").unwrap()
))
PackageNameMatcher::Exact(PackageName::try_from("tk").unwrap())
);
assert_eq!(match_spec.version, Some(version));
assert_eq!(match_spec.build, Some(build_matcher));
Expand Down Expand Up @@ -242,9 +238,7 @@ mod tests {
// Verify the match spec is correct
assert_eq!(
match_spec.name,
Some(PackageNameMatcher::Exact(
PackageName::try_from("python").unwrap()
))
PackageNameMatcher::Exact(PackageName::try_from("python").unwrap())
);
assert_eq!(match_spec.version, Some(VersionSpec::Any));
assert_eq!(match_spec.build, None);
Expand Down
21 changes: 3 additions & 18 deletions crates/pixi_build_backend_passthrough/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,12 +648,7 @@ fn resolve_run_export_spec(
)
.ok()?;

let name = match_spec
.name
.as_ref()?
.as_exact()?
.as_source()
.to_string();
let name = match_spec.name.as_exact()?.as_source().to_string();

// Check if there's a variant value for this package
let version_spec = if match_spec
Expand Down Expand Up @@ -700,12 +695,7 @@ fn convert_run_exports_json(
)
.ok()?;

let name = match_spec
.name
.as_ref()?
.as_exact()?
.as_source()
.to_string();
let name = match_spec.name.as_exact()?.as_source().to_string();

Some(NamedSpec {
name: SourcePackageName::from(name),
Expand All @@ -728,12 +718,7 @@ fn convert_run_exports_json(
)
.ok()?;

let name = match_spec
.name
.as_ref()?
.as_exact()?
.as_source()
.to_string();
let name = match_spec.name.as_exact()?.as_source().to_string();

Some(NamedSpec {
name: SourcePackageName::from(name),
Expand Down
4 changes: 1 addition & 3 deletions crates/pixi_build_python/src/pypi_mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ impl MappedCondaDependency {
/// Convert to a conda MatchSpec.
pub fn to_match_spec(&self) -> MatchSpec {
MatchSpec {
name: Some(rattler_conda_types::PackageNameMatcher::Exact(
self.name.clone(),
)),
name: rattler_conda_types::PackageNameMatcher::Exact(self.name.clone()),
version: self.version_spec.clone(),
..Default::default()
}
Expand Down
3 changes: 1 addition & 2 deletions crates/pixi_build_rattler_build/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use rattler_build_core::{
DiscoveredOutput,
build::{WorkingDirectoryBehavior, run_build},
console_utils::LoggingOutputHandler,
metadata::{BuildConfiguration, Debug, Output, PlatformWithVirtualPackages},
metadata::{BuildConfiguration, Output, PlatformWithVirtualPackages},
tool_configuration::Configuration,
types::{PackageIdentifier, PackagingSettings},
};
Expand Down Expand Up @@ -431,7 +431,6 @@ impl Protocol for RattlerBuildBackend {
store_recipe: false,
force_colors: true,
sandbox_config: None,
debug: Debug::new(false),
exclude_newer: None,
},
finalized_dependencies: Some(from_build_v1_args_to_finalized_dependencies(
Expand Down
14 changes: 6 additions & 8 deletions crates/pixi_cli/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ pub async fn create_exec_prefix(
// try again without the guessed package (last spec)
let guessed_package_name = specs[specs.len() - 1]
.name
.as_ref()
.and_then(|name| name.as_exact().map(|n| n.as_source()))
.as_exact()
.map(|n| n.as_source())
.unwrap_or("<unknown>");
tracing::debug!(
"Solver failed with guessed package '{}', retrying without it: {}",
Expand Down Expand Up @@ -335,7 +335,7 @@ fn list_exec_environment(
specs
.clone()
.into_iter()
.filter_map(|spec| spec.name.and_then(|n| n.as_exact().cloned())) // Extract exact name if it exists
.filter_map(|spec| spec.name.as_exact().cloned()) // Extract exact name if it exists
.collect_vec()
.contains(&record.package_record.name),
)
Expand Down Expand Up @@ -374,11 +374,9 @@ fn guess_package_spec(command: &str) -> MatchSpec {
);

MatchSpec {
name: Some(
PackageName::from_str(&command)
.expect("all illegal characters were removed")
.into(),
),
name: PackageName::from_str(&command)
.expect("all illegal characters were removed")
.into(),
..Default::default()
}
}
Expand Down
3 changes: 2 additions & 1 deletion crates/pixi_cli/src/global/global_specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ impl GlobalSpecs {
.map(|spec_str| {
let name = MatchSpec::from_str(spec_str, ParseStrictness::Lenient)?
.name
.and_then(|matcher| matcher.as_exact().cloned())
.as_exact()
.cloned()
.ok_or(GlobalSpecsConversionError::NameRequired)?;
Ok(pixi_global::project::GlobalSpec::new(
name,
Expand Down
10 changes: 3 additions & 7 deletions crates/pixi_cli/src/global/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,9 @@ async fn sync_exposed_names(
.with
.iter()
.map(|spec| {
let name_matcher = spec.name.clone().ok_or_else(|| {
miette::miette!("could not find package name in MatchSpec {}", spec)
})?;
name_matcher
.as_exact()
.cloned()
.ok_or_else(|| miette::miette!("wildcard package names are not supported"))
spec.name.as_exact().cloned().ok_or_else(|| {
miette::miette!("could not find exact package name in MatchSpec {}", spec)
})
})
.collect::<miette::Result<Vec<_>>>()?;
let expose_type = if args.expose.is_empty().not() {
Expand Down
11 changes: 3 additions & 8 deletions crates/pixi_cli/src/global/remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,7 @@ pub async fn execute(args: Args) -> miette::Result<()> {
// Remove specs from the manifest
let mut removed_dependencies = vec![];
for spec in specs {
let package_name = spec
.name
.as_ref()
.expect("package name should be present")
.as_exact()
.expect("package name must be exact");
let package_name = spec.name.as_exact().expect("package name must be exact");
project
.manifest
.remove_dependency(env_name, package_name)
Expand All @@ -78,8 +73,8 @@ pub async fn execute(args: Args) -> miette::Result<()> {
let prefix = project.environment_prefix(env_name).await?;

for spec in specs {
if let Some(name_matcher) = spec.clone().name {
let name = name_matcher.as_exact().expect("package name must be exact");
{
let name = spec.name.as_exact().expect("package name must be exact");
// If the package is not existent, don't try to remove executables
if let Ok(record) = prefix.find_designated_package(name).await {
prefix
Expand Down
Loading
Loading