Exclude python-* system packages when installing in a venv.

This commit is contained in:
Fabio Manganiello 2023-08-23 02:17:19 +02:00
parent cddf318fa7
commit 2bff4c9cf1
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -312,6 +312,7 @@ class Dependencies:
Generates the package manager commands required to install the given Generates the package manager commands required to install the given
dependencies on the system. dependencies on the system.
""" """
wants_sudo = not (self._is_docker or os.getuid() == 0) wants_sudo = not (self._is_docker or os.getuid() == 0)
pkg_manager = self.pkg_manager or PackageManagers.scan() pkg_manager = self.pkg_manager or PackageManagers.scan()
if self.packages and pkg_manager: if self.packages and pkg_manager:
@ -319,7 +320,14 @@ class Dependencies:
[ [
*(['sudo'] if wants_sudo else []), *(['sudo'] if wants_sudo else []),
*pkg_manager.value.install, *pkg_manager.value.install,
*sorted(self.packages), # type: ignore *sorted(
pkg
for pkg in self.packages # type: ignore
if not (
self.install_context == InstallContext.VENV
and self._is_python_pkg(pkg)
)
),
] ]
) )