From 3614835e6d78f2e8dc2531f68783f8a5b80eb53e Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 4 Feb 2014 02:59:19 +1600 Subject: [PATCH] [PATCH 01/17] nmbug-status: Convert to Python-3-compatible print functions --- ef/d6a8c327e68aba714a498f4169e88292f3c838 | 182 ++++++++++++++++++++++ 1 file changed, 182 insertions(+) create mode 100644 ef/d6a8c327e68aba714a498f4169e88292f3c838 diff --git a/ef/d6a8c327e68aba714a498f4169e88292f3c838 b/ef/d6a8c327e68aba714a498f4169e88292f3c838 new file mode 100644 index 000000000..010b2b4e1 --- /dev/null +++ b/ef/d6a8c327e68aba714a498f4169e88292f3c838 @@ -0,0 +1,182 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 17EDD429E53 + for ; Mon, 3 Feb 2014 03:02:56 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id Y2nvMBhAs2cQ for ; + Mon, 3 Feb 2014 03:02:50 -0800 (PST) +Received: from qmta03.westchester.pa.mail.comcast.net + (qmta03.westchester.pa.mail.comcast.net [76.96.62.32]) + by olra.theworths.org (Postfix) with ESMTP id 5A341429E4D + for ; Mon, 3 Feb 2014 03:02:38 -0800 (PST) +Received: from omta04.westchester.pa.mail.comcast.net ([76.96.62.35]) + by qmta03.westchester.pa.mail.comcast.net with comcast + id MmzY1n0070ldTLk53n2eba; Mon, 03 Feb 2014 11:02:38 +0000 +Received: from odin.tremily.us ([24.18.63.50]) + by omta04.westchester.pa.mail.comcast.net with comcast + id Mn0d1n00M152l3L01n0ejZ; Mon, 03 Feb 2014 11:00:38 +0000 +Received: from mjolnir.tremily.us (unknown [192.168.0.140]) + by odin.tremily.us (Postfix) with ESMTPS id 612B6FB4D41; + Mon, 3 Feb 2014 03:00:37 -0800 (PST) +Received: (nullmailer pid 678 invoked by uid 1000); + Mon, 03 Feb 2014 10:59:40 -0000 +From: "W. Trevor King" +To: notmuch@notmuchmail.org +Subject: [PATCH 01/17] nmbug-status: Convert to Python-3-compatible print + functions +Date: Mon, 3 Feb 2014 02:59:19 -0800 +Message-Id: + <273f26f98609938ace1190cfc6b5321b643b598f.1391424512.git.wking@tremily.us> +X-Mailer: git-send-email 1.8.5.2.8.g0f6c0d1 +In-Reply-To: +References: +In-Reply-To: +References: +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; + s=q20121106; t=1391425358; + bh=y6i6O0KRcTpMSQ+TPACJnXYqtAN+oy+644LeSkVQkJI=; + h=Received:Received:Received:Received:From:To:Subject:Date: + Message-Id; + b=Hl4FimiCNT0vibk0YHMsGWJbtu/h41dfrA5qsPeKZ5dPUStIJYKiJcsev60lkUoUv + 7KAf62s9E9blVID/SGF4VfsJ8xF5FU+W8ADULJke0bU8ipAUeViH6RzQOX1doTQFE2 + 5YqnCZ4HakRka8ufRaqtV5ELY/CiHx2orMeXYdMTcuI5b1wsTZ0PxPlaN7c61zGIvr + I4b5ZUA4HHJ+rjH0bH183b1YFlGIPbz5D5vhX4M56/ZVeevRnSN8BjXhXPyBYEWZ7Q + lVYab3Bkwxv4fzM6bnBbXWsg10wS+niBQcibmCD0FKkAzdjvfjK3MCTAaLJxONuVLe + E6PDlVDLEtWJQ== +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 03 Feb 2014 11:02:56 -0000 + +We shouldn't require folks to install Python 2 to run nmbug-status. +--- + devel/nmbug/nmbug-status | 44 +++++++++++++++++++++++--------------------- + 1 file changed, 23 insertions(+), 21 deletions(-) + +diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status +index 934c895..b1feee9 100755 +--- a/devel/nmbug/nmbug-status ++++ b/devel/nmbug/nmbug-status +@@ -6,6 +6,8 @@ + # - python 2.6 for json + # - argparse; either python 2.7, or install separately + ++from __future__ import print_function ++ + import datetime + import rfc822 + import urllib +@@ -49,12 +51,12 @@ config = json.load(fp) + + if args.list_views: + for view in config['views']: +- print view['title'] ++ print(view['title']) + sys.exit(0) + elif args.get_query != None: + for view in config['views']: + if args.get_query == view['title']: +- print ' and '.join(view['query']) ++ print(' and '.join(view['query'])) + sys.exit(0) + else: + # only import notmuch if needed +@@ -75,7 +77,7 @@ class Thread: + + def output_with_separator(threadlist, sep): + outputs = (thread.join_utf8_with_newlines() for thread in threadlist) +- print sep.join(outputs) ++ print(sep.join(outputs)) + + headers = ['date', 'from', 'subject'] + +@@ -93,13 +95,13 @@ def print_view(title, query, comment): + lines = None + + if output_format == 'html': +- print '

%s

' % (title, title) +- print comment +- print 'The view is generated from the following query:' +- print '
' +- print query_string +- print '
' +- print '\n' ++ print('

%s

' % (title, title)) ++ print(comment) ++ print('The view is generated from the following query:') ++ print('
') ++ print(query_string) ++ print('
') ++ print('
\n') + + for m in q_new.search_messages(): + +@@ -156,7 +158,7 @@ def print_view(title, query, comment): + if output_format == 'html': + output_with_separator(threadlist, + '\n\n') +- print '

' ++ print('') + else: + output_with_separator(threadlist, '\n\n') + +@@ -165,26 +167,26 @@ def print_view(title, query, comment): + db = notmuch.Database(mode=notmuch.Database.MODE.READ_WRITE) + + if output_format == 'html': +- print ''' ++ print(''' + + + + + Notmuch Patches + +-''' +- print '

Notmuch Patches

' +- print 'Generated: %s
' % datetime.datetime.utcnow().date() +- print 'For more infomation see
nmbug' ++''') ++ print('

Notmuch Patches

') ++ print('Generated: %s
' % datetime.datetime.utcnow().date()) ++ print('For more infomation see nmbug') + +- print '

Views

' +- print '
    ' ++ print('

    Views

    ') ++ print('
      ') + for view in config['views']: +- print '
    • %(title)s
    • ' % view +- print '
    ' ++ print('
  • %(title)s
  • ' % view) ++ print('
') + + for view in config['views']: + print_view(**view) + + if output_format == 'html': +- print '\n' ++ print('\n') +-- +1.8.5.2.8.g0f6c0d1 + -- 2.26.2