Avoid displaying log for satisfied editables if none are requested (#3795)

e.g. in `uv pip install anyio -v` this message is just noise

```
DEBUG Requirement satisfied: anyio
DEBUG Requirement satisfied: idna>=2.8
DEBUG Requirement satisfied: sniffio>=1.1
DEBUG All editables satisfied: 
```
This commit is contained in:
Zanie Blue
2024-05-23 11:07:35 -04:00
committed by GitHub
parent 306a4d7ce3
commit d2a9192e39
2 changed files with 17 additions and 14 deletions
+10 -8
View File
@@ -159,9 +159,9 @@ pub(crate) async fn pip_install(
// Determine the set of installed packages.
let site_packages = SitePackages::from_executable(&venv)?;
// If the requirements are already satisfied, we're done. Ideally, the resolver would be fast
// enough to let us remove this check. But right now, for large environments, it's an order of
// magnitude faster to validate the environment than to resolve the requirements.
// Check if the current environment satisfies the requirements.
// Ideally, the resolver would be fast enough to let us remove this check. But right now, for large environments,
// it's an order of magnitude faster to validate the environment than to resolve the requirements.
if reinstall.is_none()
&& upgrade.is_none()
&& source_trees.is_empty()
@@ -169,6 +169,7 @@ pub(crate) async fn pip_install(
&& uv_lock.is_none()
{
match site_packages.satisfies(&requirements, &editables, &constraints)? {
// If the requirements are already satisfied, we're done.
SatisfiesResult::Fresh {
recursive_requirements,
} => {
@@ -181,11 +182,12 @@ pub(crate) async fn pip_install(
debug!("Requirement satisfied: {requirement}");
}
}
debug!(
"All editables satisfied: {}",
editables.iter().map(ToString::to_string).join(" | ")
);
if !editables.is_empty() {
debug!(
"All editables satisfied: {}",
editables.iter().map(ToString::to_string).join(" | ")
);
}
let num_requirements = requirements.len() + editables.len();
let s = if num_requirements == 1 { "" } else { "s" };
writeln!(
+7 -6
View File
@@ -114,10 +114,9 @@ pub(crate) async fn update_environment(
// Check if the current environment satisfies the requirements
let site_packages = SitePackages::from_executable(&venv)?;
// If the requirements are already satisfied, we're done.
if spec.source_trees.is_empty() {
match site_packages.satisfies(&spec.requirements, &spec.editables, &spec.constraints)? {
// If the requirements are already satisfied, we're done.
SatisfiesResult::Fresh {
recursive_requirements,
} => {
@@ -129,10 +128,12 @@ pub(crate) async fn update_environment(
.sorted()
.join(" | ")
);
debug!(
"All editables satisfied: {}",
spec.editables.iter().map(ToString::to_string).join(", ")
);
if !spec.editables.is_empty() {
debug!(
"All editables satisfied: {}",
spec.editables.iter().map(ToString::to_string).join(", ")
);
}
return Ok(venv);
}
SatisfiesResult::Unsatisfied(requirement) => {