--- /dev/null
+Return-Path: <bremner@tesseract.cs.unb.ca>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 283586DE173B\r
+ for <notmuch@notmuchmail.org>; Sat, 1 Aug 2015 23:42:06 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.151\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.151 tagged_above=-999 required=5 tests=[AWL=0.141, \r
+ T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id mWcD6iKIRBrS for <notmuch@notmuchmail.org>;\r
+ Sat, 1 Aug 2015 23:42:03 -0700 (PDT)\r
+Received: from gitolite.debian.net (gitolite.debian.net [87.98.215.224])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 577B66DE1715\r
+ for <notmuch@notmuchmail.org>; Sat, 1 Aug 2015 23:42:03 -0700 (PDT)\r
+Received: from remotemail by gitolite.debian.net with local (Exim 4.80)\r
+ (envelope-from <bremner@tesseract.cs.unb.ca>)\r
+ id 1ZLmxU-00008R-Qi; Sun, 02 Aug 2015 06:41:20 +0000\r
+Received: (nullmailer pid 15607 invoked by uid 1000); Sun, 02 Aug 2015\r
+ 06:41:06 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+Subject: [PATCH] test: use the python interpreter in sh.config\r
+Date: Sun, 2 Aug 2015 08:40:55 +0200\r
+Message-Id: <1438497655-15446-1-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <87mw0agsp7.fsf@maritornes.cs.unb.ca>\r
+References: <87mw0agsp7.fsf@maritornes.cs.unb.ca>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 02 Aug 2015 06:42:06 -0000\r
+\r
+The configure script chooses "python" if both python and python{2,3}\r
+exist exists, so this could change the version of python used to run\r
+the test suite.\r
+\r
+The checking for ${NOTMUCH_PYTHON} in the test suite is arguably\r
+over-engineering, since the configure step will fail if it can't find\r
+it.\r
+---\r
+\r
+Here is an updated version which fixes the subject typo, and actually\r
+tests for the python binary read from sh.config. I'll probably merge this version unless there are objections\r
+\r
+ configure | 2 ++\r
+ test/T390-python.sh | 2 ++\r
+ test/test-lib.sh | 15 ++++-----------\r
+ 3 files changed, 8 insertions(+), 11 deletions(-)\r
+\r
+diff --git a/configure b/configure\r
+index 56f550b..20fbed6 100755\r
+--- a/configure\r
++++ b/configure\r
+@@ -114,6 +114,8 @@ Other environment variables can be used to control configure itself,\r
+ XAPIAN_CONFIG The program to use to determine flags for\r
+ compiling and linking against the Xapian\r
+ library. [$XAPIAN_CONFIG]\r
++ PYTHON Name of python command to use in\r
++ configure and the test suite.\r
+ \r
+ Additionally, various options can be specified on the configure\r
+ command line.\r
+diff --git a/test/T390-python.sh b/test/T390-python.sh\r
+index 26d0b97..c3f24f7 100755\r
+--- a/test/T390-python.sh\r
++++ b/test/T390-python.sh\r
+@@ -2,6 +2,8 @@\r
+ test_description="python bindings"\r
+ . ./test-lib.sh\r
+ \r
++test_require_external_prereq ${NOTMUCH_PYTHON}\r
++\r
+ add_email_corpus\r
+ \r
+ test_begin_subtest "compare thread ids"\r
+diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+index 3466e9c..db3b6aa 100644\r
+--- a/test/test-lib.sh\r
++++ b/test/test-lib.sh\r
+@@ -621,9 +621,9 @@ test_expect_equal_json () {\r
+ # The test suite forces LC_ALL=C, but this causes Python 3 to\r
+ # decode stdin as ASCII. We need to read JSON in UTF-8, so\r
+ # override Python's stdio encoding defaults.\r
+- output=$(echo "$1" | PYTHONIOENCODING=utf-8 python -mjson.tool \\r
++ output=$(echo "$1" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -mjson.tool \\r
+ || echo "$1")\r
+- expected=$(echo "$2" | PYTHONIOENCODING=utf-8 python -mjson.tool \\r
++ expected=$(echo "$2" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -mjson.tool \\r
+ || echo "$2")\r
+ shift 2\r
+ test_expect_equal "$output" "$expected" "$@"\r
+@@ -1153,14 +1153,8 @@ test_python() {\r
+ export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib\r
+ export PYTHONPATH=$TEST_DIRECTORY/../bindings/python\r
+ \r
+- # Some distros (e.g. Arch Linux) ship Python 2.* as /usr/bin/python2,\r
+- # most others as /usr/bin/python. So first try python2, and fallback to\r
+- # python if python2 doesn't exist.\r
+- cmd=python2\r
+- [[ ${test_missing_external_prereq_[python2]} == t ]] && cmd=python\r
+-\r
+ (echo "import sys; _orig_stdout=sys.stdout; sys.stdout=open('OUTPUT', 'w')"; cat) \\r
+- | $cmd -\r
++ | $NOTMUCH_PYTHON -\r
+ }\r
+ \r
+ test_ruby() {\r
+@@ -1325,5 +1319,4 @@ test_declare_external_prereq emacs\r
+ test_declare_external_prereq ${TEST_EMACSCLIENT}\r
+ test_declare_external_prereq gdb\r
+ test_declare_external_prereq gpg\r
+-test_declare_external_prereq python\r
+-test_declare_external_prereq python2\r
++test_declare_external_prereq ${NOTMUCH_PYTHON}\r
+-- \r
+2.1.4\r
+\r