Skip to content

Commit

Permalink
refactor: move config to repodata functions
Browse files Browse the repository at this point in the history
This makes the `project` module entirely independent of anything in the
main pixi crate.

This makes moving a lot simpler, which allows us to use it in pixi build
  • Loading branch information
tdejager committed Aug 2, 2024
1 parent 436bd94 commit c1f8392
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 25 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ rattler_repodata_gateway = { workspace = true, features = [
rattler_shell = { workspace = true, features = ["sysinfo"] }
rattler_solve = { workspace = true, features = ["resolvo", "serde"] }

pixi_config = { workspace = true }
pixi_config = { workspace = true, features = ["gateway-conversion"] }
pixi_consts = { workspace = true }
pixi_default_versions = { workspace = true }
pixi_manifest = { workspace = true }
Expand Down
4 changes: 4 additions & 0 deletions crates/pixi_config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ readme.workspace = true
repository.workspace = true
version = "0.1.0"

[features]
gateway-conversion = ["dep:rattler_repodata_gateway"]

[dependencies]
clap = { workspace = true, features = ["std", "derive", "env"] }
console = { workspace = true }
Expand All @@ -18,6 +21,7 @@ miette = { workspace = true }
pixi_consts = { workspace = true }
rattler = { workspace = true }
rattler_conda_types = { workspace = true }
rattler_repodata_gateway = { workspace = true, optional = true }
serde = { workspace = true }
serde_ignored = { workspace = true }
serde_json = { workspace = true }
Expand Down
3 changes: 3 additions & 0 deletions crates/pixi_config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ use rattler_conda_types::{
use serde::{de::IntoDeserializer, Deserialize, Serialize};
use url::Url;

#[cfg(feature = "gateway-conversion")]
pub mod gateway;

Check failure on line 22 in crates/pixi_config/src/lib.rs

View workflow job for this annotation

GitHub Actions / Cargo Lint

file not found for module `gateway`

Check failure on line 22 in crates/pixi_config/src/lib.rs

View workflow job for this annotation

GitHub Actions / Check intra-doc links

file not found for module `gateway`

/// TODO: maybe remove this duplicate from `src/util.rs` at some point
pub fn default_channel_config() -> ChannelConfig {
ChannelConfig::default_with_root_dir(
Expand Down
2 changes: 1 addition & 1 deletion src/cli/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ use rattler_solve::{resolvo::Solver, SolverImpl, SolverTask};
use rattler_virtual_packages::VirtualPackage;
use reqwest_middleware::ClientWithMiddleware;

use crate::utils::config::from_pixi_config;
use crate::{
prefix::Prefix,
progress::{await_in_progress, global_multi_progress, wrap_in_progress},
utils::{reqwest::build_reqwest_clients, PrefixGuard},
};
use pixi_config::gateway::from_pixi_config;
use pixi_config::{self, Config, ConfigCli};

/// Run a command in a temporary environment.
Expand Down
2 changes: 1 addition & 1 deletion src/project/repodata.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::project::Project;

use crate::utils::config::from_pixi_config;
use pixi_config::gateway::from_pixi_config;
use rattler_repodata_gateway::Gateway;
use std::path::PathBuf;

Expand Down
21 changes: 0 additions & 21 deletions src/utils/config.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/utils/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pub mod conda_environment_file;
pub(crate) mod config;
mod defaults;
pub mod indicatif;
mod prefix_guard;
Expand Down

0 comments on commit c1f8392

Please sign in to comment.