New "notmuch address" command
[notmuch-archives.git] / d5 / afc6209def9c7e7d72fb5959343076a2edc0d9
1 Return-Path: <wking@tremily.us>\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 16A2D431FD2\r
6         for <notmuch@notmuchmail.org>; Sat, 12 Jul 2014 20:11:45 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
9 X-Spam-Flag: NO\r
10 X-Spam-Score: 0\r
11 X-Spam-Level: \r
12 X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
13         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001]\r
14         autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id WLPFrhcQSuAz for <notmuch@notmuchmail.org>;\r
18         Sat, 12 Jul 2014 20:11:38 -0700 (PDT)\r
19 Received: from qmta04.emeryville.ca.mail.comcast.net\r
20         (qmta04.emeryville.ca.mail.comcast.net [76.96.30.40])\r
21         by olra.theworths.org (Postfix) with ESMTP id B8F00431FC0\r
22         for <notmuch@notmuchmail.org>; Sat, 12 Jul 2014 20:11:29 -0700 (PDT)\r
23 Received: from omta16.emeryville.ca.mail.comcast.net ([76.96.30.72])\r
24         by qmta04.emeryville.ca.mail.comcast.net with comcast\r
25         id Rf9p1o0011ZMdJ4A4fBVAq; Sun, 13 Jul 2014 03:11:29 +0000\r
26 Received: from odin.tremily.us ([24.18.63.50])\r
27         by omta16.emeryville.ca.mail.comcast.net with comcast\r
28         id RfBT1o003152l3L8cfBTGn; Sun, 13 Jul 2014 03:11:28 +0000\r
29 Received: from mjolnir.tremily.us (unknown [192.168.0.150])\r
30         by odin.tremily.us (Postfix) with ESMTPS id CD3FB1286F03;\r
31         Sat, 12 Jul 2014 20:11:26 -0700 (PDT)\r
32 Received: (nullmailer pid 31450 invoked by uid 1000);\r
33         Sun, 13 Jul 2014 03:10:44 -0000\r
34 From: "W. Trevor King" <wking@tremily.us>\r
35 To: notmuch@notmuchmail.org\r
36 Subject: [PATCH v3 2/5] doc/prerst2man.py: Convert execfile to import\r
37 Date: Sat, 12 Jul 2014 20:10:34 -0700\r
38 Message-Id:\r
39  <8cc9dd580ad672527e12f43706f9803b2c8e99d8.1405220724.git.wking@tremily.us>\r
40 X-Mailer: git-send-email 1.9.1.353.gc66d89d\r
41 In-Reply-To: <cover.1405220724.git.wking@tremily.us>\r
42 References: <cover.1405220724.git.wking@tremily.us>\r
43 In-Reply-To: <cover.1405220724.git.wking@tremily.us>\r
44 References: <cover.1405220724.git.wking@tremily.us>\r
45 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
46         s=q20140121; t=1405221089;\r
47         bh=surGy6r4gr9e//xrzFrd6sbiw4m4FMtByh0+q6ZgS2o=;\r
48         h=Received:Received:Received:Received:From:To:Subject:Date:\r
49         Message-Id;\r
50         b=WzUD0km5VsFm2RTPQuCOU98uzGwiK9/Irq+AFWnWvVnuir6v6Cr/O6naCnbVhHQbw\r
51         U8A4oKKQCUG2sHqAkkqv+Q4eHlGz0IpRXGZktF/wx3jXBFD6UezJyvVcIJGLTtWzUX\r
52         eT2r+F4SqA6eTaSrntcK/d3g343+KJpBpP3CDtUPuMdmTAXrob9QnEigwSlNzaLiJ1\r
53         wW9e5Qzo4hwt+KD7egmEyqXlNnOjCAa5h1FzySUqpMQBYsBSAWfVeegroYxfQeu2p7\r
54         m8vo7y/W3nEr2PYdqc2Al1zxgIraDEFiM4wLVkH9nS7gv+LtLRvytomRNSW5y7LLWs\r
55         NtNxdJWfSg71A==\r
56 Cc: Tomi Ollila <tomi.ollila@iki.fi>\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: Sun, 13 Jul 2014 03:11:45 -0000\r
70 \r
71 excefile is gone in Python 3 [1].  Instead of exec-ing the\r
72 configuration, it's easier to insert the source directory in Python's\r
73 path [2], and just import the configuration.  With this change,\r
74 prerst2man.py is compatible with both Python 2 and 3.\r
75 \r
76 [1]: https://docs.python.org/3.0/whatsnew/3.0.html#builtins\r
77 [2]: https://docs.python.org/3/library/sys.html#sys.path\r
78 ---\r
79  doc/prerst2man.py | 18 ++++++++++--------\r
80  1 file changed, 10 insertions(+), 8 deletions(-)\r
81 \r
82 diff --git a/doc/prerst2man.py b/doc/prerst2man.py\r
83 index 81ce817..7d78e9b 100644\r
84 --- a/doc/prerst2man.py\r
85 +++ b/doc/prerst2man.py\r
86 @@ -1,18 +1,20 @@\r
87 -from sys import argv\r
88 +import sys\r
89  from datetime import date\r
90  from os.path import dirname, isdir\r
91  from os import makedirs, system\r
92  import re\r
93  \r
94 -rst2man = argv[1]\r
95 -sourcedir = argv[2]\r
96 -outdir = argv[3]\r
97 +rst2man = sys.argv[1]\r
98 +sourcedir = sys.argv[2]\r
99 +outdir = sys.argv[3]\r
100 +\r
101 +sys.path.insert(0, sourcedir)\r
102 +import conf\r
103 +\r
104  \r
105  if not isdir(outdir):\r
106      makedirs(outdir, 0o755)\r
107  \r
108 -execfile(sourcedir + "/conf.py")\r
109 -\r
110  \r
111  def header(file, startdocname, command, description, authors, section):\r
112      file.write("""\r
113 @@ -29,10 +31,10 @@ def header(file, startdocname, command, description, authors, section):\r
114  '-' * len(description),\r
115  description,\r
116  '-' * len(description),\r
117 -date.today().isoformat(), release, section, project))\r
118 +date.today().isoformat(), conf.release, section, conf.project))\r
119  \r
120  blankre = re.compile("^\s*$")\r
121 -for page in man_pages:\r
122 +for page in conf.man_pages:\r
123      outdirname = outdir + '/' + dirname(page[0])\r
124      if not isdir(outdirname):\r
125          makedirs(outdirname, 0o755)\r
126 -- \r
127 1.9.1.353.gc66d89d\r
128 \r