Skip to content

Commit

Permalink
refactor: update for reuse (prefix-dev#1426)
Browse files Browse the repository at this point in the history
  • Loading branch information
baszalmstra authored May 22, 2024
1 parent 1e22646 commit e80d097
Show file tree
Hide file tree
Showing 5 changed files with 814 additions and 624 deletions.
3 changes: 1 addition & 2 deletions src/cli/global/install.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::ffi::OsStr;
use std::path::{Path, PathBuf};
use std::sync::Arc;

use crate::cli::has_specs::HasSpecs;
use crate::config::{Config, ConfigCli};
Expand Down Expand Up @@ -348,7 +347,7 @@ pub(super) async fn globally_install_package(

// Execute the transaction if there is work to do
if has_transactions {
let package_cache = Arc::new(PackageCache::new(config::get_cache_dir()?.join("pkgs")));
let package_cache = PackageCache::new(config::get_cache_dir()?.join("pkgs"));

// Execute the operations that are returned by the solver.
await_in_progress("creating virtual environment", |pb| {
Expand Down
6 changes: 3 additions & 3 deletions src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use rattler_conda_types::{Platform, PrefixRecord, RepoDataRecord};
use rattler_lock::{PypiPackageData, PypiPackageEnvironmentData};
use reqwest_middleware::ClientWithMiddleware;
use std::convert::identity;
use std::{collections::HashMap, io::ErrorKind, path::Path, sync::Arc};
use std::{collections::HashMap, io::ErrorKind, path::Path};

/// Verify the location of the prefix folder is not changed so the applied prefix path is still valid.
/// Errors when there is a file system error or the path does not align with the defined prefix.
Expand Down Expand Up @@ -262,7 +262,7 @@ pub async fn update_prefix_pypi(
pypi_records: &[(PypiPackageData, PypiPackageEnvironmentData)],
status: &PythonStatus,
system_requirements: &SystemRequirements,
uv_context: UvResolutionContext,
uv_context: &UvResolutionContext,
pypi_options: &PypiOptions,
environment_variables: &HashMap<String, String>,
lock_file_dir: &Path,
Expand Down Expand Up @@ -441,7 +441,7 @@ impl PythonStatus {
pub async fn update_prefix_conda(
environment_name: GroupedEnvironmentName,
prefix: &Prefix,
package_cache: Arc<PackageCache>,
package_cache: PackageCache,
authenticated_client: ClientWithMiddleware,
installed_packages: Vec<PrefixRecord>,
repodata_records: &[RepoDataRecord],
Expand Down
3 changes: 1 addition & 2 deletions src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ use rattler_conda_types::{PrefixRecord, RepoDataRecord};
use reqwest_middleware::ClientWithMiddleware;
use std::cmp::Ordering;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use std::time::Duration;

/// Executes the transaction on the given environment.
pub async fn execute_transaction(
package_cache: Arc<PackageCache>,
package_cache: PackageCache,
transaction: &Transaction<PrefixRecord, RepoDataRecord>,
prefix_records: &[PrefixRecord],
target_prefix: PathBuf,
Expand Down
4 changes: 2 additions & 2 deletions src/install_pypi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ pub async fn update_python_distributions(
python_packages: &[CombinedPypiPackageData],
python_interpreter_path: &Path,
system_requirements: &SystemRequirements,
uv_context: UvResolutionContext,
uv_context: &UvResolutionContext,
pypi_options: &PypiOptions,
environment_variables: &HashMap<String, String>,
platform: Platform,
Expand Down Expand Up @@ -774,7 +774,7 @@ pub async fn update_python_distributions(
lock_file_dir,
editables,
&site_packages,
&uv_context,
uv_context,
&tags,
&registry_client,
&build_dispatch,
Expand Down
Loading

0 comments on commit e80d097

Please sign in to comment.