Always add --break-system-packages to pip when the Docker context is active.
This fixes the case where Platydock is called within the context of a virtual environment, but it needs to generate a Docker image - and therefore, unless the host virtual environment, it needs --break-system-packages to write to /usr.
This commit is contained in:
parent
5e52741986
commit
05c6449d8b
1 changed files with 7 additions and 4 deletions
|
@ -453,19 +453,22 @@ class Dependencies:
|
||||||
(as a single string) or the list of packages that will be installed
|
(as a single string) or the list of packages that will be installed
|
||||||
through another script.
|
through another script.
|
||||||
"""
|
"""
|
||||||
wants_break_system_packages = not (
|
wants_break_system_packages = (
|
||||||
# --break-system-packages has been introduced in Python 3.10
|
# --break-system-packages has been introduced in Python 3.10
|
||||||
sys.version_info < (3, 11)
|
sys.version_info >= (3, 11)
|
||||||
|
# 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
|
# If we're in a virtual environment then we don't need
|
||||||
# --break-system-packages
|
# --break-system-packages
|
||||||
or self._is_venv
|
or not self._is_venv
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.pip:
|
if self.pip:
|
||||||
deps = sorted(self.pip)
|
deps = sorted(self.pip)
|
||||||
if full_command:
|
if full_command:
|
||||||
yield (
|
yield (
|
||||||
'pip install --no-input '
|
'pip install -U --no-input '
|
||||||
+ ('--no-cache-dir ' if self._is_docker else '')
|
+ ('--no-cache-dir ' if self._is_docker else '')
|
||||||
+ (
|
+ (
|
||||||
'--break-system-packages '
|
'--break-system-packages '
|
||||||
|
|
Loading…
Reference in a new issue