1 Return-Path: <bremner@tethera.net>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 3E845431FCF
\r
6 for <notmuch@notmuchmail.org>; Sat, 22 Feb 2014 16:16:49 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id Vrauy91cHGzj for <notmuch@notmuchmail.org>;
\r
16 Sat, 22 Feb 2014 16:16:47 -0800 (PST)
\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])
\r
18 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id B0A0D431E84
\r
21 for <notmuch@notmuchmail.org>; Sat, 22 Feb 2014 16:16:43 -0800 (PST)
\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)
\r
23 (envelope-from <bremner@tethera.net>)
\r
24 id 1WHMkL-0003q7-8L; Sat, 22 Feb 2014 20:16:41 -0400
\r
25 Received: (nullmailer pid 19429 invoked by uid 1000); Sun, 23 Feb 2014
\r
27 From: David Bremner <david@tethera.net>
\r
28 To: notmuch@notmuchmail.org
\r
29 Subject: [RFC Patch v3 2/3] doc: add target rst2man to build man pages using
\r
31 Date: Sat, 22 Feb 2014 20:16:14 -0400
\r
32 Message-Id: <1393114575-8756-3-git-send-email-david@tethera.net>
\r
33 X-Mailer: git-send-email 1.8.5.3
\r
34 In-Reply-To: <1393114575-8756-1-git-send-email-david@tethera.net>
\r
35 References: <87fvo7btu8.fsf@qmul.ac.uk>
\r
36 <1393114575-8756-1-git-send-email-david@tethera.net>
\r
37 X-BeenThere: notmuch@notmuchmail.org
\r
38 X-Mailman-Version: 2.1.13
\r
40 List-Id: "Use and development of the notmuch mail system."
\r
41 <notmuch.notmuchmail.org>
\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
43 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
45 List-Post: <mailto:notmuch@notmuchmail.org>
\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
49 X-List-Received-Date: Sun, 23 Feb 2014 00:16:49 -0000
\r
51 Many people have docutils installed, but not sphinx. Allow these
\r
52 people to build the man pages.
\r
56 doc/rst2man/Makefile | 5 +++++
\r
57 doc/rst2man/Makefile.local | 37 ++++++++++++++++++++++++++++++++
\r
58 doc/rst2man/prerst2man.py | 53 ++++++++++++++++++++++++++++++++++++++++++++++
\r
59 5 files changed, 97 insertions(+), 2 deletions(-)
\r
60 create mode 100644 doc/rst2man/Makefile
\r
61 create mode 100644 doc/rst2man/Makefile.local
\r
62 create mode 100644 doc/rst2man/prerst2man.py
\r
64 diff --git a/Makefile b/Makefile
\r
65 index 39f0e62..3c7f0be 100644
\r
68 @@ -5,7 +5,7 @@ all:
\r
69 # List all subdirectories here. Each contains its own Makefile.local.
\r
70 # Use of '=', without '+=', seems to be required for out-of-tree
\r
72 -subdirs = compat completion doc emacs lib man parse-time-string performance-test util test
\r
73 +subdirs = compat completion doc doc/rst2man emacs lib man parse-time-string performance-test util test
\r
75 # We make all targets depend on the Makefiles themselves.
\r
76 global_deps = Makefile Makefile.config Makefile.local \
\r
77 diff --git a/doc/conf.py b/doc/conf.py
\r
78 index d80b2af..9180d86 100644
\r
81 @@ -21,7 +21,7 @@ release = '0.17'
\r
83 # List of patterns, relative to source directory, that match files and
\r
84 # directories to ignore when looking for source files.
\r
85 -exclude_patterns = ['_build']
\r
86 +exclude_patterns = ['_build','rst2man']
\r
88 # The name of the Pygments (syntax highlighting) style to use.
\r
89 pygments_style = 'sphinx'
\r
90 diff --git a/doc/rst2man/Makefile b/doc/rst2man/Makefile
\r
91 new file mode 100644
\r
92 index 0000000..0a0815d
\r
94 +++ b/doc/rst2man/Makefile
\r
97 + $(MAKE) -C ../.. all
\r
100 + $(MAKE) -C ../.. $@
\r
101 diff --git a/doc/rst2man/Makefile.local b/doc/rst2man/Makefile.local
\r
102 new file mode 100644
\r
103 index 0000000..bc821fe
\r
105 +++ b/doc/rst2man/Makefile.local
\r
107 +# -*- Makefile -*-
\r
108 +dir := doc/rst2man
\r
110 +prerst2man := python $(dir)/prerst2man.py $(dir)/.. $(dir)
\r
121 +# actual source files
\r
122 +RST1SRC := $(wildcard doc/man1/*.rst)
\r
123 +RST5SRC := $(wildcard doc/man5/*.rst)
\r
124 +RST7SRC := $(wildcard doc/man7/*.rst)
\r
126 +RST2MAN1SRC := $(patsubst doc/man1/%,doc/rst2man/man1/%,$(RST1SRC))
\r
127 +RST2MAN5SRC := $(patsubst doc/man5/%,doc/rst2man/man5/%,$(RST5SRC))
\r
128 +RST2MAN7SRC := $(patsubst doc/man7/%,doc/rst2man/man7/%,$(RST7SRC))
\r
130 +RST2MANSRC := ${RST2MAN1SRC} ${RST2MAN5SRC} ${RST2MAN7SRC}
\r
132 +MAN1SRC := $(patsubst $(dir)/man1/%.rst,$(dir)/man1/%.1,${RST2MAN1SRC})
\r
133 +MAN5SRC := $(patsubst $(dir)/man5/%.rst,$(dir)/man5/%.5,${RST2MAN5SRC})
\r
134 +MAN7SRC := $(patsubst $(dir)/man7/%.rst,$(dir)/man7/%.7,${RST2MAN7SRC})
\r
135 +MANSRC := ${MAN1SRC} ${MAN5SRC} ${MAN7SRC}
\r
137 +rst2man: ${MANSRC}
\r
139 +${RST2MANSRC}: ${RSTSRC}
\r
140 + mkdir -p doc/rst2man/man1 doc/rst2man/man5 doc/rst2man/man7
\r
143 +CLEAN := ${CLEAN} ${RST2MANSRC} ${MANSRC}
\r
144 diff --git a/doc/rst2man/prerst2man.py b/doc/rst2man/prerst2man.py
\r
145 new file mode 100644
\r
146 index 0000000..797dd20
\r
148 +++ b/doc/rst2man/prerst2man.py
\r
150 +from sys import argv
\r
151 +from datetime import date
\r
157 +execfile(sourcedir+"/conf.py");
\r
162 +def header(file,startdocname, command, description, authors, section):
\r
170 +:Manual section: {:d}
\r
171 +:Manual group: {:s}
\r
174 +'-' * len(description),
\r
176 +'-' * len(description),
\r
177 +date.today().isoformat(),release,section,project))
\r
179 +blankre = re.compile("^\s*$")
\r
180 +for page in man_pages:
\r
181 + outfile = open(outdir+"/"+page[0]+'.rst','w')
\r
182 + infile = open(sourcedir+"/"+page[0]+".rst",'r')
\r
185 + # this is a crude hack. We look for the first blank line, and
\r
186 + # insert the rst2man header there.
\r
188 + # XXX consider really parsing input
\r
191 + lines = infile.readlines()
\r
192 + for line in lines:
\r
193 + outfile.write(line);
\r
194 + if (blankre.match(line)):
\r
196 + count = count + 1
\r
198 + del lines[0:count+1]
\r
200 + header(outfile,*page)
\r
202 + outfile.write("".join(lines))
\r