Skip to content

Commit

Permalink
Add platform arg
Browse files Browse the repository at this point in the history
  • Loading branch information
olivier-lacroix committed Aug 12, 2024
1 parent 4c21e8a commit d0497dd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/cli/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rattler::{
install::{IndicatifReporter, Installer},
package_cache::PackageCache,
};
use rattler_conda_types::{MatchSpec, PackageName};
use rattler_conda_types::{MatchSpec, PackageName, Platform};
use reqwest_middleware::ClientWithMiddleware;

use crate::{cli::global::common::solve_package_records, prefix::Prefix};
Expand Down Expand Up @@ -162,7 +162,8 @@ pub async fn create_exec_prefix(

// Solve the environment
let channels = args.channels.resolve_from_config(config);
let solved_records = solve_package_records(&gateway, channels, specs.clone()).await?;
let solved_records =
solve_package_records(&gateway, Platform::current(), channels, specs.clone()).await?;

// Install the environment
tracing::info!(
Expand Down
8 changes: 3 additions & 5 deletions src/cli/global/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ pub(super) fn channel_name_from_prefix(
/// MatchSpec
pub async fn solve_package_records<AsChannel, ChannelIter>(
gateway: &Gateway,
platform: Platform,
channels: ChannelIter,
specs: Vec<MatchSpec>,
) -> miette::Result<Vec<RepoDataRecord>>
Expand All @@ -135,11 +136,7 @@ where
// Get the repodata for the specs
let repodata = await_in_progress("fetching repodata for environment", |_| async {
gateway
.query(
channels,
[Platform::current(), Platform::NoArch],
specs.clone(),
)
.query(channels, [platform, Platform::NoArch], specs.clone())
.recursive(true)
.execute()
.await
Expand All @@ -149,6 +146,7 @@ where
.context("failed to get repodata")?;

// Determine virtual packages of the current platform
// We cannot infer virtual_packages for another platform
let virtual_packages = VirtualPackage::current()
.into_diagnostic()
.context("failed to determine virtual packages")?
Expand Down
9 changes: 7 additions & 2 deletions src/cli/global/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,13 @@ pub async fn execute(args: Args) -> miette::Result<()> {
// Install the package(s)
let mut executables = vec![];
for (package_name, package_matchspec) in specs {
let records =
solve_package_records(&gateway, channels.clone(), vec![package_matchspec]).await?;
let records = solve_package_records(
&gateway,
args.platform,
channels.clone(),
vec![package_matchspec],
)
.await?;

let (prefix_package, scripts, _) =
globally_install_package(&package_name, records, client.clone(), args.platform).await?;
Expand Down

0 comments on commit d0497dd

Please sign in to comment.