unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: notmuch@notmuchmail.org, wking@tremily.us
Cc: tomi.ollila@iki.fi
Subject: [PATCH] doc: Allow rst2man.py as an alternative to rst2man
Date: Sat,  3 Jan 2015 16:14:39 +0200	[thread overview]
Message-ID: <1420294479-27224-1-git-send-email-tomi.ollila@iki.fi> (raw)

From: W. Trevor King <wking@tremily.us>

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.
---

rebased original
id:2621721db05068dffb65b88cd50d2a5b49e967f5.1405220724.git.wking@tremily.us

rebased by simply doing patch -p1 < patchfile and then creating commit.


 configure          | 20 +++++++++++++++-----
 doc/Makefile.local |  2 +-
 doc/prerst2man.py  |  9 +++++----
 3 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 9c98040c4531..8a4305f8bde3 100755
--- a/configure
+++ b/configure
@@ -455,17 +455,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
 
@@ -861,6 +867,10 @@ HAVE_RST2MAN=${have_rst2man}
 # Whether there's a doxygen binary available for building api documentation
 HAVE_DOXYGEN=${have_doxygen}
 
+# 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 e7d0bac8f3fb..a13cb3731664 100644
--- a/doc/Makefile.local
+++ b/doc/Makefile.local
@@ -51,7 +51,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 968722a1c750..2e87976c5d96 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)
@@ -60,5 +61,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]))
-- 
2.0.0

             reply	other threads:[~2015-01-03 14:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-03 14:14 Tomi Ollila [this message]
2015-01-03 15:49 ` [PATCH] doc: Allow rst2man.py as an alternative to rst2man David Bremner
2015-01-03 16:45   ` W. Trevor King
2015-01-03 17:12     ` Tomi Ollila
2015-01-03 18:11       ` David Bremner
2015-01-03 18:35       ` W. Trevor King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1420294479-27224-1-git-send-email-tomi.ollila@iki.fi \
    --to=tomi.ollila@iki.fi \
    --cc=notmuch@notmuchmail.org \
    --cc=wking@tremily.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).