From 712f793e78cde934d3573c6747518d834e7beec8 Mon Sep 17 00:00:00 2001 From: hektr <31568062+hektr@users.noreply.github.com> Date: Wed, 18 Jul 2018 23:54:08 +0300 Subject: Update PYTHON variable `which python3` will likely show the latest version of python installed on system, so, it should go the first. I think, it's not necessary to write all of possible versions of python. You can just use `which python3 || which python`... --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6cd1ec8f..1c3745a6 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,9 @@ 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 python || which python3.3 || which python3.2 || which python3.1 || \ - which python3 || which python2.7 || which python2.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) SETUPOPTS ?= '--record=install_log.txt' DOCDIR ?= doc/pydoc DESTDIR ?= / -- cgit 1.4.1-2-gfad0 From 4e326bd9606ef6d4f7851bdca1ea8d5bcce85b73 Mon Sep 17 00:00:00 2001 From: toonn Date: Sun, 19 Aug 2018 20:27:46 +0200 Subject: 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`. --- Makefile | 14 ++++++++++---- 1 file 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 ?= / -- cgit 1.4.1-2-gfad0 From 5edd2c0f59d7f73c38b49f528d3578dca9e5162b Mon Sep 17 00:00:00 2001 From: toonn Date: Sun, 19 Aug 2018 21:18:42 +0200 Subject: Remove strip because whitespace could be a valid name --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 611bb7c3..79b4f9d4 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ PYTHON ?= $(shell \ || (python2 -c 'import sys; sys.exit(sys.version < "2.6")' && \ which python2) \ ) -ifeq ($(strip $(PYTHON)),) +ifeq ($(PYTHON),) $(error No suitable python found.) endif SETUPOPTS ?= '--record=install_log.txt' -- cgit 1.4.1-2-gfad0