--- /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 olra.theworths.org (Postfix) with ESMTP id 6C485431FBC\r
+ for <notmuch@notmuchmail.org>; Sat, 3 Jan 2015 07:49:43 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\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 tests=[none]\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 TD83hV5NKkEp for <notmuch@notmuchmail.org>;\r
+ Sat, 3 Jan 2015 07:49:40 -0800 (PST)\r
+Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
+ (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id B9A6B431FB6\r
+ for <notmuch@notmuchmail.org>; Sat, 3 Jan 2015 07:49:40 -0800 (PST)\r
+Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
+ (envelope-from <bremner@tesseract.cs.unb.ca>)\r
+ id 1Y7QxQ-0007cd-0e; Sat, 03 Jan 2015 11:49:40 -0400\r
+Received: (nullmailer pid 5255 invoked by uid 1000); Sat, 03 Jan 2015\r
+ 15:49:34 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] doc: Allow rst2man.py as an alternative to rst2man\r
+Date: Sat, 3 Jan 2015 16:49:27 +0100\r
+Message-Id: <1420300167-5060-1-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.1.3\r
+In-Reply-To: <1420294479-27224-1-git-send-email-tomi.ollila@iki.fi>\r
+References: <1420294479-27224-1-git-send-email-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: Sat, 03 Jan 2015 15:49:43 -0000\r
+\r
+From: "W. Trevor King" <wking@tremily.us>\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
+\r
+At the risk of bike-shedding, rewrite the configure check to be more\r
+"obvious". This is pretty subjective, but in particular I'm not a big\r
+fan of resetting RST2MAN at the bottom of every iteration of the for\r
+loop. Also conform a bit more to the convention of using a lower case variable in configure and assigning it in Makefile.\r
+\r
+For some reason it bugs me a bit to pass RST2MAN as an extra command line argument, but I guess taking some arguments by command line and some by environment variables would also be icky.\r
+\r
+configure | 23 ++++++++++++++++-------\r
+ doc/Makefile.local | 2 +-\r
+ doc/prerst2man.py | 9 +++++----\r
+ 3 files changed, 22 insertions(+), 12 deletions(-)\r
+\r
+diff --git a/configure b/configure\r
+index 137acea..fdf5bad 100755\r
+--- a/configure\r
++++ b/configure\r
+@@ -444,21 +444,27 @@ else\r
+ fi\r
+ \r
+ printf "Checking if sphinx is available and supports nroff output... "\r
++have_sphinx=0\r
++have_rst2man=0\r
++\r
+ if hash sphinx-build > /dev/null 2>&1 && ${python} -m sphinx.writers.manpage > /dev/null 2>&1 ; then\r
+ printf "Yes.\n"\r
+ have_sphinx=1\r
+- have_rst2man=0\r
+ else\r
+ printf "No (falling back to rst2man).\n"\r
+- have_sphinx=0\r
+ \r
++ rst2man=\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
++ for name in rst2man rst2man.py; do\r
++ if "${name}" -V > /dev/null 2>&1; then\r
++ printf "Yes (${name}).\n"\r
++ have_rst2man=1\r
++ rst2man=$name\r
++ break\r
++ fi\r
++ done\r
++ if [ $have_rst2man -eq 0 ]; then\r
+ printf "No (so will not install man pages).\n"\r
+- have_rst2man=0\r
+ fi\r
+ fi\r
+ \r
+@@ -854,6 +860,9 @@ HAVE_RST2MAN=${have_rst2man}\r
+ # Whether there's a doxygen binary available for building api documentation\r
+ HAVE_DOXYGEN=${have_doxygen}\r
+ \r
++# The path to the rst2man program for building documentation.\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 e7d0bac..a13cb37 100644\r
+--- a/doc/Makefile.local\r
++++ b/doc/Makefile.local\r
+@@ -51,7 +51,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 968722a..2e87976 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
+@@ -60,5 +61,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
+2.1.3\r
+\r