about summary refs log tree commit diff stats
path: root/Makefile
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2018-08-19 20:27:46 +0200
committertoonn <toonn@toonn.io>2018-08-19 20:27:46 +0200
commit4e326bd9606ef6d4f7851bdca1ea8d5bcce85b73 (patch)
tree3555fafcbd800a70df12abc4976ab6e867692311 /Makefile
parent712f793e78cde934d3573c6747518d834e7beec8 (diff)
downloadranger-4e326bd9606ef6d4f7851bdca1ea8d5bcce85b73.tar.gz
Check PYTHON is properly defined
We don't need to check for all the various versions, that's just a
maintenance burden because `python33` shouldn't ever be available if
`python3` isn't.

Added a check for whether `PYTHON` is empty or just whitespace because
that's useless and could actually lead to problems, if `setup.py`
happens to be on the `PATH`.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile14
1 files changed, 10 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 1c3745a6..611bb7c3 100644
--- a/Makefile
+++ b/Makefile
@@ -7,10 +7,16 @@ NAME_RIFLE = rifle
 VERSION_RIFLE = $(VERSION)
 SNAPSHOT_NAME ?= $(NAME)-$(VERSION)-$(shell git rev-parse HEAD | cut -b 1-8).tar.gz
 # Find suitable python version (need python >= 2.6 or 3.1):
-PYTHON ?= $(shell python -c 'import sys; sys.exit(sys.version < "2.6")' && \
-	which python3 || which python3.6 || which python3.5 || which python3.4 || \
-	which python3.3 || which python3.2 || which python3.1 || \
-	which python || which python2.7 || which python2.6)
+PYTHON ?= $(shell \
+	     (python -c 'import sys; sys.exit(sys.version < "2.6")' && \
+	      which python) \
+	     || (which python3) \
+	     || (python2 -c 'import sys; sys.exit(sys.version < "2.6")' && \
+	         which python2) \
+	   )
+ifeq ($(strip $(PYTHON)),)
+  $(error No suitable python found.)
+endif
 SETUPOPTS ?= '--record=install_log.txt'
 DOCDIR ?= doc/pydoc
 DESTDIR ?= /