Allow user to specify a python executable.¬

¬
Fall back on `python`. Unlike the solution in PR #2395 this¬
puts all the responsibility for selecting the right python in the¬
case that "python" is Python 3 on the user. I've followed the lead¬
of the Python documentation Makefile. See

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
This commit is contained in:
Sean Gillies 2014-09-03 15:57:27 -06:00 committed by Dane Springmeyer
parent b6bd5d744e
commit c52994ff8b
4 changed files with 24 additions and 9 deletions

View file

@ -4,8 +4,18 @@ Mapnik is cross platform and runs on Linux, Mac OSX, Solaris, *BSD, and Windows.
To configure and build Mapnik do: To configure and build Mapnik do:
./configure ```bash
make $ ./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 NOTE: the above will not work on windows, rather see https://github.com/mapnik/mapnik/wiki/WindowsInstallation

View file

@ -1,6 +1,8 @@
OS := $(shell uname -s) OS := $(shell uname -s)
PYTHON = python
ifeq ($(JOBS),) ifeq ($(JOBS),)
JOBS:=1 JOBS:=1
ifeq ($(OS),Linux) ifeq ($(OS),Linux)
@ -14,13 +16,13 @@ endif
all: mapnik all: mapnik
install: 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: 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: 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 ".sconsign.dblite"; then rm ".sconsign.dblite"; fi
@if test -e "config.log"; then rm "config.log"; fi @if test -e "config.log"; then rm "config.log"; fi
@if test -e ".sconf_temp/"; then rm -r ".sconf_temp/"; 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 make uninstall && make clean && time make && make install
uninstall: 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: test:
./run_tests ./run_tests

4
configure vendored
View file

@ -1,3 +1,5 @@
#!/bin/bash #!/bin/bash
python scons/scons.py --implicit-deps-changed configure "$@" PYTHON=${PYTHON:-python}
$PYTHON scons/scons.py --implicit-deps-changed configure "$@"

View file

@ -3,9 +3,10 @@
failures=0 failures=0
source ./localize.sh source ./localize.sh
PYTHON=${PYTHON:-python}
echo "*** Running visual tests..." echo "*** Running visual tests..."
python tests/visual_tests/test.py -q $PYTHON tests/visual_tests/test.py -q
failures=$((failures+$?)) failures=$((failures+$?))
echo "*** Running C++ tests..." echo "*** Running C++ tests..."
@ -14,7 +15,7 @@ failures=$((failures+$?))
echo echo
echo "*** Running python tests..." echo "*** Running python tests..."
python tests/run_tests.py -q $PYTHON tests/run_tests.py -q
failures=$((failures+$?)) failures=$((failures+$?))
exit $failures exit $failures