Skip to content

Commit b5712ab

Browse files
committed
Replace make does-path-have-reqs with better deps-reqs-versions
This fixes this long-broken task and enables an output that shows the version at each path.
1 parent 4da6aa3 commit b5712ab

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

Makefile

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,28 @@ install-precommit: $(GIT_HOOKS) ## Sets up pre-commit hooks
172172
$(GIT_HOOKS): .pre-commit-config.yaml
173173
$(PRECOMMIT) install
174174

175-
.PHONY: does-path-have-reqs
176-
does-path-have-reqs: ## Check if shell $PATH has expected elements
177-
@echo "$(COLOR_BLUE)Checking PATH elements for evidence of package managers…$(COLOR_RESET)"
178-
@( (echo $${PATH} | grep -q poetry ) && echo "found poetry") || (echo "missing poetry" && false)
179-
@( (echo $${PATH} | grep -q homebrew ) && echo "found homebrew") || (echo "missing homebrew" && false)
180-
@( (echo $${PATH} | grep -q pyenv ) && echo "found pyenv") || (echo "missing pyenv" && false)
175+
.PHONY: deps-reqs-versions
176+
deps-reqs-versions: ## Check if shell $PATH has requirements and show their version
177+
@echo "$(COLOR_BLUE)Checking PATH elements for evidence of package managers. The first in each section is what's used.$(COLOR_RESET)"
178+
@$(MAKE) paths-version-for-cmd CMD=poetry
179+
@$(MAKE) paths-version-for-cmd CMD=pyenv
180+
@$(MAKE) paths-version-for-cmd CMD=brew
181+
@$(MAKE) paths-version-for-cmd CMD=curl
182+
@$(MAKE) paths-version-for-cmd CMD=git
181183
@echo "$(COLOR_GREEN)All expected PATH elements found$(COLOR_RESET)"
182184

185+
CMD_VERSION_FLAG ?= --version
186+
.PHONY: paths-version-for-cmd
187+
paths-version-for-cmd: ## Display version for all executable paths for an executable, set CMD & CMD_VERSION_FLAG
188+
@( if [ -z "$$(which -a $(CMD))" ]; then \
189+
echo "==> $(COLOR_RED)missing $(CMD)$(COLOR_RESET)"; \
190+
else \
191+
echo "==> $(COLOR_ORANGE)$(CMD) $(COLOR_BLUE)commands' versions are:$(COLOR_RESET)"; \
192+
for pth in $$(which -a $(CMD)); do \
193+
echo "$(COLOR_BLUE)$${pth}$(COLOR_RESET) : $$("$${pth}" $(CMD_VERSION_FLAG))"; \
194+
done; \
195+
fi )
196+
183197
##@ Dependencies
184198

185199
.PHONY: python-current

0 commit comments

Comments
 (0)