Skip to content

Commit 8458680

Browse files
committed
Add --break-system-packages and a test
1 parent ad26e11 commit 8458680

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

deps.mk

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,29 @@ bundle-update-all := --all
111111
endif
112112

113113
## Python
114+
114115
ifeq (true,$(CI))
116+
# PEP 668 really messes with things here.
117+
ifeq (root,$(USER))
118+
break-system-packages := --break-system-packages
119+
else
120+
ifeq (0,$(shell id -u))
121+
break-system-packages := --break-system-packages
122+
endif
123+
endif
115124
# Override VENVDIR so we can use caching in CI.
116125
VENVDIR = $(realpath .)/.venv
117126
endif
127+
118128
VENVDIR ?= $(realpath $(LIBDIR))/.venv
119129
REQUIREMENTS_TXT := $(wildcard requirements.txt)
130+
120131
ifneq (,$(strip $(REQUIREMENTS_TXT)))
121132
# Need to maintain a local marker file in case the lib/ directory is shared.
122133
LOCAL_VENV := .requirements.txt
123134
DEPS_FILES += $(LOCAL_VENV)
124135
endif
136+
125137
ifneq (true,$(CI))
126138
# Don't install from lib/requirements.txt in CI; these are in the docker image.
127139
REQUIREMENTS_TXT += $(LIBDIR)/requirements.txt
@@ -133,7 +145,8 @@ ifeq (true,$(CI))
133145
# Under CI, install from the local requirements.txt, but install globally (no venv).
134146
pip ?= pip3
135147
$(LOCAL_VENV):
136-
$(pip) install $(no-cache-dir) $(foreach path,$(REQUIREMENTS_TXT),-r $(path))
148+
@which $(pip)
149+
$(pip) install $(no-cache-dir) $(break-system-packages) $(foreach path,$(REQUIREMENTS_TXT),-r $(path))
137150
@touch $@
138151

139152
# No clean-deps target in CI..

0 commit comments

Comments
 (0)