Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: color environment name in install step #795

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 40 additions & 28 deletions src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ impl Project {
#[allow(clippy::too_many_arguments)]
// TODO: refactor args into struct
pub async fn update_prefix_pypi(
name: &str,
environment_name: &EnvironmentName,
prefix: &Prefix,
platform: Platform,
package_db: Arc<PackageDb>,
Expand All @@ -238,18 +238,24 @@ pub async fn update_prefix_pypi(
install_pypi::remove_old_python_distributions(prefix, platform, status)?;

// Install and/or remove python packages
progress::await_in_progress(format!("updating pypi package in '{}'", name), |_| {
install_pypi::update_python_distributions(
package_db,
prefix,
conda_records,
pypi_records,
platform,
status,
system_requirements,
sdist_resolution,
)
})
progress::await_in_progress(
format!(
"updating pypi package in '{}'",
environment_name.fancy_display()
),
|_| {
install_pypi::update_python_distributions(
package_db,
prefix,
conda_records,
pypi_records,
platform,
status,
system_requirements,
sdist_resolution,
)
},
)
.await
}

Expand Down Expand Up @@ -309,7 +315,7 @@ impl PythonStatus {

/// Updates the environment to contain the packages from the specified lock-file
pub async fn update_prefix_conda(
name: &str,
environment_name: &EnvironmentName,
prefix: &Prefix,
package_cache: Arc<PackageCache>,
authenticated_client: ClientWithMiddleware,
Expand All @@ -329,17 +335,23 @@ pub async fn update_prefix_conda(
// Execute the transaction if there is work to do
if !transaction.operations.is_empty() {
// Execute the operations that are returned by the solver.
progress::await_in_progress(format!("updating packages in '{}'", name), |pb| async {
install::execute_transaction(
package_cache,
&transaction,
&installed_packages,
prefix.root().to_path_buf(),
authenticated_client,
pb,
)
.await
})
progress::await_in_progress(
format!(
"updating packages in '{}'",
environment_name.fancy_display()
),
|pb| async {
install::execute_transaction(
package_cache,
&transaction,
&installed_packages,
prefix.root().to_path_buf(),
authenticated_client,
pb,
)
.await
},
)
.await?;
}

Expand Down Expand Up @@ -387,7 +399,7 @@ impl<'p> LockFileDerivedData<'p> {

// Update the prefix with Pypi records
update_prefix_pypi(
environment.name().as_str(),
environment.name(),
&prefix,
platform,
package_db,
Expand Down Expand Up @@ -460,7 +472,7 @@ impl<'p> LockFileDerivedData<'p> {

// Update the prefix with conda packages.
let python_status = update_prefix_conda(
environment.name().as_str(),
environment.name(),
&prefix,
self.package_cache.clone(),
environment.project().authenticated_client().clone(),
Expand Down Expand Up @@ -1616,7 +1628,7 @@ async fn spawn_create_prefix_task(
let environment_name = environment_name.clone();
async move {
update_prefix_conda(
environment_name.as_str(),
&environment_name,
&prefix,
package_cache,
client,
Expand Down
Loading