@@ -12,7 +12,7 @@ DST=_site
1212PYTHON3_EXE := $(shell which python3 2>/dev/null)
1313ifneq (, $(PYTHON3_EXE ) )
1414 ifeq (,$(findstring Microsoft/WindowsApps/python3,$(subst \,/,$(PYTHON3_EXE))))
15- PYTHON := python3
15+ PYTHON := $( PYTHON3_EXE )
1616 endif
1717endif
1818
@@ -21,12 +21,13 @@ ifeq (,$(PYTHON))
2121 ifneq (, $(PYTHON_EXE))
2222 PYTHON_VERSION_FULL := $(wordlist 2,4,$(subst ., ,$(shell python --version 2>&1) ) )
2323 PYTHON_VERSION_MAJOR := $(word 1,${PYTHON_VERSION_FULL})
24- ifneq (3, ${PYTHON_VERSION_MAJOR})
25- $(error "Your system does not appear to have Python 3 installed.")
24+ ifeq (3, ${PYTHON_VERSION_MAJOR})
25+ PYTHON := $(PYTHON_EXE )
26+ else
27+ PYTHON_NOTE = "Your system does not appear to have Python 3 installed."
2628 endif
27- PYTHON := python
2829 else
29- $(error "Your system does not appear to have any Python installed.")
30+ PYTHON_NOTE = "Your system does not appear to have any Python installed."
3031 endif
3132endif
3233
@@ -59,7 +60,7 @@ docker-serve :
5960 carpentries/lesson-docker:latest
6061
6162# # * repo-check : check repository settings
62- repo-check :
63+ repo-check : python
6364 @${PYTHON} bin/repo_check.py -s .
6465
6566# # * clean : clean up junk files
@@ -87,7 +88,7 @@ clean-rmd :
8788.PHONY : workshop-check
8889
8990# # * workshop-check : check workshop homepage
90- workshop-check :
91+ workshop-check : python
9192 @${PYTHON} bin/workshop_check.py .
9293
9394
@@ -133,15 +134,15 @@ _episodes/%.md: _episodes_rmd/%.Rmd install-rmd-deps
133134 @$(SHELL ) bin/knit_lessons.sh $< $@
134135
135136# # * lesson-check : validate lesson Markdown
136- lesson-check : lesson-fixme
137+ lesson-check : python lesson-fixme
137138 @${PYTHON} bin/lesson_check.py -s . -p ${PARSER} -r _includes/links.md
138139
139140# # * lesson-check-all : validate lesson Markdown, checking line lengths and trailing whitespace
140- lesson-check-all :
141+ lesson-check-all : python
141142 @${PYTHON} bin/lesson_check.py -s . -p ${PARSER} -r _includes/links.md -l -w --permissive
142143
143144# # * unittest : run unit tests on checking tools
144- unittest :
145+ unittest : python
145146 @${PYTHON} bin/test_lesson_check.py
146147
147148# # * lesson-files : show expected names of generated files for debugging
@@ -159,8 +160,15 @@ lesson-fixme :
159160# # IV. Auxililary (plumbing) commands
160161# # =================================================
161162
162- .PHONY : commands
163+ .PHONY : commands python
163164
164165# # * commands : show all commands.
165166commands :
166167 @sed -n -e ' /^##/s|^##[[:space:]]*||p' $(MAKEFILE_LIST )
168+
169+ python :
170+ ifeq (, $(PYTHON ) )
171+ $(error $(PYTHON_NOTE))
172+ else
173+ @:
174+ endif
0 commit comments