Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 89 / 2ab96f88f92a51fe3152bfe981a82cba7bcec3
1 Return-Path: <jani@nikula.org>\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 13A7B429E45\r
6         for <notmuch@notmuchmail.org>; Tue, 25 Feb 2014 12:24:28 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\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 kSy1RAh28Geg for <notmuch@notmuchmail.org>;\r
16         Tue, 25 Feb 2014 12:24:19 -0800 (PST)\r
17 Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com\r
18  [74.125.83.53])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
19  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
20  D7BB2429E43    for <notmuch@notmuchmail.org>; Tue, 25 Feb 2014 12:24:18 -0800\r
21  (PST)\r
22 Received: by mail-ee0-f53.google.com with SMTP id c13so1330404eek.12\r
23         for <notmuch@notmuchmail.org>; Tue, 25 Feb 2014 12:24:17 -0800 (PST)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25         d=1e100.net; s=20130820;\r
26         h=x-gm-message-state:from:to:subject:in-reply-to:references\r
27         :user-agent:date:message-id:mime-version:content-type;\r
28         bh=l1UErZuhfXOfXJowoTTkJyebNxQrP0K3+DOC9KLzSpM=;\r
29         b=JvfPyMPheBshav2VRuVl8OzS89HvI/FPLbYEZA5Gp44IOTpvxpp/07jKZTWg9TwpuC\r
30         1dXwQCQjdYaq4K/WP15mC8gkcVazmqANY+/DDHhbKFR0eN+TO7KkZIpyIhfVwpjlMaLu\r
31         tTkd3z2xDDBUTxh1uhuaqaoJzi1MNrq9/rk+p74t27Um7fl7QBP/avsW5Lygx9lfB4+K\r
32         HEu1W+1vt8uZIx+deHEYUNc+pKP9u96XX/Q+kc5bO2o3sYiYMmbWTMBoruqbyI1taaL5\r
33         etmy0FnwuvEFWzd7hhbGfkUIO9mR6MTEP0NqxLWkpww42CbD/K7zm+k74114uHxpZ2CJ\r
34         dNNg==\r
35 X-Gm-Message-State:\r
36  ALoCoQnWsSLGbFtWdGJyra3yqXwY0QmYhGyBMuLIjMONqaWtLIiSG9Xzg7j2BVhYO08USsSRHxeV\r
37 X-Received: by 10.14.175.129 with SMTP id z1mr1834188eel.97.1393359856075;\r
38         Tue, 25 Feb 2014 12:24:16 -0800 (PST)\r
39 Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
40         [88.195.111.91]) by mx.google.com with ESMTPSA id\r
41         k41sm80332527een.19.2014.02.25.12.24.14 for <multiple recipients>\r
42         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
43         Tue, 25 Feb 2014 12:24:15 -0800 (PST)\r
44 From: Jani Nikula <jani@nikula.org>\r
45 To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
46 Subject: Re: [RFC PATCH v4 2/3] doc: add target rst2man to build man pages\r
47         using rst2man\r
48 In-Reply-To: <1393329181-17404-3-git-send-email-david@tethera.net>\r
49 References: <1393329181-17404-1-git-send-email-david@tethera.net>\r
50         <1393329181-17404-3-git-send-email-david@tethera.net>\r
51 User-Agent: Notmuch/0.17+100~g8bf655b52f07 (http://notmuchmail.org)\r
52         Emacs/24.3.1 (x86_64-pc-linux-gnu)\r
53 Date: Tue, 25 Feb 2014 22:24:13 +0200\r
54 Message-ID: <871tyr0wlu.fsf@nikula.org>\r
55 MIME-Version: 1.0\r
56 Content-Type: text/plain\r
57 X-BeenThere: notmuch@notmuchmail.org\r
58 X-Mailman-Version: 2.1.13\r
59 Precedence: list\r
60 List-Id: "Use and development of the notmuch mail system."\r
61         <notmuch.notmuchmail.org>\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
65 List-Post: <mailto:notmuch@notmuchmail.org>\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
68         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
69 X-List-Received-Date: Tue, 25 Feb 2014 20:24:28 -0000\r
70 \r
71 On Tue, 25 Feb 2014, David Bremner <david@tethera.net> wrote:\r
72 > Many people have docutils installed, but not sphinx. Allow these\r
73 > people to build the man pages.\r
74 \r
75 Some bikeshedding... :)\r
76 \r
77 I think I'd prefer sphinx and docutils to be checked in the configure\r
78 script (preferring sphinx over rst2man if available, obviously) and\r
79 combining the doc build process so that a simple 'make doc' or similar\r
80 does the right thing. With that, it would be nice if the rst2man stuff\r
81 didn't have to be in another subdirectory.\r
82 \r
83 That said, I believe all of this can be a follow-up patch.\r
84 \r
85 BR,\r
86 Jani.\r
87 \r
88 \r
89 > ---\r
90 >  Makefile                   |  2 +-\r
91 >  doc/conf.py                |  2 +-\r
92 >  doc/rst2man/Makefile       |  5 +++++\r
93 >  doc/rst2man/Makefile.local | 37 ++++++++++++++++++++++++++++++++\r
94 >  doc/rst2man/prerst2man.py  | 53 ++++++++++++++++++++++++++++++++++++++++++++++\r
95 >  5 files changed, 97 insertions(+), 2 deletions(-)\r
96 >  create mode 100644 doc/rst2man/Makefile\r
97 >  create mode 100644 doc/rst2man/Makefile.local\r
98 >  create mode 100644 doc/rst2man/prerst2man.py\r
99 >\r
100 > diff --git a/Makefile b/Makefile\r
101 > index 39f0e62..3c7f0be 100644\r
102 > --- a/Makefile\r
103 > +++ b/Makefile\r
104 > @@ -5,7 +5,7 @@ all:\r
105 >  # List all subdirectories here. Each contains its own Makefile.local.\r
106 >  # Use of '=', without '+=', seems to be required for out-of-tree\r
107 >  # builds to work.\r
108 > -subdirs = compat completion doc emacs lib man parse-time-string performance-test util test\r
109 > +subdirs = compat completion doc doc/rst2man emacs lib man parse-time-string performance-test util test\r
110 >  \r
111 >  # We make all targets depend on the Makefiles themselves.\r
112 >  global_deps = Makefile Makefile.config Makefile.local \\r
113 > diff --git a/doc/conf.py b/doc/conf.py\r
114 > index d80b2af..9180d86 100644\r
115 > --- a/doc/conf.py\r
116 > +++ b/doc/conf.py\r
117 > @@ -21,7 +21,7 @@ release = '0.17'\r
118 >  \r
119 >  # List of patterns, relative to source directory, that match files and\r
120 >  # directories to ignore when looking for source files.\r
121 > -exclude_patterns = ['_build']\r
122 > +exclude_patterns = ['_build','rst2man']\r
123 >  \r
124 >  # The name of the Pygments (syntax highlighting) style to use.\r
125 >  pygments_style = 'sphinx'\r
126 > diff --git a/doc/rst2man/Makefile b/doc/rst2man/Makefile\r
127 > new file mode 100644\r
128 > index 0000000..0a0815d\r
129 > --- /dev/null\r
130 > +++ b/doc/rst2man/Makefile\r
131 > @@ -0,0 +1,5 @@\r
132 > +all:\r
133 > +     $(MAKE) -C ../.. all\r
134 > +\r
135 > +.DEFAULT:\r
136 > +     $(MAKE) -C ../.. $@\r
137 > diff --git a/doc/rst2man/Makefile.local b/doc/rst2man/Makefile.local\r
138 > new file mode 100644\r
139 > index 0000000..bc821fe\r
140 > --- /dev/null\r
141 > +++ b/doc/rst2man/Makefile.local\r
142 > @@ -0,0 +1,37 @@\r
143 > +# -*- Makefile -*-\r
144 > +dir := doc/rst2man\r
145 > +\r
146 > +prerst2man := python $(dir)/prerst2man.py $(dir)/.. $(dir)\r
147 > +\r
148 > +%.1 :%.rst\r
149 > +     rst2man $< > $@\r
150 > +\r
151 > +%.5 :%.rst\r
152 > +     rst2man $< > $@\r
153 > +\r
154 > +%.7: %.rst\r
155 > +     rst2man $< > $@\r
156 > +\r
157 > +# actual source files\r
158 > +RST1SRC := $(wildcard doc/man1/*.rst)\r
159 > +RST5SRC      := $(wildcard doc/man5/*.rst)\r
160 > +RST7SRC := $(wildcard doc/man7/*.rst)\r
161 > +\r
162 > +RST2MAN1SRC := $(patsubst doc/man1/%,doc/rst2man/man1/%,$(RST1SRC))\r
163 > +RST2MAN5SRC := $(patsubst doc/man5/%,doc/rst2man/man5/%,$(RST5SRC))\r
164 > +RST2MAN7SRC := $(patsubst doc/man7/%,doc/rst2man/man7/%,$(RST7SRC))\r
165 > +\r
166 > +RST2MANSRC := ${RST2MAN1SRC} ${RST2MAN5SRC} ${RST2MAN7SRC}\r
167 > +\r
168 > +MAN1SRC := $(patsubst $(dir)/man1/%.rst,$(dir)/man1/%.1,${RST2MAN1SRC})\r
169 > +MAN5SRC := $(patsubst $(dir)/man5/%.rst,$(dir)/man5/%.5,${RST2MAN5SRC})\r
170 > +MAN7SRC := $(patsubst $(dir)/man7/%.rst,$(dir)/man7/%.7,${RST2MAN7SRC})\r
171 > +MANSRC := ${MAN1SRC} ${MAN5SRC} ${MAN7SRC}\r
172 > +\r
173 > +rst2man: ${MANSRC}\r
174 > +\r
175 > +${RST2MANSRC}: ${RSTSRC}\r
176 > +     mkdir -p doc/rst2man/man1 doc/rst2man/man5 doc/rst2man/man7\r
177 > +     $(prerst2man)\r
178 > +\r
179 > +CLEAN := ${CLEAN} ${RST2MANSRC} ${MANSRC}\r
180 > diff --git a/doc/rst2man/prerst2man.py b/doc/rst2man/prerst2man.py\r
181 > new file mode 100644\r
182 > index 0000000..797dd20\r
183 > --- /dev/null\r
184 > +++ b/doc/rst2man/prerst2man.py\r
185 > @@ -0,0 +1,53 @@\r
186 > +from sys import argv\r
187 > +from datetime import date\r
188 > +import re\r
189 > +\r
190 > +sourcedir=argv[1]\r
191 > +outdir=argv[2]\r
192 > +\r
193 > +execfile(sourcedir+"/conf.py");\r
194 > +\r
195 > +\r
196 > +\r
197 > +\r
198 > +def header(file,startdocname, command, description, authors, section):\r
199 > +    file.write("""\r
200 > +{:s}\r
201 > +{:s}\r
202 > +{:s}\r
203 > +\r
204 > +:Date:   {:s}\r
205 > +:Version: {:s}\r
206 > +:Manual section: {:d}\r
207 > +:Manual group: {:s}\r
208 > +\r
209 > +""".format(\r
210 > +'-' * len(description),\r
211 > +description,\r
212 > +'-' * len(description),\r
213 > +date.today().isoformat(),release,section,project))\r
214 > +\r
215 > +blankre = re.compile("^\s*$")\r
216 > +for page in man_pages:\r
217 > +    outfile = open(outdir+"/"+page[0]+'.rst','w')\r
218 > +    infile = open(sourcedir+"/"+page[0]+".rst",'r')\r
219 > +\r
220 > +\r
221 > +    # this is a crude hack. We look for the first blank line, and\r
222 > +    # insert the rst2man header there.\r
223 > +    #\r
224 > +    # XXX consider really parsing input\r
225 > +\r
226 > +    count=0\r
227 > +    lines = infile.readlines()\r
228 > +    for line in lines:\r
229 > +        outfile.write(line);\r
230 > +        if (blankre.match(line)):\r
231 > +            break\r
232 > +        count = count + 1\r
233 > +\r
234 > +    del lines[0:count+1]\r
235 > +\r
236 > +    header(outfile,*page)\r
237 > +\r
238 > +    outfile.write("".join(lines))\r
239 > -- \r
240 > 1.8.5.3\r
241 >\r
242 > _______________________________________________\r
243 > notmuch mailing list\r
244 > notmuch@notmuchmail.org\r
245 > http://notmuchmail.org/mailman/listinfo/notmuch\r