[PATCH 01/17] nmbug-status: Convert to Python-3-compatible print functions
authorW. Trevor King <wking@tremily.us>
Mon, 3 Feb 2014 10:59:19 +0000 (02:59 +1600)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:59:36 +0000 (09:59 -0800)
ef/d6a8c327e68aba714a498f4169e88292f3c838 [new file with mode: 0644]

diff --git a/ef/d6a8c327e68aba714a498f4169e88292f3c838 b/ef/d6a8c327e68aba714a498f4169e88292f3c838
new file mode 100644 (file)
index 0000000..010b2b4
--- /dev/null
@@ -0,0 +1,182 @@
+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 17EDD429E53\r
+       for <notmuch@notmuchmail.org>; Mon,  3 Feb 2014 03:02:56 -0800 (PST)\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 Y2nvMBhAs2cQ for <notmuch@notmuchmail.org>;\r
+       Mon,  3 Feb 2014 03:02:50 -0800 (PST)\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 5A341429E4D\r
+       for <notmuch@notmuchmail.org>; Mon,  3 Feb 2014 03:02:38 -0800 (PST)\r
+Received: from omta04.westchester.pa.mail.comcast.net ([76.96.62.35])\r
+       by qmta03.westchester.pa.mail.comcast.net with comcast\r
+       id MmzY1n0070ldTLk53n2eba; Mon, 03 Feb 2014 11:02:38 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+       by omta04.westchester.pa.mail.comcast.net with comcast\r
+       id Mn0d1n00M152l3L01n0ejZ; Mon, 03 Feb 2014 11:00:38 +0000\r
+Received: from mjolnir.tremily.us (unknown [192.168.0.140])\r
+       by odin.tremily.us (Postfix) with ESMTPS id 612B6FB4D41;\r
+       Mon,  3 Feb 2014 03:00:37 -0800 (PST)\r
+Received: (nullmailer pid 678 invoked by uid 1000);\r
+       Mon, 03 Feb 2014 10:59:40 -0000\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 01/17] nmbug-status: Convert to Python-3-compatible print\r
+       functions\r
+Date: Mon,  3 Feb 2014 02:59:19 -0800\r
+Message-Id:\r
+ <273f26f98609938ace1190cfc6b5321b643b598f.1391424512.git.wking@tremily.us>\r
+X-Mailer: git-send-email 1.8.5.2.8.g0f6c0d1\r
+In-Reply-To: <cover.1391424512.git.wking@tremily.us>\r
+References: <cover.1391424512.git.wking@tremily.us>\r
+In-Reply-To: <cover.1391424512.git.wking@tremily.us>\r
+References: <cover.1391424512.git.wking@tremily.us>\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+       s=q20121106; t=1391425358;\r
+       bh=y6i6O0KRcTpMSQ+TPACJnXYqtAN+oy+644LeSkVQkJI=;\r
+       h=Received:Received:Received:Received:From:To:Subject:Date:\r
+       Message-Id;\r
+       b=Hl4FimiCNT0vibk0YHMsGWJbtu/h41dfrA5qsPeKZ5dPUStIJYKiJcsev60lkUoUv\r
+       7KAf62s9E9blVID/SGF4VfsJ8xF5FU+W8ADULJke0bU8ipAUeViH6RzQOX1doTQFE2\r
+       5YqnCZ4HakRka8ufRaqtV5ELY/CiHx2orMeXYdMTcuI5b1wsTZ0PxPlaN7c61zGIvr\r
+       I4b5ZUA4HHJ+rjH0bH183b1YFlGIPbz5D5vhX4M56/ZVeevRnSN8BjXhXPyBYEWZ7Q\r
+       lVYab3Bkwxv4fzM6bnBbXWsg10wS+niBQcibmCD0FKkAzdjvfjK3MCTAaLJxONuVLe\r
+       E6PDlVDLEtWJQ==\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: Mon, 03 Feb 2014 11:02:56 -0000\r
+\r
+We shouldn't require folks to install Python 2 to run nmbug-status.\r
+---\r
+ devel/nmbug/nmbug-status | 44 +++++++++++++++++++++++---------------------\r
+ 1 file changed, 23 insertions(+), 21 deletions(-)\r
+\r
+diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status\r
+index 934c895..b1feee9 100755\r
+--- a/devel/nmbug/nmbug-status\r
++++ b/devel/nmbug/nmbug-status\r
+@@ -6,6 +6,8 @@\r
+ #       - python 2.6 for json\r
+ #       - argparse; either python 2.7, or install separately\r
\r
++from __future__ import print_function\r
++\r
+ import datetime\r
+ import rfc822\r
+ import urllib\r
+@@ -49,12 +51,12 @@ config = json.load(fp)\r
\r
+ if args.list_views:\r
+     for view in config['views']:\r
+-        print view['title']\r
++        print(view['title'])\r
+     sys.exit(0)\r
+ elif args.get_query != None:\r
+     for view in config['views']:\r
+         if args.get_query == view['title']:\r
+-            print ' and '.join(view['query'])\r
++            print(' and '.join(view['query']))\r
+     sys.exit(0)\r
+ else:\r
+     # only import notmuch if needed\r
+@@ -75,7 +77,7 @@ class Thread:\r
\r
+ def output_with_separator(threadlist, sep):\r
+     outputs = (thread.join_utf8_with_newlines() for thread in threadlist)\r
+-    print sep.join(outputs)\r
++    print(sep.join(outputs))\r
\r
+ headers = ['date', 'from', 'subject']\r
\r
+@@ -93,13 +95,13 @@ def print_view(title, query, comment):\r
+     lines = None\r
\r
+     if output_format == 'html':\r
+-        print '<h3><a name="%s" />%s</h3>' % (title, title)\r
+-        print comment\r
+-        print 'The view is generated from the following query:'\r
+-        print '<blockquote>'\r
+-        print query_string\r
+-        print '</blockquote>'\r
+-        print '<table>\n'\r
++        print('<h3><a name="%s" />%s</h3>' % (title, title))\r
++        print(comment)\r
++        print('The view is generated from the following query:')\r
++        print('<blockquote>')\r
++        print(query_string)\r
++        print('</blockquote>')\r
++        print('<table>\n')\r
\r
+     for m in q_new.search_messages():\r
\r
+@@ -156,7 +158,7 @@ def print_view(title, query, comment):\r
+     if output_format == 'html':\r
+         output_with_separator(threadlist,\r
+                               '\n<tr><td colspan="2"><br /></td></tr>\n')\r
+-        print '</table>'\r
++        print('</table>')\r
+     else:\r
+         output_with_separator(threadlist, '\n\n')\r
\r
+@@ -165,26 +167,26 @@ def print_view(title, query, comment):\r
+ db = notmuch.Database(mode=notmuch.Database.MODE.READ_WRITE)\r
\r
+ if output_format == 'html':\r
+-    print '''<?xml version="1.0" encoding="utf-8" ?>\r
++    print('''<?xml version="1.0" encoding="utf-8" ?>\r
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\r
+ <head>\r
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\r
+ <title>Notmuch Patches</title>\r
+ </head>\r
+-<body>'''\r
+-    print '<h2>Notmuch Patches</h2>'\r
+-    print 'Generated: %s<br />' % datetime.datetime.utcnow().date()\r
+-    print 'For more infomation see <a href="http://notmuchmail.org/nmbug">nmbug</a>'\r
++<body>''')\r
++    print('<h2>Notmuch Patches</h2>')\r
++    print('Generated: %s<br />' % datetime.datetime.utcnow().date())\r
++    print('For more infomation see <a href="http://notmuchmail.org/nmbug">nmbug</a>')\r
\r
+-    print '<h3>Views</h3>'\r
+-    print '<ul>'\r
++    print('<h3>Views</h3>')\r
++    print('<ul>')\r
+     for view in config['views']:\r
+-        print '<li><a href="#%(title)s">%(title)s</a></li>' % view\r
+-    print '</ul>'\r
++        print('<li><a href="#%(title)s">%(title)s</a></li>' % view)\r
++    print('</ul>')\r
\r
+ for view in config['views']:\r
+     print_view(**view)\r
\r
+ if output_format == 'html':\r
+-    print '</body>\n</html>'\r
++    print('</body>\n</html>')\r
+-- \r
+1.8.5.2.8.g0f6c0d1\r
+\r