From 2bff4c9cf1208eafc70e61f659e4f6caf90b11b0 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 23 Aug 2023 02:17:19 +0200 Subject: [PATCH] Exclude python-* system packages when installing in a venv. --- platypush/utils/manifest.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/platypush/utils/manifest.py b/platypush/utils/manifest.py index 7eaf6726..9de25ed2 100644 --- a/platypush/utils/manifest.py +++ b/platypush/utils/manifest.py @@ -312,6 +312,7 @@ class Dependencies: Generates the package manager commands required to install the given dependencies on the system. """ + wants_sudo = not (self._is_docker or os.getuid() == 0) pkg_manager = self.pkg_manager or PackageManagers.scan() if self.packages and pkg_manager: @@ -319,7 +320,14 @@ class Dependencies: [ *(['sudo'] if wants_sudo else []), *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) + ) + ), ] )