Use a cross-platform representation for relative paths in pip compile (#3804)

## Summary

I haven't tested on Windows yet, but the idea here is that we should use
a portable representation when printing paths.

I decided to limit the scope here to paths that we write to output
files.

Closes https://github.com/astral-sh/uv/issues/3800.
This commit is contained in:
Charlie Marsh
2024-05-23 23:02:42 -04:00
committed by GitHub
parent a7d486bc71
commit 8d566e553d
10 changed files with 75 additions and 26 deletions
+1 -7
View File
@@ -1256,17 +1256,11 @@ impl fmt::Display for InterpreterNotFound {
path.user_display()
),
Self::ExecutableNotFoundInDirectory(directory, executable) => {
let executable = if let Ok(relative_executable) = executable.strip_prefix(directory)
{
relative_executable.display()
} else {
executable.user_display()
};
write!(
f,
"Interpreter directory `{}` does not contain Python executable at `{}`",
directory.user_display(),
executable
executable.user_display_from(directory)
)
}
Self::ExecutableNotFoundInSearchPath(name) => {