Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
prsabahrami committed Sep 6, 2024
1 parent 62ec962 commit b7abd97
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
14 changes: 7 additions & 7 deletions extractor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ edition = "2021"
[dependencies]
anyhow = "1.*"
futures = "0.3.30"
rattler = { version = "0.27.5", default-features = false }
rattler = { version = "0.27.6", default-features = false }
rattler_digest = "1.0.1"
rattler_conda_types = "0.27.2"
rattler_index = "0.19.24"
rattler_lock = "0.22.20"
rattler_networking = { version = "0.21.1", default-features = false }
rattler_package_streaming = { version = "0.22.3", default-features = false }
rattler_shell = "0.21.6"
reqwest = { version = "0.12.5", default-features = false, features = [
reqwest = { version = "0.12.7", default-features = false, features = [
"http2",
"macos-system-configuration",
] }
reqwest-middleware = "0.3.2"
serde = { version = "1.0.204", features = ["derive"] }
serde_json = "1.0.121"
reqwest-middleware = "0.3.3"
serde = { version = "1.0.209", features = ["derive"] }
serde_json = "1.0.127"
serde_yaml = "0.9.34"
tokio = { version = "1.39.2", features = ["rt-multi-thread"] }
tokio = { version = "1.40.0", features = ["rt-multi-thread"] }
tokio-stream = { version = "0.1.15", features = ["fs"] }
url = "2.5.2"
fxhash = "0.2.1"
tempfile = "3.10.1"
tempfile = "3.12.0"

[dev-dependencies]
rstest = "0.22.0"
34 changes: 19 additions & 15 deletions extractor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use tokio_stream::wrappers::ReadDirStream;

use anyhow::anyhow;
use anyhow::Result;
use futures::{stream, StreamExt, TryStreamExt};
use futures::{stream, StreamExt, TryFutureExt, TryStreamExt};
use rattler::{
install::Installer,
package_cache::{CacheKey, PackageCache},
Expand Down Expand Up @@ -60,11 +60,12 @@ async fn main() -> Result<()> {
/// Unpack a pixi environment from a directory
pub async fn unpack(archive_dir: &Path, output_dir: &Path) -> Result<()> {
let channel_directory = archive_dir.join(std::env::var("PIXI_PACK_CHANNEL_DIRECTORY").unwrap());
let cache_dir = archive_dir.join("cache");

validate_metadata_file(archive_dir.join(std::env::var("PIXI_PACK_METADATA_PATH").unwrap()))
.await?;

create_prefix(&channel_directory, output_dir)
create_prefix(&channel_directory, output_dir, &cache_dir)
.await
.map_err(|e| anyhow!("Could not create prefix: {}", e))?;

Expand Down Expand Up @@ -136,20 +137,16 @@ async fn collect_packages(channel_dir: &Path) -> Result<FxHashMap<String, Packag
Ok(packages)
}

async fn create_prefix(channel_dir: &Path, target_prefix: &Path) -> Result<()> {
async fn create_prefix(channel_dir: &Path, target_prefix: &Path, cache_dir: &Path) -> Result<()> {
let packages = collect_packages(channel_dir)
.await
.map_err(|e| anyhow!("could not collect packages: {}", e))?;

let cache_dir = tempfile::tempdir()
.map_err(|e| anyhow!("could not create temporary directory: {}", e))?
.into_path();

eprintln!(
"⏳ Extracting and installing {} packages...",
packages.len()
"⏳ Extracting and installing {} packages to {}...",
packages.len(),
cache_dir.display()
);

// extract packages to cache
let package_cache = PackageCache::new(cache_dir);

Expand All @@ -175,13 +172,20 @@ async fn create_prefix(channel_dir: &Path, target_prefix: &Path) -> Result<()> {
package_cache
.get_or_fetch(
cache_key,
|destination| async move {
extract(&package_path, &destination).map(|_| ())
move |destination| {
let package_path_clone = package_path.clone();
async move { extract(&package_path_clone, &destination).map(|_| ()) }
},
None,
)
.await
.map_err(|e| anyhow!("could not extract package: {}", e))?;
.map_err(|e| {
anyhow!(
"could not extract \"{}\": {}",
repodata_record.as_ref().name.as_source(),
e
)
})?;

Ok::<RepoDataRecord, anyhow::Error>(repodata_record)
}
Expand All @@ -204,8 +208,8 @@ async fn create_prefix(channel_dir: &Path, target_prefix: &Path) -> Result<()> {
history_path,
"// not relevant for pixi but for `conda run -p`",
)
.await
.map_err(|e| anyhow!("Could not write history file: {}", e))?;
.map_err(|e| anyhow!("Could not write history file: {}", e))
.await?;

Ok(())
}
Expand Down

0 comments on commit b7abd97

Please sign in to comment.