@@ -12,7 +12,7 @@ DST=_site
12
12
PYTHON3_EXE := $(shell which python3 2>/dev/null)
13
13
ifneq (, $(PYTHON3_EXE ) )
14
14
ifeq (,$(findstring Microsoft/WindowsApps/python3,$(subst \,/,$(PYTHON3_EXE))))
15
- PYTHON := python3
15
+ PYTHON := $( PYTHON3_EXE )
16
16
endif
17
17
endif
18
18
@@ -21,12 +21,13 @@ ifeq (,$(PYTHON))
21
21
ifneq (, $(PYTHON_EXE))
22
22
PYTHON_VERSION_FULL := $(wordlist 2,4,$(subst ., ,$(shell python --version 2>&1) ) )
23
23
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."
26
28
endif
27
- PYTHON := python
28
29
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."
30
31
endif
31
32
endif
32
33
@@ -59,7 +60,7 @@ docker-serve :
59
60
carpentries/lesson-docker:latest
60
61
61
62
# # * repo-check : check repository settings
62
- repo-check :
63
+ repo-check : python
63
64
@${PYTHON} bin/repo_check.py -s .
64
65
65
66
# # * clean : clean up junk files
@@ -87,7 +88,7 @@ clean-rmd :
87
88
.PHONY : workshop-check
88
89
89
90
# # * workshop-check : check workshop homepage
90
- workshop-check :
91
+ workshop-check : python
91
92
@${PYTHON} bin/workshop_check.py .
92
93
93
94
@@ -133,15 +134,15 @@ _episodes/%.md: _episodes_rmd/%.Rmd install-rmd-deps
133
134
@$(SHELL ) bin/knit_lessons.sh $< $@
134
135
135
136
# # * lesson-check : validate lesson Markdown
136
- lesson-check : lesson-fixme
137
+ lesson-check : python lesson-fixme
137
138
@${PYTHON} bin/lesson_check.py -s . -p ${PARSER} -r _includes/links.md
138
139
139
140
# # * lesson-check-all : validate lesson Markdown, checking line lengths and trailing whitespace
140
- lesson-check-all :
141
+ lesson-check-all : python
141
142
@${PYTHON} bin/lesson_check.py -s . -p ${PARSER} -r _includes/links.md -l -w --permissive
142
143
143
144
# # * unittest : run unit tests on checking tools
144
- unittest :
145
+ unittest : python
145
146
@${PYTHON} bin/test_lesson_check.py
146
147
147
148
# # * lesson-files : show expected names of generated files for debugging
@@ -159,8 +160,15 @@ lesson-fixme :
159
160
# # IV. Auxililary (plumbing) commands
160
161
# # =================================================
161
162
162
- .PHONY : commands
163
+ .PHONY : commands python
163
164
164
165
# # * commands : show all commands.
165
166
commands :
166
167
@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