From 4097514f9697a1baba4ddad1010a434667652214 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 13 Jul 2014 20:10:33 +1700 Subject: [PATCH] [PATCH v3 1/5] doc: Allow rst2man.py as an alternative to rst2man --- 33/5683e6532f64d0abfd6be03ac0fb94fc45645d | 176 ++++++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 33/5683e6532f64d0abfd6be03ac0fb94fc45645d diff --git a/33/5683e6532f64d0abfd6be03ac0fb94fc45645d b/33/5683e6532f64d0abfd6be03ac0fb94fc45645d new file mode 100644 index 000000000..454da5b50 --- /dev/null +++ b/33/5683e6532f64d0abfd6be03ac0fb94fc45645d @@ -0,0 +1,176 @@ +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 0CB85431FCB + for ; Sat, 12 Jul 2014 20:11:43 -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 ewsmFDVjJaaP for ; + Sat, 12 Jul 2014 20:11:37 -0700 (PDT) +Received: from qmta07.emeryville.ca.mail.comcast.net + (qmta07.emeryville.ca.mail.comcast.net [76.96.30.64]) + by olra.theworths.org (Postfix) with ESMTP id B34D2431FBF + for ; Sat, 12 Jul 2014 20:11:29 -0700 (PDT) +Received: from omta05.emeryville.ca.mail.comcast.net ([76.96.30.43]) + by qmta07.emeryville.ca.mail.comcast.net with comcast + id ReTr1o0030vp7WLA7fBU71; Sun, 13 Jul 2014 03:11:28 +0000 +Received: from odin.tremily.us ([24.18.63.50]) + by omta05.emeryville.ca.mail.comcast.net with comcast + id RfBS1o00F152l3L8RfBScn; Sun, 13 Jul 2014 03:11:27 +0000 +Received: from mjolnir.tremily.us (unknown [192.168.0.150]) + by odin.tremily.us (Postfix) with ESMTPS id 4D8711286F01; + Sat, 12 Jul 2014 20:11:26 -0700 (PDT) +Received: (nullmailer pid 31448 invoked by uid 1000); + Sun, 13 Jul 2014 03:10:43 -0000 +From: "W. Trevor King" +To: notmuch@notmuchmail.org +Subject: [PATCH v3 1/5] doc: Allow rst2man.py as an alternative to rst2man +Date: Sat, 12 Jul 2014 20:10:33 -0700 +Message-Id: + <2621721db05068dffb65b88cd50d2a5b49e967f5.1405220724.git.wking@tremily.us> +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=1405221088; + bh=r1SmfwLyDrRrHkX+rVyzuMi4ZBAASHPV7xF3klv4OBQ=; + h=Received:Received:Received:Received:From:To:Subject:Date: + Message-Id; + b=YuAelciTpL56w9qBlsej7g1RrVs5sGwK+AFcDPAPmV1xjpZ971hTKln6zx5VTE6Vp + p6A2I7YhyqKnm9sbWf8CyD71Eyy9v/449tzlTiVxiiOL1f50kKgQSNYtfRhd7YSrC0 + oGCyZ/bdL1iy3RFyN58zteZjRcuFltuYCjaY5CPTNVA0jLrL/fVVGSuhRlqAYZHRoe + vRpjMQkWxOXSxUiX8t5VzlWBkUKkvLrqnyzWi2FbiJo9LWF8OihtzJn8U3HRnn5sMG + f0KbeUPk1gXw5rmrS/ATCcG4i826vbWweiQD9BS+M8WN47AK1rEcIX1jNvsUhDwHtK + qX6ca0PLbDkYw== +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: Sun, 13 Jul 2014 03:11:43 -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 + +We 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. +--- + configure | 20 +++++++++++++++----- + doc/Makefile.local | 2 +- + doc/prerst2man.py | 9 +++++---- + 3 files changed, 21 insertions(+), 10 deletions(-) + +diff --git a/configure b/configure +index 9bde2eb..20a2d5f 100755 +--- a/configure ++++ b/configure +@@ -413,17 +413,23 @@ 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 +- else +- printf "No (so will not install man pages).\n" ++ for RST2MAN in rst2man rst2man.py; do ++ if "${RST2MAN}" -V > /dev/null 2>&1; then ++ have_rst2man=1 ++ printf "Yes (${RST2MAN}).\n" ++ break ++ fi ++ RST2MAN= ++ done ++ if [ -z "${RST2MAN}" ]; then + have_rst2man=0 ++ printf "No (so will not install man pages).\n" + fi + fi + +@@ -820,6 +826,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 + -- 2.26.2