Do not remove uv itself on pip sync (#1649)

## Summary

Added `uv` to the list of the preserved packages when building the
installer plan. In that case `uv` is not going to be removed when, for
example, using `python -m uv pip sync requirements.txt` when
requirements.txt does not contain `uv`, but `uv` is installed in that
venv.

Closes #1631 

## Test Plan

Got through the example attached to
https://github.com/astral-sh/uv/issues/1631 and did see the uv deletion
in the output
```
$ python -m uv pip sync requirements.txt
Installed 1 package in 20ms
 + ruff==0.2.2
```
This commit is contained in:
Alexander Gherm 2024-02-18 15:39:51 +01:00 committed by GitHub
parent fd1af476b2
commit c04f597fae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -381,7 +381,10 @@ impl<'a> Planner<'a> {
let seed_packages = !venv.cfg().is_ok_and(|cfg| cfg.is_gourgeist());
for dist_info in site_packages {
if seed_packages
&& matches!(dist_info.name().as_ref(), "pip" | "setuptools" | "wheel")
&& matches!(
dist_info.name().as_ref(),
"pip" | "setuptools" | "wheel" | "uv"
)
{
debug!("Preserving seed package: {dist_info}");
continue;