Add uv tool install --force (#4501)

Adds detection of existing entry points, avoiding clobbering entry
points that were installed by another tool. If we see any existing entry
point collisions, we'll stop instead of overwriting them. The `--force`
flag can be used to opt-in to overwriting the files; we can't use `-f`
because it's taken by `--find-links` which is silly. The `--force` flag
also implies replacing a tool previously installed by uv (the
environment is rebuilt).

Similarly, #4504 adds support for reinstalls that _will not_ clobber
entry points managed by other tools.
This commit is contained in:
Zanie Blue 2024-06-26 16:03:01 -04:00 committed by GitHub
parent dc408146ac
commit 747ab0d9f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 205 additions and 24 deletions

View file

@ -107,6 +107,20 @@ impl InstalledTools {
Ok(())
}
pub fn remove_environment(&self, name: &str) -> Result<(), Error> {
let _lock = self.acquire_lock();
let environment_path = self.root.join(name);
debug!(
"Deleting environment for tool `{name}` at {}",
environment_path.user_display()
);
fs_err::remove_dir_all(environment_path)?;
Ok(())
}
pub fn create_environment(
&self,
name: &str,