From c52994ff8b4a35a11c7b61f1a2d37c86020431f5 Mon Sep 17 00:00:00 2001 From: Sean Gillies Date: Wed, 3 Sep 2014 15:57:27 -0600 Subject: [PATCH] =?UTF-8?q?Allow=20user=20to=20specify=20a=20python=20exec?= =?UTF-8?q?utable.=C2=AC=20=C2=AC=20Fall=20back=20on=20`python`.=20Unlike?= =?UTF-8?q?=20the=20solution=20in=20PR=20#2395=20this=C2=AC=20puts=20all?= =?UTF-8?q?=20the=20responsibility=20for=20selecting=20the=20right=20pytho?= =?UTF-8?q?n=20in=20the=C2=AC=20case=20that=20"python"=20is=20Python=203?= =?UTF-8?q?=20on=20the=20user.=20I've=20followed=20the=20lead=C2=AC=20of?= =?UTF-8?q?=20the=20Python=20documentation=20Makefile.=20See?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit http://hg.python.org/cpython/file/340d48347295/Doc/README.txt http://hg.python.org/cpython/file/340d48347295/Doc/Makefile Intent is that if your `python` is Python 2 everything works as before and that is your `python` is Python 3 but you have a `python2` you can specify that instead.¬ Conflicts: run_tests --- INSTALL.md | 14 ++++++++++++-- Makefile | 10 ++++++---- configure | 4 +++- run_tests | 5 +++-- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 07ba365f5..41b0dfded 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -4,8 +4,18 @@ Mapnik is cross platform and runs on Linux, Mac OSX, Solaris, *BSD, and Windows. To configure and build Mapnik do: - ./configure - make +```bash + $ ./configure + $ make +``` + +To use a Python interpreter that is not named `python` for your build, do +something like the following instead: + +```bash + $ PYTHON=python2 ./configure + $ make PYTHON=python2 +``` NOTE: the above will not work on windows, rather see https://github.com/mapnik/mapnik/wiki/WindowsInstallation diff --git a/Makefile b/Makefile index c10de2203..171060b0b 100755 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ OS := $(shell uname -s) +PYTHON = python + ifeq ($(JOBS),) JOBS:=1 ifeq ($(OS),Linux) @@ -14,13 +16,13 @@ endif all: mapnik install: - python scons/scons.py -j$(JOBS) --config=cache --implicit-cache --max-drift=1 install + $(PYTHON) scons/scons.py -j$(JOBS) --config=cache --implicit-cache --max-drift=1 install mapnik: - python scons/scons.py -j$(JOBS) --config=cache --implicit-cache --max-drift=1 + $(PYTHON) scons/scons.py -j$(JOBS) --config=cache --implicit-cache --max-drift=1 clean: - @python scons/scons.py -j$(JOBS) -c --config=cache --implicit-cache --max-drift=1 + @$(PYTHON) scons/scons.py -j$(JOBS) -c --config=cache --implicit-cache --max-drift=1 @if test -e ".sconsign.dblite"; then rm ".sconsign.dblite"; fi @if test -e "config.log"; then rm "config.log"; fi @if test -e ".sconf_temp/"; then rm -r ".sconf_temp/"; fi @@ -42,7 +44,7 @@ rebuild: make uninstall && make clean && time make && make install uninstall: - @python scons/scons.py -j$(JOBS) --config=cache --implicit-cache --max-drift=1 uninstall + @$(PYTHON) scons/scons.py -j$(JOBS) --config=cache --implicit-cache --max-drift=1 uninstall test: ./run_tests diff --git a/configure b/configure index a04bb27a0..8abbff103 100755 --- a/configure +++ b/configure @@ -1,3 +1,5 @@ #!/bin/bash -python scons/scons.py --implicit-deps-changed configure "$@" +PYTHON=${PYTHON:-python} + +$PYTHON scons/scons.py --implicit-deps-changed configure "$@" diff --git a/run_tests b/run_tests index a7dbc5685..5dab76b2a 100755 --- a/run_tests +++ b/run_tests @@ -3,9 +3,10 @@ failures=0 source ./localize.sh +PYTHON=${PYTHON:-python} echo "*** Running visual tests..." -python tests/visual_tests/test.py -q +$PYTHON tests/visual_tests/test.py -q failures=$((failures+$?)) echo "*** Running C++ tests..." @@ -14,7 +15,7 @@ failures=$((failures+$?)) echo echo "*** Running python tests..." -python tests/run_tests.py -q +$PYTHON tests/run_tests.py -q failures=$((failures+$?)) exit $failures