Skip to content

Commit d10e89a

Browse files
JoppeJoppe
authored andcommitted
BUG: Installs Conda even if not needed
1 parent 27bfbef commit d10e89a

1 file changed

Lines changed: 20 additions & 11 deletions

File tree

make.mk

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,12 @@ ifeq ($~,/Users/$I)
185185
endif
186186

187187
# A base PYTHON & OS manager. It can be one of:
188-
# - python3 & apt on Ubuntu
189-
# - python & choco in Windows
190188
# - python3 & brew on MacOS
189+
# - python3 & apt on Ubuntu
190+
# - python & scoop on Windows
191191
# - or any given PYTHON=python-interpreter !=OS-install-command ?=OS-install-directory
192192
ifeq ($~,/home/$I) # Linux
193+
PYTHON ?= $(shell which python3)
193194
CPU = $(shell uname -m)
194195

195196
ifeq (Darwin,$(shell uname)) # Probably Zsh on MacOSX
@@ -267,10 +268,12 @@ ifeq ($~,/home/$I) # Linux
267268
TARGET ?= $(CPU)-pc-linux-gnu
268269

269270
# Installable python interpreter, shebang path, document compiler and fonts on Ubuntu
270-
ifeq (,$(wildcard $(CONDA_DIR)python.exe))
271-
$(CONDA_DIR)bin/python3: Miniconda3-latest-Linux-$(CPU).sh | $(CONDA_DIR)
272-
bash $< -bfup $| && \
273-
rm $<
271+
ifeq (,$(wildcard $(PYTHON)))
272+
ifeq (,$(wildcard $(CONDA_DIR)python.exe))
273+
$(CONDA_DIR)bin/python3: Miniconda3-latest-Linux-$(CPU).sh | $(CONDA_DIR)
274+
bash $< -bfup $| && \
275+
rm $<
276+
endif
274277
endif
275278
$?/xetex:
276279
# Need a document compiler: Texlive
@@ -290,6 +293,7 @@ ifeq ($~,/home/$I) # Linux
290293

291294
endif
292295
else ifeq ($~,/c/Users/$I) # Probably Git Bash in Windows
296+
PYTHON ?= python
293297
OS ?= Windows
294298
CPU ?= $(shell echo $$PROCESSOR_ARCHITECTURE)
295299
.exe := .exe
@@ -315,11 +319,16 @@ else ifeq ($~,/c/Users/$I) # Probably Git Bash in Windows
315319
$($~)/scoop/shims/scoop.ps1:
316320
powershell.exe -NoProfile -Command "iwr -useb get.scoop.sh | iex"
317321
$(CONDA_DIR) := $(subst :,\:,$(CONDA_DIR))
318-
ifeq (,$(wildcard $(CONDA_DIR)python.exe))
319-
$($(CONDA_DIR))python.exe: Miniconda3-latest-Windows-$(CPU).exe | $(CONDA_DIR)
320-
powershell.exe -NoProfile -Command "Start-Process -FilePath '$<' -Wait -NoNewWindow -ArgumentList \
321-
'/InstallationType=JustMe','/AddToPath=1','/RegisterPython=1','/S','/D=""$|""'" && \
322-
rm $<
322+
PYTHON := $(PYTHON:.exe=).exe
323+
PYTHON := $(shell which $(PYTHON))
324+
PYTHON := $(shell cygpath -m $(PYTHON))
325+
ifeq (,$(wildcard $(PYTHON)))
326+
ifeq (,$(wildcard $(CONDA_DIR)python.exe))
327+
$($(CONDA_DIR))python.exe: Miniconda3-latest-Windows-$(CPU).exe | $(CONDA_DIR)
328+
powershell.exe -NoProfile -Command "Start-Process -FilePath '$<' -Wait -NoNewWindow -ArgumentList \
329+
'/InstallationType=JustMe','/AddToPath=1','/RegisterPython=1','/S','/D=""$|""'" && \
330+
rm $<
331+
endif
323332
endif
324333
ifeq (,$(filter .;%,$(PATH)))
325334
.-on-Windows_NT-path:

0 commit comments

Comments
 (0)