File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -237,13 +237,28 @@ deps-ci: poetry-install $(DEPS_TASKS_IF_PERU_CONFIG) ## Install CI check and te
237237install-python : $(PYTHON_EXEC ) # # Installs appropriate Python version
238238 @echo " $( COLOR_GREEN) Python installed to $( PYTHON_EXEC) $( COLOR_RESET) "
239239
240+ # Pyenv already automatically uses Homebrew's libraries if available on macOS
241+ ifeq ($(shell uname -s) , Darwin)
242+ PYENV_FLAGS =
243+ endif
244+ # Force use of Homebrew's libraries in Linux
245+ # Pyenv discourages this, preferring use of distro-provided libraries.
246+ # We want to link against Homebrew for dev workstation use, but rely on
247+ # distro Python in CI, which is why deps-ci doesn't install Python!
248+ ifeq ($(shell uname -s) , Linux)
249+ PYENV_FLAGS = CFLAGS="$(shell pkg-config --cflags libffi ncurses readline) " \
250+ LDFLAGS="$(shell pkg-config --libs libffi ncurses readline) " \
251+ CC="$(firstword $(wildcard $(shell brew --prefix gcc) /bin/gcc-* ) ) "
252+ endif
253+
240254$(PYTHON_EXEC ) : $(PYTHON_VERSION_FILE )
241255 @echo " $( COLOR_BLUE) Installing Pythons from $( PYTHON_VERSION_FILE) using $( PYENV) :$( COLOR_ORANGE) "
242256 @grep ^[^\n #] $(PYTHON_VERSION_FILE ) | sed -e ' s/^/\t/'
243257 @echo " $( COLOR_RESET) "
244258
245259 grep ^[^\n# ] $(PYTHON_VERSION_FILE) | while read -r py ; do \
246- $(PYENV) install --verbose --skip-existing "$${py}" ; done
260+ $(PYENV_FLAGS) $(PYENV) install --verbose --skip-existing "$${py}" ; \
261+ done
247262
248263# #@ Poetry
249264
You can’t perform that action at this time.
0 commit comments