--- /dev/null
+Return-Path: <jani@nikula.org>\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 13A7B429E45\r
+ for <notmuch@notmuchmail.org>; Tue, 25 Feb 2014 12:24:28 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 kSy1RAh28Geg for <notmuch@notmuchmail.org>;\r
+ Tue, 25 Feb 2014 12:24:19 -0800 (PST)\r
+Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com\r
+ [74.125.83.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ D7BB2429E43 for <notmuch@notmuchmail.org>; Tue, 25 Feb 2014 12:24:18 -0800\r
+ (PST)\r
+Received: by mail-ee0-f53.google.com with SMTP id c13so1330404eek.12\r
+ for <notmuch@notmuchmail.org>; Tue, 25 Feb 2014 12:24:17 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:subject:in-reply-to:references\r
+ :user-agent:date:message-id:mime-version:content-type;\r
+ bh=l1UErZuhfXOfXJowoTTkJyebNxQrP0K3+DOC9KLzSpM=;\r
+ b=JvfPyMPheBshav2VRuVl8OzS89HvI/FPLbYEZA5Gp44IOTpvxpp/07jKZTWg9TwpuC\r
+ 1dXwQCQjdYaq4K/WP15mC8gkcVazmqANY+/DDHhbKFR0eN+TO7KkZIpyIhfVwpjlMaLu\r
+ tTkd3z2xDDBUTxh1uhuaqaoJzi1MNrq9/rk+p74t27Um7fl7QBP/avsW5Lygx9lfB4+K\r
+ HEu1W+1vt8uZIx+deHEYUNc+pKP9u96XX/Q+kc5bO2o3sYiYMmbWTMBoruqbyI1taaL5\r
+ etmy0FnwuvEFWzd7hhbGfkUIO9mR6MTEP0NqxLWkpww42CbD/K7zm+k74114uHxpZ2CJ\r
+ dNNg==\r
+X-Gm-Message-State:\r
+ ALoCoQnWsSLGbFtWdGJyra3yqXwY0QmYhGyBMuLIjMONqaWtLIiSG9Xzg7j2BVhYO08USsSRHxeV\r
+X-Received: by 10.14.175.129 with SMTP id z1mr1834188eel.97.1393359856075;\r
+ Tue, 25 Feb 2014 12:24:16 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
+ [88.195.111.91]) by mx.google.com with ESMTPSA id\r
+ k41sm80332527een.19.2014.02.25.12.24.14 for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Tue, 25 Feb 2014 12:24:15 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+Subject: Re: [RFC PATCH v4 2/3] doc: add target rst2man to build man pages\r
+ using rst2man\r
+In-Reply-To: <1393329181-17404-3-git-send-email-david@tethera.net>\r
+References: <1393329181-17404-1-git-send-email-david@tethera.net>\r
+ <1393329181-17404-3-git-send-email-david@tethera.net>\r
+User-Agent: Notmuch/0.17+100~g8bf655b52f07 (http://notmuchmail.org)\r
+ Emacs/24.3.1 (x86_64-pc-linux-gnu)\r
+Date: Tue, 25 Feb 2014 22:24:13 +0200\r
+Message-ID: <871tyr0wlu.fsf@nikula.org>\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: Tue, 25 Feb 2014 20:24:28 -0000\r
+\r
+On Tue, 25 Feb 2014, David Bremner <david@tethera.net> wrote:\r
+> Many people have docutils installed, but not sphinx. Allow these\r
+> people to build the man pages.\r
+\r
+Some bikeshedding... :)\r
+\r
+I think I'd prefer sphinx and docutils to be checked in the configure\r
+script (preferring sphinx over rst2man if available, obviously) and\r
+combining the doc build process so that a simple 'make doc' or similar\r
+does the right thing. With that, it would be nice if the rst2man stuff\r
+didn't have to be in another subdirectory.\r
+\r
+That said, I believe all of this can be a follow-up patch.\r
+\r
+BR,\r
+Jani.\r
+\r
+\r
+> ---\r
+> Makefile | 2 +-\r
+> doc/conf.py | 2 +-\r
+> doc/rst2man/Makefile | 5 +++++\r
+> doc/rst2man/Makefile.local | 37 ++++++++++++++++++++++++++++++++\r
+> doc/rst2man/prerst2man.py | 53 ++++++++++++++++++++++++++++++++++++++++++++++\r
+> 5 files changed, 97 insertions(+), 2 deletions(-)\r
+> create mode 100644 doc/rst2man/Makefile\r
+> create mode 100644 doc/rst2man/Makefile.local\r
+> create mode 100644 doc/rst2man/prerst2man.py\r
+>\r
+> diff --git a/Makefile b/Makefile\r
+> index 39f0e62..3c7f0be 100644\r
+> --- a/Makefile\r
+> +++ b/Makefile\r
+> @@ -5,7 +5,7 @@ all:\r
+> # List all subdirectories here. Each contains its own Makefile.local.\r
+> # Use of '=', without '+=', seems to be required for out-of-tree\r
+> # builds to work.\r
+> -subdirs = compat completion doc emacs lib man parse-time-string performance-test util test\r
+> +subdirs = compat completion doc doc/rst2man emacs lib man parse-time-string performance-test util test\r
+> \r
+> # We make all targets depend on the Makefiles themselves.\r
+> global_deps = Makefile Makefile.config Makefile.local \\r
+> diff --git a/doc/conf.py b/doc/conf.py\r
+> index d80b2af..9180d86 100644\r
+> --- a/doc/conf.py\r
+> +++ b/doc/conf.py\r
+> @@ -21,7 +21,7 @@ release = '0.17'\r
+> \r
+> # List of patterns, relative to source directory, that match files and\r
+> # directories to ignore when looking for source files.\r
+> -exclude_patterns = ['_build']\r
+> +exclude_patterns = ['_build','rst2man']\r
+> \r
+> # The name of the Pygments (syntax highlighting) style to use.\r
+> pygments_style = 'sphinx'\r
+> diff --git a/doc/rst2man/Makefile b/doc/rst2man/Makefile\r
+> new file mode 100644\r
+> index 0000000..0a0815d\r
+> --- /dev/null\r
+> +++ b/doc/rst2man/Makefile\r
+> @@ -0,0 +1,5 @@\r
+> +all:\r
+> + $(MAKE) -C ../.. all\r
+> +\r
+> +.DEFAULT:\r
+> + $(MAKE) -C ../.. $@\r
+> diff --git a/doc/rst2man/Makefile.local b/doc/rst2man/Makefile.local\r
+> new file mode 100644\r
+> index 0000000..bc821fe\r
+> --- /dev/null\r
+> +++ b/doc/rst2man/Makefile.local\r
+> @@ -0,0 +1,37 @@\r
+> +# -*- Makefile -*-\r
+> +dir := doc/rst2man\r
+> +\r
+> +prerst2man := python $(dir)/prerst2man.py $(dir)/.. $(dir)\r
+> +\r
+> +%.1 :%.rst\r
+> + rst2man $< > $@\r
+> +\r
+> +%.5 :%.rst\r
+> + rst2man $< > $@\r
+> +\r
+> +%.7: %.rst\r
+> + rst2man $< > $@\r
+> +\r
+> +# actual source files\r
+> +RST1SRC := $(wildcard doc/man1/*.rst)\r
+> +RST5SRC := $(wildcard doc/man5/*.rst)\r
+> +RST7SRC := $(wildcard doc/man7/*.rst)\r
+> +\r
+> +RST2MAN1SRC := $(patsubst doc/man1/%,doc/rst2man/man1/%,$(RST1SRC))\r
+> +RST2MAN5SRC := $(patsubst doc/man5/%,doc/rst2man/man5/%,$(RST5SRC))\r
+> +RST2MAN7SRC := $(patsubst doc/man7/%,doc/rst2man/man7/%,$(RST7SRC))\r
+> +\r
+> +RST2MANSRC := ${RST2MAN1SRC} ${RST2MAN5SRC} ${RST2MAN7SRC}\r
+> +\r
+> +MAN1SRC := $(patsubst $(dir)/man1/%.rst,$(dir)/man1/%.1,${RST2MAN1SRC})\r
+> +MAN5SRC := $(patsubst $(dir)/man5/%.rst,$(dir)/man5/%.5,${RST2MAN5SRC})\r
+> +MAN7SRC := $(patsubst $(dir)/man7/%.rst,$(dir)/man7/%.7,${RST2MAN7SRC})\r
+> +MANSRC := ${MAN1SRC} ${MAN5SRC} ${MAN7SRC}\r
+> +\r
+> +rst2man: ${MANSRC}\r
+> +\r
+> +${RST2MANSRC}: ${RSTSRC}\r
+> + mkdir -p doc/rst2man/man1 doc/rst2man/man5 doc/rst2man/man7\r
+> + $(prerst2man)\r
+> +\r
+> +CLEAN := ${CLEAN} ${RST2MANSRC} ${MANSRC}\r
+> diff --git a/doc/rst2man/prerst2man.py b/doc/rst2man/prerst2man.py\r
+> new file mode 100644\r
+> index 0000000..797dd20\r
+> --- /dev/null\r
+> +++ b/doc/rst2man/prerst2man.py\r
+> @@ -0,0 +1,53 @@\r
+> +from sys import argv\r
+> +from datetime import date\r
+> +import re\r
+> +\r
+> +sourcedir=argv[1]\r
+> +outdir=argv[2]\r
+> +\r
+> +execfile(sourcedir+"/conf.py");\r
+> +\r
+> +\r
+> +\r
+> +\r
+> +def header(file,startdocname, command, description, authors, section):\r
+> + file.write("""\r
+> +{:s}\r
+> +{:s}\r
+> +{:s}\r
+> +\r
+> +:Date: {:s}\r
+> +:Version: {:s}\r
+> +:Manual section: {:d}\r
+> +:Manual group: {:s}\r
+> +\r
+> +""".format(\r
+> +'-' * len(description),\r
+> +description,\r
+> +'-' * len(description),\r
+> +date.today().isoformat(),release,section,project))\r
+> +\r
+> +blankre = re.compile("^\s*$")\r
+> +for page in man_pages:\r
+> + outfile = open(outdir+"/"+page[0]+'.rst','w')\r
+> + infile = open(sourcedir+"/"+page[0]+".rst",'r')\r
+> +\r
+> +\r
+> + # this is a crude hack. We look for the first blank line, and\r
+> + # insert the rst2man header there.\r
+> + #\r
+> + # XXX consider really parsing input\r
+> +\r
+> + count=0\r
+> + lines = infile.readlines()\r
+> + for line in lines:\r
+> + outfile.write(line);\r
+> + if (blankre.match(line)):\r
+> + break\r
+> + count = count + 1\r
+> +\r
+> + del lines[0:count+1]\r
+> +\r
+> + header(outfile,*page)\r
+> +\r
+> + outfile.write("".join(lines))\r
+> -- \r
+> 1.8.5.3\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r