Re: [PATCH 5/7] doc: Allow rst2man.py as an alternative to rst2man
authorTomi Ollila <tomi.ollila@iki.fi>
Sat, 5 Apr 2014 19:05:31 +0000 (22:05 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:01:16 +0000 (10:01 -0800)
a3/c2510b8b446b24fb8f94ba34876871df6cbed1 [new file with mode: 0644]

diff --git a/a3/c2510b8b446b24fb8f94ba34876871df6cbed1 b/a3/c2510b8b446b24fb8f94ba34876871df6cbed1
new file mode 100644 (file)
index 0000000..6bbdf15
--- /dev/null
@@ -0,0 +1,189 @@
+Return-Path: <tomi.ollila@iki.fi>\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 1F22A431FB6\r
+       for <notmuch@notmuchmail.org>; Sat,  5 Apr 2014 12:05:48 -0700 (PDT)\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 zG8OQGF4RQ3n for <notmuch@notmuchmail.org>;\r
+       Sat,  5 Apr 2014 12:05:40 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id AEC71431FAF\r
+       for <notmuch@notmuchmail.org>; Sat,  5 Apr 2014 12:05:39 -0700 (PDT)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+       by guru.guru-group.fi (Postfix) with ESMTP id D5364100051;\r
+       Sat,  5 Apr 2014 22:05:31 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: "W. Trevor King" <wking@tremily.us>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 5/7] doc: Allow rst2man.py as an alternative to rst2man\r
+In-Reply-To:\r
+ <adce76bb9a0ca728d856da4ecaf6b282e22e7440.1396718720.git.wking@tremily.us>\r
+References: <cover.1396718720.git.wking@tremily.us>\r
+       <adce76bb9a0ca728d856da4ecaf6b282e22e7440.1396718720.git.wking@tremily.us>\r
+User-Agent: Notmuch/0.17+174~gef82849 (http://notmuchmail.org) Emacs/24.3.1\r
+       (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+       $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+       !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Sat, 05 Apr 2014 22:05:31 +0300\r
+Message-ID: <m2a9bzd2bo.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\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, 05 Apr 2014 19:05:48 -0000\r
+\r
+On Sat, Apr 05 2014, "W. Trevor King" <wking@tremily.us> wrote:\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
+> I use POSIX's 'command -v' [1] to find the path to rst2man or\r
+> rst2man.py, and save that as RST2MAN in Makefile.config.  We can use a\r
+> non-empty RST2MAN to check for the availability of an rst2man program,\r
+> so there's no need for a separate HAVE_RST2MAN.  Then pass the\r
+> configured RST2MAN path through to prerst2man.py to use in its system\r
+> call.\r
+>\r
+> [1]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html\r
+\r
+This series looks good to me. \r
+\r
+Except the reference to _POSIX_ page. One knows how consistent these\r
+specifications are; alternative:\r
+\r
+http://pubs.opengroup.org/onlinepubs/009695399/utilities/command.html\r
+\r
+mentions additionally that -v flag\r
+"(On systems supporting the User Portability Utilities option.)" \r
+\r
+Also, we don't give such a treatment to other command either; I'd rather\r
+see RST2MAN=rst2man, RST2MAN=rst2man.py *and* RST2MAN= lines used\r
+instead -- the last to set RST2MAN to empty string instead of being unset.\r
+\r
+Tomi\r
+\r
+\r
+> ---\r
+>  configure          | 12 +++++++-----\r
+>  doc/Makefile.local |  6 +++---\r
+>  doc/prerst2man.py  |  9 +++++----\r
+>  3 files changed, 15 insertions(+), 12 deletions(-)\r
+>\r
+> diff --git a/configure b/configure\r
+> index 1d430b9..81c286b 100755\r
+> --- a/configure\r
+> +++ b/configure\r
+> @@ -400,7 +400,6 @@ printf "Checking if sphinx is available and supports nroff output... "\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
+> @@ -408,10 +407,12 @@ else\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
+> +       RST2MAN=$(command -v rst2man)\r
+> +    elif rst2man.py -V > /dev/null 2>&1; then\r
+> +       printf "Yes.\n"\r
+> +       RST2MAN=$(command -v rst2man.py)\r
+>      else\r
+>         printf "No (so will not install man pages).\n"\r
+> -       have_rst2man=0\r
+>      fi\r
+>  fi\r
+>  \r
+> @@ -788,8 +789,9 @@ HAVE_EMACS = ${have_emacs}\r
+>  # Whether there's a sphinx-build binary available for building documentation\r
+>  HAVE_SPHINX=${have_sphinx}\r
+>  \r
+> -# Whether there's a rst2man binary available for building documentation\r
+> -HAVE_RST2MAN=${have_rst2man}\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
+> diff --git a/doc/Makefile.local b/doc/Makefile.local\r
+> index 0980c71..e08fc99 100644\r
+> --- a/doc/Makefile.local\r
+> +++ b/doc/Makefile.local\r
+> @@ -42,8 +42,8 @@ ifeq ($(HAVE_SPHINX),1)\r
+>          mkdir -p $(DOCBUILDDIR)/man/man$${section}; \\r
+>          mv $(DOCBUILDDIR)/man/*.$${section} $(DOCBUILDDIR)/man/man$${section}; \\r
+>      done\r
+> -else ifeq ($(HAVE_RST2MAN),1)\r
+> -    $(prerst2man) $(srcdir)/doc $(DOCBUILDDIR)/man\r
+> +else ifdef RST2MAN\r
+> +    $(prerst2man) "$(RST2MAN)" $(srcdir)/doc $(DOCBUILDDIR)/man\r
+>  else\r
+>      @echo "Fatal: build dependency fail."\r
+>      @false\r
+> @@ -51,7 +51,7 @@ endif\r
+>  \r
+>  # Do not try to build or install man pages if a man page converter is\r
+>  # not available.\r
+> -ifeq ($(HAVE_SPHINX)$(HAVE_RST2MAN),00)\r
+> +ifeq ($(HAVE_SPHINX)$(RST2MAN),0)\r
+>  build-man:\r
+>  install-man:\r
+>      @echo "No sphinx or rst2man, will not install man pages."\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
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r