--- /dev/null
+Return-Path: <wking@tremily.us>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 0CB85431FCB\r
+ for <notmuch@notmuchmail.org>; Sat, 12 Jul 2014 20:11:43 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id ewsmFDVjJaaP for <notmuch@notmuchmail.org>;\r
+ Sat, 12 Jul 2014 20:11:37 -0700 (PDT)\r
+Received: from qmta07.emeryville.ca.mail.comcast.net\r
+ (qmta07.emeryville.ca.mail.comcast.net [76.96.30.64])\r
+ by olra.theworths.org (Postfix) with ESMTP id B34D2431FBF\r
+ for <notmuch@notmuchmail.org>; Sat, 12 Jul 2014 20:11:29 -0700 (PDT)\r
+Received: from omta05.emeryville.ca.mail.comcast.net ([76.96.30.43])\r
+ by qmta07.emeryville.ca.mail.comcast.net with comcast\r
+ id ReTr1o0030vp7WLA7fBU71; Sun, 13 Jul 2014 03:11:28 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+ by omta05.emeryville.ca.mail.comcast.net with comcast\r
+ id RfBS1o00F152l3L8RfBScn; Sun, 13 Jul 2014 03:11:27 +0000\r
+Received: from mjolnir.tremily.us (unknown [192.168.0.150])\r
+ by odin.tremily.us (Postfix) with ESMTPS id 4D8711286F01;\r
+ Sat, 12 Jul 2014 20:11:26 -0700 (PDT)\r
+Received: (nullmailer pid 31448 invoked by uid 1000);\r
+ Sun, 13 Jul 2014 03:10:43 -0000\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 1/5] doc: Allow rst2man.py as an alternative to rst2man\r
+Date: Sat, 12 Jul 2014 20:10:33 -0700\r
+Message-Id:\r
+ <2621721db05068dffb65b88cd50d2a5b49e967f5.1405220724.git.wking@tremily.us>\r
+X-Mailer: git-send-email 1.9.1.353.gc66d89d\r
+In-Reply-To: <cover.1405220724.git.wking@tremily.us>\r
+References: <cover.1405220724.git.wking@tremily.us>\r
+In-Reply-To: <cover.1405220724.git.wking@tremily.us>\r
+References: <cover.1405220724.git.wking@tremily.us>\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+ s=q20140121; t=1405221088;\r
+ bh=r1SmfwLyDrRrHkX+rVyzuMi4ZBAASHPV7xF3klv4OBQ=;\r
+ h=Received:Received:Received:Received:From:To:Subject:Date:\r
+ Message-Id;\r
+ b=YuAelciTpL56w9qBlsej7g1RrVs5sGwK+AFcDPAPmV1xjpZ971hTKln6zx5VTE6Vp\r
+ p6A2I7YhyqKnm9sbWf8CyD71Eyy9v/449tzlTiVxiiOL1f50kKgQSNYtfRhd7YSrC0\r
+ oGCyZ/bdL1iy3RFyN58zteZjRcuFltuYCjaY5CPTNVA0jLrL/fVVGSuhRlqAYZHRoe\r
+ vRpjMQkWxOXSxUiX8t5VzlWBkUKkvLrqnyzWi2FbiJo9LWF8OihtzJn8U3HRnn5sMG\r
+ f0KbeUPk1gXw5rmrS/ATCcG4i826vbWweiQD9BS+M8WN47AK1rEcIX1jNvsUhDwHtK\r
+ qX6ca0PLbDkYw==\r
+Cc: Tomi Ollila <tomi.ollila@iki.fi>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\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, 13 Jul 2014 03:11:43 -0000\r
+\r
+Gentoo's dev-python/docutils-0.10 installs Docutils scripts with a\r
+*.py extension, so I have /usr/bin/rst2man.py and no rst2man script.\r
+This patch supports users with both types of systems by checking for\r
+rst2man, falling back on rst2man.py, and giving up only if neither is\r
+found. Users can also set the new RST2MAN path variable explicitly\r
+when they call Make:\r
+\r
+ make RST2MAN=/my/custom/rst_to_man_converter build-man\r
+\r
+We pass the configured RST2MAN path through to prerst2man.py to use in\r
+its system call.\r
+\r
+We can use a non-empty RST2MAN to check for the availability of an\r
+rst2man program, so there's no need for a separate HAVE_RST2MAN.\r
+However, we keep the existing HAVE_RST2MAN for consistency with\r
+HAVE_SPHINX.\r
+---\r
+ configure | 20 +++++++++++++++-----\r
+ doc/Makefile.local | 2 +-\r
+ doc/prerst2man.py | 9 +++++----\r
+ 3 files changed, 21 insertions(+), 10 deletions(-)\r
+\r
+diff --git a/configure b/configure\r
+index 9bde2eb..20a2d5f 100755\r
+--- a/configure\r
++++ b/configure\r
+@@ -413,17 +413,23 @@ if hash sphinx-build > /dev/null 2>&1 && python -m sphinx.writers.manpage > /dev\r
+ printf "Yes.\n"\r
+ have_sphinx=1\r
+ have_rst2man=0\r
++ RST2MAN=\r
+ else\r
+ printf "No (falling back to rst2man).\n"\r
+ have_sphinx=0\r
+ \r
+ printf "Checking if rst2man is available... "\r
+- if rst2man -V > /dev/null 2>&1; then\r
+- printf "Yes.\n"\r
+- have_rst2man=1\r
+- else\r
+- printf "No (so will not install man pages).\n"\r
++ for RST2MAN in rst2man rst2man.py; do\r
++ if "${RST2MAN}" -V > /dev/null 2>&1; then\r
++ have_rst2man=1\r
++ printf "Yes (${RST2MAN}).\n"\r
++ break\r
++ fi\r
++ RST2MAN=\r
++ done\r
++ if [ -z "${RST2MAN}" ]; then\r
+ have_rst2man=0\r
++ printf "No (so will not install man pages).\n"\r
+ fi\r
+ fi\r
+ \r
+@@ -820,6 +826,10 @@ HAVE_SPHINX=${have_sphinx}\r
+ # Whether there's a rst2man binary available for building documentation\r
+ HAVE_RST2MAN=${have_rst2man}\r
+ \r
++# The path to the rst2man program for building documentation. Set to\r
++# an empty string if no such program is available.\r
++RST2MAN=${RST2MAN}\r
++\r
+ # The directory to which desktop files should be installed\r
+ desktop_dir = \$(prefix)/share/applications\r
+ \r
+diff --git a/doc/Makefile.local b/doc/Makefile.local\r
+index bbd4610..d96cdd5 100644\r
+--- a/doc/Makefile.local\r
++++ b/doc/Makefile.local\r
+@@ -49,7 +49,7 @@ ifeq ($(HAVE_SPHINX),1)\r
+ mv $(DOCBUILDDIR)/man/*.$${section} $(DOCBUILDDIR)/man/man$${section}; \\r
+ done\r
+ else ifeq ($(HAVE_RST2MAN),1)\r
+- $(prerst2man) $(srcdir)/doc $(DOCBUILDDIR)/man\r
++ $(prerst2man) "$(RST2MAN)" $(srcdir)/doc $(DOCBUILDDIR)/man\r
+ else\r
+ @echo "Fatal: build dependency fail."\r
+ @false\r
+diff --git a/doc/prerst2man.py b/doc/prerst2man.py\r
+index 437dea9..81ce817 100644\r
+--- a/doc/prerst2man.py\r
++++ b/doc/prerst2man.py\r
+@@ -4,8 +4,9 @@ from os.path import dirname, isdir\r
+ from os import makedirs, system\r
+ import re\r
+ \r
+-sourcedir = argv[1]\r
+-outdir = argv[2]\r
++rst2man = argv[1]\r
++sourcedir = argv[2]\r
++outdir = argv[3]\r
+ \r
+ if not isdir(outdir):\r
+ makedirs(outdir, 0o755)\r
+@@ -59,5 +60,5 @@ for page in man_pages:\r
+ outfile.write("".join(lines))\r
+ outfile.close()\r
+ \r
+- system('set -x; rst2man {0} {1}/{2}.{3}'\r
+- .format(filename, outdir, page[0], page[4]))\r
++ system('set -x; {0} {1} {2}/{3}.{4}'\r
++ .format(rst2man, filename, outdir, page[0], page[4]))\r
+-- \r
+1.9.1.353.gc66d89d\r
+\r