Skip to content

Commit

Permalink
Align with latest rattler version 0.9.0 (#350)
Browse files Browse the repository at this point in the history
Fix required changes to align with latest version of rattler.
  • Loading branch information
ruben-arts authored Sep 22, 2023
1 parent 4943582 commit 90b711d
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 66 deletions.
77 changes: 50 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 18 additions & 22 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ itertools = "0.11.0"
miette = { version = "5.10.0", features = ["fancy", "supports-color", "supports-hyperlinks", "supports-unicode", "terminal_size", "textwrap"] }
minijinja = { version = "1.0.7", features = ["builtins"] }
once_cell = "1.18.0"
rattler = { version = "0.8.0", default-features = false }
rattler_conda_types = { version = "0.8.0", default-features = false }
rattler_digest = { version = "0.8.0", default-features = false }
rattler_networking = { version = "0.8.0", default-features = false }
rattler_repodata_gateway = { version = "0.8.0", default-features = false, features = ["sparse"] }
rattler_shell = { version = "0.8.0", default-features = false, features = ["sysinfo"] }
rattler_solve = { version = "0.8.0", default-features = false, features = ["libsolv_rs"] }
rattler_virtual_packages = { version = "0.8.0", default-features = false }
rattler = { version = "0.9.0", default-features = false }
rattler_conda_types = { version = "0.9.0", default-features = false }
rattler_digest = { version = "0.9.0", default-features = false }
rattler_networking = { version = "0.9.0", default-features = false }
rattler_repodata_gateway = { version = "0.9.0", default-features = false, features = ["sparse"] }
rattler_shell = { version = "0.9.0", default-features = false, features = ["sysinfo"] }
rattler_solve = { version = "0.9.0", default-features = false, features = ["libsolv_rs"] }
rattler_virtual_packages = { version = "0.9.0", default-features = false }
reqwest = { version = "0.11.20", default-features = false }
serde = "1.0.188"
serde_json = "1.0.105"
Expand All @@ -58,21 +58,17 @@ tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
url = "2.4.1"

[dev-dependencies]
rattler_digest = "0.8.0"
rattler_digest = "0.9.0"
serde_json = "1.0.105"
tokio = { version = "1.32.0", features = ["rt"] }
toml = "0.7.6"

[patch.crates-io]
# Remove this once we created a new release of rattler (0.9.0).
rattler = { git = "https://github.com/mamba-org/rattler", branch = "main" }
rattler_conda_types = { git = "https://github.com/mamba-org/rattler", branch = "main" }
rattler_digest = { git = "https://github.com/mamba-org/rattler", branch = "main" }
rattler_networking = { git = "https://github.com/mamba-org/rattler", branch = "main" }
rattler_repodata_gateway = { git = "https://github.com/mamba-org/rattler", branch = "main" }
rattler_shell = { git = "https://github.com/mamba-org/rattler", branch = "main" }
rattler_solve = { git = "https://github.com/mamba-org/rattler", branch = "main" }
rattler_virtual_packages = { git = "https://github.com/mamba-org/rattler", branch = "main" }

# Remove this once https://github.com/idubrov/json-patch/pull/28 is merged and integrated into rattler.
json-patch = { git = "https://github.com/baszalmstra/json-patch", branch = "main" }
#[patch.crates-io]
#rattler = { git = "https://github.com/mamba-org/rattler", branch = "main" }
#rattler_conda_types = { git = "https://github.com/mamba-org/rattler", branch = "main" }
#rattler_digest = { git = "https://github.com/mamba-org/rattler", branch = "main" }
#rattler_networking = { git = "https://github.com/mamba-org/rattler", branch = "main" }
#rattler_repodata_gateway = { git = "https://github.com/mamba-org/rattler", branch = "main" }
#rattler_shell = { git = "https://github.com/mamba-org/rattler", branch = "main" }
#rattler_solve = { git = "https://github.com/mamba-org/rattler", branch = "main" }
#rattler_virtual_packages = { git = "https://github.com/mamba-org/rattler", branch = "main" }
13 changes: 1 addition & 12 deletions src/cli/auth.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
use std::path::PathBuf;

use clap::Parser;
use miette::IntoDiagnostic;
use rattler_networking::{Authentication, AuthenticationStorage};

fn default_authentication_storage() -> AuthenticationStorage {
AuthenticationStorage::new("rattler", &get_default_auth_store_location())
}

// moved into separate function to access from info command
pub fn get_default_auth_store_location() -> PathBuf {
dirs::home_dir().unwrap().join(".rattler")
}

#[derive(Parser, Debug)]
pub struct LoginArgs {
/// The host to authenticate with (e.g. repo.prefix.dev)
Expand Down Expand Up @@ -120,7 +109,7 @@ fn logout(args: LogoutArgs, storage: AuthenticationStorage) -> miette::Result<()
}

pub async fn execute(args: Args) -> miette::Result<()> {
let storage = default_authentication_storage();
let storage = AuthenticationStorage::default();

match args.subcommand {
Subcommand::Login(args) => login(args, storage),
Expand Down
5 changes: 3 additions & 2 deletions src/cli/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ use chrono::{DateTime, Local};
use clap::Parser;
use miette::IntoDiagnostic;
use rattler_conda_types::{GenericVirtualPackage, Platform};
use rattler_networking::AuthenticationStorage;
use rattler_virtual_packages::VirtualPackage;
use serde::Serialize;
use serde_with::serde_as;
use serde_with::DisplayFromStr;
use tokio::task::spawn_blocking;

use crate::progress::await_in_progress;
use crate::{cli::auth::get_default_auth_store_location, Project};
use crate::Project;

/// Information about the system and project
#[derive(Parser, Debug)]
Expand Down Expand Up @@ -219,7 +220,7 @@ pub async fn execute(args: Args) -> miette::Result<()> {
version: env!("CARGO_PKG_VERSION").to_string(),
cache_dir: Some(cache_dir),
cache_size,
auth_dir: get_default_auth_store_location(),
auth_dir: AuthenticationStorage::default().fallback_storage.path,
project_info,
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
source: src/project/manifest.rs
assertion_line: 430
expression: "examples.into_iter().map(|example|\n toml_edit::de::from_str::<ProjectManifest>(&format!(\"{PROJECT_BOILERPLATE}\\n{example}\")).unwrap_err().to_string()).collect::<Vec<_>>().join(\"\\n\")"
---
TOML parse error at line 8, column 9
|
8 | [target.foobar.dependencies]
| ^^^^^^
'foobar' is not a known platform. Valid platforms are 'noarch', 'unknown', 'linux-32', 'linux-64', 'linux-aarch64', 'linux-armv6l', 'linux-armv7l', 'linux-ppc64le', 'linux-ppc64', 'linux-s390x', 'linux-riscv32', 'linux-riscv64', 'osx-64', 'osx-arm64', 'win-32', 'win-64', 'win-arm64', 'emscripten-32'
'foobar' is not a known platform. Valid platforms are 'noarch', 'unknown', 'linux-32', 'linux-64', 'linux-aarch64', 'linux-armv6l', 'linux-armv7l', 'linux-ppc64le', 'linux-ppc64', 'linux-s390x', 'linux-riscv32', 'linux-riscv64', 'osx-64', 'osx-arm64', 'win-32', 'win-64', 'win-arm64', 'emscripten-wasm32', 'wasi-wasm32'
5 changes: 4 additions & 1 deletion src/virtual_packages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ pub fn non_relevant_virtual_packages_for_platform(
|| matches!(requirement, VirtualPackage::Osx(_))
|| matches!(requirement, VirtualPackage::Linux(_))
}
Platform::NoArch | Platform::Emscripten32 | Platform::Unknown => false,
Platform::NoArch
| Platform::Unknown
| Platform::EmscriptenWasm32
| Platform::WasiWasm32 => false,
}
}

Expand Down
1 change: 1 addition & 0 deletions tests/common/package_database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ impl PackageDatabase {
let repodata = RepoData {
info: Some(ChannelInfo {
subdir: platform.to_string(),
base_url: None,
}),
packages: self
.packages_by_platform(platform)
Expand Down

0 comments on commit 90b711d

Please sign in to comment.