-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
155b782
commit 4af492f
Showing
5 changed files
with
94 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
use clap::Parser; | ||
|
||
mod common; | ||
pub mod common; | ||
mod install; | ||
mod list; | ||
mod remove; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,11 @@ | ||
use crate::project::Project; | ||
|
||
use rattler_repodata_gateway::Gateway; | ||
use std::path::PathBuf; | ||
|
||
impl Project { | ||
/// Returns the [`Gateway`] used by this project. | ||
pub fn repodata_gateway(&self) -> &Gateway { | ||
self.repodata_gateway.get_or_init(|| { | ||
// Determine the cache directory and fall back to sane defaults otherwise. | ||
let cache_dir = pixi_config::get_cache_dir().unwrap_or_else(|e| { | ||
tracing::error!("failed to determine repodata cache directory: {e}"); | ||
std::env::current_dir().unwrap_or_else(|_| PathBuf::from("./")) | ||
}); | ||
|
||
// Construct the gateway | ||
Gateway::builder() | ||
.with_client(self.authenticated_client().clone()) | ||
.with_cache_dir(cache_dir.join("repodata")) | ||
.with_channel_config(self.config().into()) | ||
.finish() | ||
}) | ||
self.repodata_gateway | ||
.get_or_init(|| self.config.gateway(self.authenticated_client().clone())) | ||
} | ||
} |