Skip to content

Commit

Permalink
Improve error message if dependency installation in tidy fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Kobzol committed Jun 12, 2024
1 parent 1d43fbb commit 9bba39c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/tools/tidy/src/ext_tool_checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,18 @@ fn create_venv_at_path(path: &Path) -> Result<(), Error> {
if out.status.success() {
return Ok(());
}
let err = if String::from_utf8_lossy(&out.stderr).contains("No module named virtualenv") {

let stderr = String::from_utf8_lossy(&out.stderr);
let err = if stderr.contains("No module named virtualenv") {
Error::Generic(format!(
"virtualenv not found: you may need to install it \
(`python3 -m pip install venv`)"
))
} else {
Error::Generic(format!("failed to create venv at '{}' using {sys_py}", path.display()))
Error::Generic(format!(
"failed to create venv at '{}' using {sys_py}: {stderr}",
path.display()
))
};
Err(err)
}
Expand Down

0 comments on commit 9bba39c

Please sign in to comment.