Skip to content

Commit e6622b8

Browse files
committed
Makefile: handle MS Store's Python 3
1 parent ecb1611 commit e6622b8

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

Makefile

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,25 @@ DST=_site
1010

1111
# Check Python 3 is installed and determine if it's called via python3 or python
1212
# (https://stackoverflow.com/a/4933395)
13-
ifneq (, $(shell which python3 2>/dev/null))
14-
PYTHON := python3
15-
else ifneq (, $(shell which python 2>/dev/null))
16-
PYTHON_VERSION_FULL := $(wordlist 2,4,$(subst ., ,$(shell python --version 2>&1)))
17-
PYTHON_VERSION_MAJOR := $(word 1,${PYTHON_VERSION_FULL})
18-
ifneq (3, ${PYTHON_VERSION_MAJOR})
19-
$(error "Your system does not appear to have Python 3 installed.")
13+
PYTHON3_EXE := $(shell which python3 2>/dev/null)
14+
ifneq (, $(PYTHON3_EXE))
15+
ifeq $(,findstring Microsoft/WindowsApps/python3,$(subst \,/,$(PYTHON3_EXE)))
16+
PYTHON := python3
17+
endif
18+
endif
19+
20+
ifeq $(,$(PYTHON))
21+
PYTHON_EXE := $(shell which python 2>/dev/null)
22+
ifneq (, $(PYTHON_EXE))
23+
PYTHON_VERSION_FULL := $(wordlist 2,4,$(subst ., ,$(shell python --version 2>&1)))
24+
PYTHON_VERSION_MAJOR := $(word 1,${PYTHON_VERSION_FULL})
25+
ifneq (3, ${PYTHON_VERSION_MAJOR})
26+
$(error "Your system does not appear to have Python 3 installed.")
27+
endif
28+
PYTHON := python
29+
else
30+
$(error "Your system does not appear to have any Python installed.")
2031
endif
21-
PYTHON := python
22-
else
23-
$(error "Your system does not appear to have any Python installed.")
2432
endif
2533

2634

0 commit comments

Comments
 (0)