Skip to content

Commit 65206bd

Browse files
committed
Fixes poetry detection bug
This was fixed in other iterations of this system but apparently not in the one I copied it from to start this repo!
1 parent 8ab344e commit 65206bd

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

Makefile

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ PYENV_VERSION_DIR ?= $(shell pyenv root)/versions/$(shell head -n 1 $(PYTHON_VER
2727
# use just the first
2828
PYTHON_EXEC ?= $(shell pyenv prefix | cut -d: -f1)/bin/python3
2929
endif
30-
ifeq ("$(shell which poetry)","")
31-
# poetry is installed
32-
POETRY_TASK =
33-
else
30+
POETRY_PATH = $(shell command -v poetry)
31+
ifeq ("$(POETRY_PATH)","")
3432
# poetry is not installed
3533
POETRY_TASK = install-poetry
34+
else
35+
# poetry is installed
36+
POETRY_TASK =
3637
endif
3738

3839
# If we're on macos arm64, we might to need to build some packages,
@@ -83,6 +84,11 @@ PYTEST ?= $(POETRY) run pytest
8384
help: ## Display this help
8485
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
8586

87+
.PHONY: debug-make
88+
debug-make: ## Shows ~all runtime-set variables
89+
@echo $(foreach v, $(.VARIABLES), $(info $(v) = $($(v))))
90+
91+
8692
##@ Development
8793

8894
.PHONY: test
@@ -181,6 +187,11 @@ python-current: ## Display the version and binary location of python3
181187
@$(CURRENT_PYTHON) --version
182188
@echo PYTHON_EXEC = $(PYTHON_EXEC)
183189

190+
.PHONY: install-poetry
191+
install-poetry: ## Installs Poetry to the current Python environment
192+
@echo "$(COLOR_ORANGE)Installing Poetry from python-poetry.org with $(CURRENT_PYTHON)$(COLOR_RESET)"
193+
curl -sSL https://install.python-poetry.org | $(CURRENT_PYTHON) -
194+
184195
.PHONY: deps
185196
deps: deps-brew deps-py $(DEPS_TASKS_IF_PERU_CONFIG) install-precommit ## Installs all dependencies
186197
@echo "$(COLOR_GREEN)All deps installed!$(COLOR_RESET)"
@@ -222,11 +233,6 @@ deps-peru: $(PERU_CONFIG) ## Installs dependencies from Peru
222233
deps-ci: $(DEPS_TASKS_IF_PERU_CONFIG) poetry-install ## Install CI check and test dependencies (assumes Python & Poetry already present in env)
223234
@echo "$(COLOR_GREEN)All CI dependencies installed!$(COLOR_RESET)"
224235

225-
.PHONY: install-poetry
226-
install-poetry: ## Installs Poetry to the current Python environment
227-
@echo "$(COLOR_ORANGE)Installing Poetry from python-poetry.org with $(CURRENT_PYTHON)$(COLOR_RESET)"
228-
curl -sSL https://install.python-poetry.org | $(CURRENT_PYTHON) -
229-
230236
.PHONY: install-python
231237
install-python: $(PYTHON_EXEC) ## Installs appropriate Python version
232238
@echo "$(COLOR_GREEN)Python installed to $(PYTHON_EXEC)$(COLOR_RESET)"

0 commit comments

Comments
 (0)