Skip to content

Commit

Permalink
feat: work on extracting dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
tdejager committed Jul 30, 2024
1 parent 44f341d commit 9a6294f
Showing 1 changed file with 35 additions and 5 deletions.
40 changes: 35 additions & 5 deletions crates/pixi-build-python/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use std::{collections::BTreeMap, path::PathBuf, sync::Arc};

use clap::Parser;
use pixi_manifest::TargetSelector::Platform;
use pixi_manifest::{FeatureName, Manifest, SpecType};
use rattler_build::recipe::parser::{Build, Requirements};
use rattler_build::{
hash::HashInfo,
metadata::{BuildConfiguration, Directories, Output, PackagingSettings},
Expand All @@ -12,8 +14,7 @@ use rattler_build::{
Recipe,
},
};
use rattler_build::recipe::parser::{Build, Requirements};
use rattler_conda_types::{package::ArchiveType, NoArchType};
use rattler_conda_types::{package::ArchiveType, MatchSpec, NoArchType};

Check failure on line 17 in crates/pixi-build-python/src/main.rs

View workflow job for this annotation

GitHub Actions / Format and Lint

unused import: `MatchSpec`
use rattler_package_streaming::write::CompressionLevel;

#[allow(missing_docs)]
Expand All @@ -25,9 +26,39 @@ pub struct App {
manifest_path: PathBuf,
}

/// Get the requirements for a default feature
fn requirements_from_manifest(manifest: &Manifest) -> Requirements {
let mut requirements = Requirements::default();
let default_features = manifest
.default_environment()
.features
.iter()
.filter_map(|e| manifest.feature(&FeatureName::Named(e.clone())))
.collect::<Vec<_>>();

// Get all different feature types
let run_dependencies = default_features

Check failure on line 40 in crates/pixi-build-python/src/main.rs

View workflow job for this annotation

GitHub Actions / Format and Lint

unused variable: `run_dependencies`
.iter()
.filter_map(|f| f.dependencies(Some(SpecType::Run), None))
.collect::<Vec<_>>();
let host_dependencies = default_features
.iter()
.filter_map(|f| f.dependencies(Some(SpecType::Run), None))
.collect::<Vec<_>>();
let build_dependencies = default_features
.iter()
.filter_map(|f| f.dependencies(Some(SpecType::Run), None))
.collect::<Vec<_>>();

requirements
}

fn main() {
let args = App::parse();

let manifest = Manifest::from_path(args.manifest_path).expect("could not load manifest");
requirements_from_manifest(&manifest);

// Load the manifest
eprintln!("Looking for manifest at {:?}", args.manifest_path);

Expand Down Expand Up @@ -63,9 +94,8 @@ fn main() {
build: Build {

Check failure on line 94 in crates/pixi-build-python/src/main.rs

View workflow job for this annotation

GitHub Actions / Format and Lint

cannot construct `rattler_build::recipe::parser::Build` with struct literal syntax due to private fields
// TODO:
},
requirements: Requirements {

},
// TODO read from manifest
requirements: Requirements {},

Check failure on line 98 in crates/pixi-build-python/src/main.rs

View workflow job for this annotation

GitHub Actions / Format and Lint

missing fields `build`, `host`, `ignore_run_exports` and 3 other fields in initializer of `rattler_build::recipe::parser::Requirements`
tests: vec![],
about: Default::default(),
extra: Default::default(),
Expand Down

0 comments on commit 9a6294f

Please sign in to comment.