From b1dd48470400b39b1e27feed53cd60def14ffd73 Mon Sep 17 00:00:00 2001
From: Fabio Manganiello <fabio@manganiello.tech>
Date: Sat, 25 May 2024 10:33:05 +0200
Subject: [PATCH] A more corner-case-proof logic for
 `wants_break_system_packages`.

---
 platypush/utils/manifest.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/platypush/utils/manifest.py b/platypush/utils/manifest.py
index 4ce3a59f5..b8b7f1186 100644
--- a/platypush/utils/manifest.py
+++ b/platypush/utils/manifest.py
@@ -459,11 +459,13 @@ class Dependencies:
             # If we're generating a Docker image then we always need
             # --break-system-packages
             or self._is_docker
-            # If we're in a virtual environment then we don't need
-            # --break-system-packages
-            or not self._is_venv
         )
 
+        if self._is_venv and not self._is_docker:
+            # If we're in a virtual environment then we don't need
+            # --break-system-packages, unless we're generating a Docker image
+            wants_break_system_packages = False
+
         if self.pip:
             deps = sorted(self.pip)
             if full_command: