From: W. Trevor King Date: Sat, 10 May 2014 17:03:32 +0000 (+1700) Subject: [PATCH v2 1/5] doc: Allow rst2man.py as an alternative to rst2man X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8661e3efaf278bca71867cc2ac820a96bfcad650;p=notmuch-archives.git [PATCH v2 1/5] doc: Allow rst2man.py as an alternative to rst2man --- diff --git a/d9/2c7f2d8ed98ce9bb36c4c5385d81adbb294326 b/d9/2c7f2d8ed98ce9bb36c4c5385d81adbb294326 new file mode 100644 index 000000000..97da4e14e --- /dev/null +++ b/d9/2c7f2d8ed98ce9bb36c4c5385d81adbb294326 @@ -0,0 +1,178 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 16E28431FC2 + for ; Sat, 10 May 2014 10:10:40 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id rMU4pZ1g1PV0 for ; + Sat, 10 May 2014 10:10:32 -0700 (PDT) +Received: from qmta08.westchester.pa.mail.comcast.net + (qmta08.westchester.pa.mail.comcast.net [76.96.62.80]) + by olra.theworths.org (Postfix) with ESMTP id 4EB40431FBF + for ; Sat, 10 May 2014 10:10:32 -0700 (PDT) +Received: from omta16.westchester.pa.mail.comcast.net ([76.96.62.88]) + by qmta08.westchester.pa.mail.comcast.net with comcast + id 0H3j1o0051uE5Es58HAWug; Sat, 10 May 2014 17:10:30 +0000 +Received: from odin.tremily.us ([24.18.63.50]) + by omta16.westchester.pa.mail.comcast.net with comcast + id 0HAU1o00d152l3L3cHAVGX; Sat, 10 May 2014 17:10:30 +0000 +Received: from mjolnir.tremily.us (unknown [192.168.0.140]) + by odin.tremily.us (Postfix) with ESMTPS id 0FA7E11969A4; + Sat, 10 May 2014 10:04:16 -0700 (PDT) +Received: (nullmailer pid 24529 invoked by uid 1000); + Sat, 10 May 2014 17:03:44 -0000 +From: "W. Trevor King" +To: notmuch@notmuchmail.org +Subject: [PATCH v2 1/5] doc: Allow rst2man.py as an alternative to rst2man +Date: Sat, 10 May 2014 10:03:32 -0700 +Message-Id: + +X-Mailer: git-send-email 1.9.1.353.gc66d89d +In-Reply-To: +References: +In-Reply-To: +References: +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; + s=q20140121; t=1399741830; + bh=XPKzTxLHxzG8cJUIytCGfqNSFtxO0FOYNOfGC92Jpec=; + h=Received:Received:Received:Received:From:To:Subject:Date: + Message-Id; + b=l7xGVWN71+7OENd8SiKZB+w8i9pdBrzBF8lpCiANrPdZCTX3v1G42YEEmCUZihloB + pZBnZvXHl095yaM8a5dMVRyzPL8TqZf5gvhgNf8agA6lk853sBoxV6lwR786CbOcQ8 + XEeXzzE5ZfKt2J40T1zVjPSkzffzC7/VcVG5wL1QUunb0/lo1uJFSEkNrUU5Yewnvt + eVk9cjV4f6ywjrtmcXoZaY8i6B+PwAX2Xs8v5/RSpja4ksQt1KhcHjuCNgLJSy8EYZ + K/JbareZCMLSnPhZ5e5TZEgMzJq7x3c3Ke9RP+Sl9Qy/4QsbQShVTflXQov1ENmQvk + F6Q0q+isK0pfg== +Cc: Tomi Ollila +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sat, 10 May 2014 17:10:40 -0000 + +Gentoo's dev-python/docutils-0.10 installs Docutils scripts with a +*.py extension, so I have /usr/bin/rst2man.py and no rst2man script. +This patch supports users with both types of systems by checking for +rst2man, falling back on rst2man.py, and giving up only if neither is +found. Users can also set the new RST2MAN path variable explicitly +when they call Make: + + make RST2MAN=/my/custom/rst_to_man_converter build-man + +I use POSIX's 'command -v' [1] to find the path to rst2man or +rst2man.py, and save that as RST2MAN in Makefile.config. Then pass +the configured RST2MAN path through to prerst2man.py to use in its +system call. + +We can use a non-empty RST2MAN to check for the availability of an +rst2man program, so there's no need for a separate HAVE_RST2MAN. +However, we keep the existing HAVE_RST2MAN for consistency with +HAVE_SPHINX. + +[1]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html +--- + configure | 15 +++++++++++++-- + doc/Makefile.local | 2 +- + doc/prerst2man.py | 9 +++++---- + 3 files changed, 19 insertions(+), 7 deletions(-) + +diff --git a/configure b/configure +index 9bde2eb..f017af8 100755 +--- a/configure ++++ b/configure +@@ -413,17 +413,24 @@ if hash sphinx-build > /dev/null 2>&1 && python -m sphinx.writers.manpage > /dev + printf "Yes.\n" + have_sphinx=1 + have_rst2man=0 ++ RST2MAN= + else + printf "No (falling back to rst2man).\n" + have_sphinx=0 + + printf "Checking if rst2man is available... " + if rst2man -V > /dev/null 2>&1; then +- printf "Yes.\n" + have_rst2man=1 ++ RST2MAN=$(command -v rst2man) ++ printf "Yes (${RST2MAN}).\n" ++ elif rst2man.py -V > /dev/null 2>&1; then ++ have_rst2man=1 ++ RST2MAN=$(command -v rst2man.py) ++ printf "Yes (${RST2MAN}).\n" + else +- printf "No (so will not install man pages).\n" + have_rst2man=0 ++ RST2MAN= ++ printf "No (so will not install man pages).\n" + fi + fi + +@@ -820,6 +827,10 @@ HAVE_SPHINX=${have_sphinx} + # Whether there's a rst2man binary available for building documentation + HAVE_RST2MAN=${have_rst2man} + ++# The path to the rst2man program for building documentation. Set to ++# an empty string if no such program is available. ++RST2MAN=${RST2MAN} ++ + # The directory to which desktop files should be installed + desktop_dir = \$(prefix)/share/applications + +diff --git a/doc/Makefile.local b/doc/Makefile.local +index bbd4610..d96cdd5 100644 +--- a/doc/Makefile.local ++++ b/doc/Makefile.local +@@ -49,7 +49,7 @@ ifeq ($(HAVE_SPHINX),1) + mv $(DOCBUILDDIR)/man/*.$${section} $(DOCBUILDDIR)/man/man$${section}; \ + done + else ifeq ($(HAVE_RST2MAN),1) +- $(prerst2man) $(srcdir)/doc $(DOCBUILDDIR)/man ++ $(prerst2man) "$(RST2MAN)" $(srcdir)/doc $(DOCBUILDDIR)/man + else + @echo "Fatal: build dependency fail." + @false +diff --git a/doc/prerst2man.py b/doc/prerst2man.py +index 437dea9..81ce817 100644 +--- a/doc/prerst2man.py ++++ b/doc/prerst2man.py +@@ -4,8 +4,9 @@ from os.path import dirname, isdir + from os import makedirs, system + import re + +-sourcedir = argv[1] +-outdir = argv[2] ++rst2man = argv[1] ++sourcedir = argv[2] ++outdir = argv[3] + + if not isdir(outdir): + makedirs(outdir, 0o755) +@@ -59,5 +60,5 @@ for page in man_pages: + outfile.write("".join(lines)) + outfile.close() + +- system('set -x; rst2man {0} {1}/{2}.{3}' +- .format(filename, outdir, page[0], page[4])) ++ system('set -x; {0} {1} {2}/{3}.{4}' ++ .format(rst2man, filename, outdir, page[0], page[4])) +-- +1.9.1.353.gc66d89d +