[PATCH v2 2/5] doc/prerst2man.py: Convert execfile to import
authorW. Trevor King <wking@tremily.us>
Sat, 10 May 2014 17:03:33 +0000 (10:03 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:02:36 +0000 (10:02 -0800)
0f/a56609cd8db1c4b5d4a8d3f9f727ab326e35d2 [new file with mode: 0644]

diff --git a/0f/a56609cd8db1c4b5d4a8d3f9f727ab326e35d2 b/0f/a56609cd8db1c4b5d4a8d3f9f727ab326e35d2
new file mode 100644 (file)
index 0000000..84bb10b
--- /dev/null
@@ -0,0 +1,128 @@
+Return-Path: <wking@tremily.us>\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 2291D431FCB\r
+       for <notmuch@notmuchmail.org>; Sat, 10 May 2014 10:04:26 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\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\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001]\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 fW8toSVKpUom for <notmuch@notmuchmail.org>;\r
+       Sat, 10 May 2014 10:04:18 -0700 (PDT)\r
+Received: from qmta03.westchester.pa.mail.comcast.net\r
+       (qmta03.westchester.pa.mail.comcast.net [76.96.62.32])\r
+       by olra.theworths.org (Postfix) with ESMTP id 9035A431FC0\r
+       for <notmuch@notmuchmail.org>; Sat, 10 May 2014 10:04:18 -0700 (PDT)\r
+Received: from omta18.westchester.pa.mail.comcast.net ([76.96.62.90])\r
+       by qmta03.westchester.pa.mail.comcast.net with comcast\r
+       id 0Glh1o0041wpRvQ53H4JYo; Sat, 10 May 2014 17:04:18 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+       by omta18.westchester.pa.mail.comcast.net with comcast\r
+       id 0H4G1o00o152l3L3eH4Hor; Sat, 10 May 2014 17:04:18 +0000\r
+Received: from mjolnir.tremily.us (unknown [192.168.0.140])\r
+       by odin.tremily.us (Postfix) with ESMTPS id A20E311969A7;\r
+       Sat, 10 May 2014 10:04:16 -0700 (PDT)\r
+Received: (nullmailer pid 24531 invoked by uid 1000);\r
+       Sat, 10 May 2014 17:03:44 -0000\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 2/5] doc/prerst2man.py: Convert execfile to import\r
+Date: Sat, 10 May 2014 10:03:33 -0700\r
+Message-Id:\r
+ <4f5a9c7d4fc607128aebbc1443d6da5439f0d2eb.1399740604.git.wking@tremily.us>\r
+X-Mailer: git-send-email 1.9.1.353.gc66d89d\r
+In-Reply-To: <cover.1399740604.git.wking@tremily.us>\r
+References: <cover.1399740604.git.wking@tremily.us>\r
+In-Reply-To: <cover.1399740604.git.wking@tremily.us>\r
+References: <cover.1399740604.git.wking@tremily.us>\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+       s=q20140121; t=1399741458;\r
+       bh=surGy6r4gr9e//xrzFrd6sbiw4m4FMtByh0+q6ZgS2o=;\r
+       h=Received:Received:Received:Received:From:To:Subject:Date:\r
+       Message-Id;\r
+       b=CDqLKR3sxW14Oi+IfJwyl4Kz4eirvIFoi8xX/x4p+UwOFSpV9bWCwKLhLNPcp9WPY\r
+       BGZe0cmEF1EQUWSizGvrzSJJTUr4MLfpTCp1org7U0h4UHJtiq2TOVaEWaiiJNwwny\r
+       bK0FHdiHx1MFEeNhT/LZD37+gvB/Kvd9asc3AhcEyozRn8iV3slZaft62F1zY1jGnL\r
+       GrCnONYDhXi+EJKqq77kAYY8qmjsv1nmsVeAzTKrXz74TrZHxI27mpWjHVhlrBlEt3\r
+       yhpw3Ety4kR7G0W53dSlDFQcdTXzyx+UGI4iXVzvwHcBT2n/mz6otcIaA0T8ohYIrs\r
+       IxDlf1krX4P1Q==\r
+Cc: Tomi Ollila <tomi.ollila@iki.fi>\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, 10 May 2014 17:04:26 -0000\r
+\r
+excefile is gone in Python 3 [1].  Instead of exec-ing the\r
+configuration, it's easier to insert the source directory in Python's\r
+path [2], and just import the configuration.  With this change,\r
+prerst2man.py is compatible with both Python 2 and 3.\r
+\r
+[1]: https://docs.python.org/3.0/whatsnew/3.0.html#builtins\r
+[2]: https://docs.python.org/3/library/sys.html#sys.path\r
+---\r
+ doc/prerst2man.py | 18 ++++++++++--------\r
+ 1 file changed, 10 insertions(+), 8 deletions(-)\r
+\r
+diff --git a/doc/prerst2man.py b/doc/prerst2man.py\r
+index 81ce817..7d78e9b 100644\r
+--- a/doc/prerst2man.py\r
++++ b/doc/prerst2man.py\r
+@@ -1,18 +1,20 @@\r
+-from sys import argv\r
++import sys\r
+ from datetime import date\r
+ from os.path import dirname, isdir\r
+ from os import makedirs, system\r
+ import re\r
\r
+-rst2man = argv[1]\r
+-sourcedir = argv[2]\r
+-outdir = argv[3]\r
++rst2man = sys.argv[1]\r
++sourcedir = sys.argv[2]\r
++outdir = sys.argv[3]\r
++\r
++sys.path.insert(0, sourcedir)\r
++import conf\r
++\r
\r
+ if not isdir(outdir):\r
+     makedirs(outdir, 0o755)\r
\r
+-execfile(sourcedir + "/conf.py")\r
+-\r
\r
+ def header(file, startdocname, command, description, authors, section):\r
+     file.write("""\r
+@@ -29,10 +31,10 @@ def header(file, startdocname, command, description, authors, section):\r
+ '-' * len(description),\r
+ description,\r
+ '-' * len(description),\r
+-date.today().isoformat(), release, section, project))\r
++date.today().isoformat(), conf.release, section, conf.project))\r
\r
+ blankre = re.compile("^\s*$")\r
+-for page in man_pages:\r
++for page in conf.man_pages:\r
+     outdirname = outdir + '/' + dirname(page[0])\r
+     if not isdir(outdirname):\r
+         makedirs(outdirname, 0o755)\r
+-- \r
+1.9.1.353.gc66d89d\r
+\r