changeset 24194:00809c43d72c

Makefile: introduce testpy-% target for testing with a specifc Python This makes it easy to do 'make testpy-2.4.6 TESTFLAGS="-j 16"' and the Makefile will build Python if needed and then run tests (with -j 16) with the resulting Python. You can set the environment variable HGPYTHONS to a nice location on your machine to cache the Python builds globally. If that's not set, it builds them inside build/pythons.
author Augie Fackler <augie@google.com>
date Wed, 04 Feb 2015 12:26:16 -0500
parents fa4642439aa0
children 250d9cf97fb3
files Makefile
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri Feb 27 17:35:07 2015 -0500
+++ b/Makefile	Wed Feb 04 12:26:16 2015 -0500
@@ -7,6 +7,8 @@
 PREFIX=/usr/local
 export PREFIX
 PYTHON=python
+$(eval HGROOT := $(shell pwd))
+HGPYTHONS ?= $(HGROOT)/build/pythons
 PURE=
 PYFILES:=$(shell find mercurial hgext doc -name '*.py')
 DOCFILES=mercurial/help/*.txt
@@ -98,6 +100,13 @@
 test-%:
 	cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
 
+testpy-%:
+	@echo Looking for Python $* in $(HGPYTHONS)
+	[ -e $(HGPYTHONS)/$*/bin/python ] || ( \
+	cd $$(mktemp --directory --tmpdir) && \
+        $(MAKE) -f $(HGROOT)/contrib/Makefile.python PYTHONVER=$* PREFIX=$(HGPYTHONS)/$* python )
+	cd tests && $(HGPYTHONS)/$*/bin/python run-tests.py $(TESTFLAGS)
+
 check-code:
 	hg manifest | xargs python contrib/check-code.py