From 91730018dd181b6855c0be4d1ba906b50b0dcc2e Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Thu, 5 Sep 2024 21:13:45 +0200 Subject: [PATCH] fix: faster with rattler-build not installing --- Cargo.toml | 6 ++--- crates/pixi-build-python/src/main.rs | 39 ++++++++++++---------------- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 26c20a2..d42ee75 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,9 +24,9 @@ jsonrpc-stdio-server = "18.0.0" jsonrpc-http-server = "18.0.0" jsonrpc-core = "18.0.0" -rattler-build = { git = "https://github.com/prefix-dev/rattler-build", branch = "main", default-features = false } -rattler_conda_types = "0.27.4" -rattler_package_streaming = "0.22.5" +rattler-build = { git = "https://github.com/baszalmstra/rattler-build", branch = "refactor/seperate_solve", default-features = false } +rattler_conda_types = "0.27.5" +rattler_package_streaming = "0.22.6" pixi_build_types = { path="../pixi-build-branch/crates/pixi_build_types" } pixi_consts = { path="../pixi-build-branch/crates/pixi_consts" } diff --git a/crates/pixi-build-python/src/main.rs b/crates/pixi-build-python/src/main.rs index c6e155a..c421c4e 100644 --- a/crates/pixi-build-python/src/main.rs +++ b/crates/pixi-build-python/src/main.rs @@ -37,27 +37,26 @@ use rattler_build::{ Recipe, }, render::resolved_dependencies::DependencyInfo, - tool_configuration::{Configuration, SkipExisting}, + tool_configuration::Configuration, }; use rattler_conda_types::{ - package::ArchiveType, ChannelConfig, MatchSpec, NoArchType, PackageName, Platform, + package::ArchiveType, ChannelConfig, MatchSpec, NoArchType, PackageName, Platform, Version, VersionWithSource, }; use rattler_package_streaming::write::CompressionLevel; -use reqwest::{Client, Url}; +use reqwest::Url; use tempfile::tempdir; use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt}; #[allow(missing_docs)] #[derive(Parser)] -#[clap(version)] pub struct App { #[clap(subcommand)] command: Option, /// The port to expose the json-rpc server on. If not specified will /// communicate with stdin/stdout. - #[clap(long, conflicts_with = "command")] + #[clap(long)] http_port: Option, /// Enable verbose logging. @@ -309,7 +308,7 @@ async fn get_conda_metadata_from_manifest( .collect(), license: output.recipe.about.license.map(|l| l.to_string()), license_family: output.recipe.about.license_family, - noarch: output.recipe.build.noarch + noarch: output.recipe.build.noarch, }], }) } @@ -363,18 +362,10 @@ fn get_tool_configuration( logging_output_handler: LoggingOutputHandler, channel_config: &ChannelConfig, ) -> miette::Result { - Ok(Configuration { - fancy_log_handler: logging_output_handler, - client: reqwest_middleware::ClientWithMiddleware::from(Client::default()), - no_clean: false, - no_test: false, - use_zstd: true, - use_bz2: true, - render_only: false, - skip_existing: SkipExisting::None, - channel_config: channel_config.clone(), - compression_threads: None, - }) + Ok(Configuration::builder() + .with_logging_output_handler(logging_output_handler) + .with_channel_config(channel_config.clone()) + .finish()) } async fn manifest_to_build_configuration( @@ -447,10 +438,14 @@ fn manifest_to_recipe( }; let name = PackageName::from_str(&name).into_diagnostic()?; - // Parse the package version from the manifest - let Some(version) = manifest.parsed.project.version.clone() else { - miette::bail!("a 'version' field is required in the project manifest"); - }; + // Parse the package version from the manifest. The version is optional, so we + // default to "0dev0" if it is not present. + let version = manifest + .parsed + .project + .version + .clone() + .unwrap_or_else(|| Version::from_str("0dev0").unwrap()); // TODO: NoArchType??? let noarch_type = NoArchType::python();