From 891ec49bd4929b8052f4a4a5332ee0ef3253445d Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 11 Feb 2014 10:40:22 +1600 Subject: [PATCH] [PATCH v2 01/20] nmbug-status: Convert to Python-3-compatible print functions --- 32/d96792007ba517a09b3e430415b0df92dec428 | 183 ++++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 32/d96792007ba517a09b3e430415b0df92dec428 diff --git a/32/d96792007ba517a09b3e430415b0df92dec428 b/32/d96792007ba517a09b3e430415b0df92dec428 new file mode 100644 index 000000000..f7b26437e --- /dev/null +++ b/32/d96792007ba517a09b3e430415b0df92dec428 @@ -0,0 +1,183 @@ +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 3A39C429E27 + for ; Mon, 10 Feb 2014 10:44:38 -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 nrvwVI11MZMb for ; + Mon, 10 Feb 2014 10:44:32 -0800 (PST) +Received: from qmta10.westchester.pa.mail.comcast.net + (qmta10.westchester.pa.mail.comcast.net [76.96.62.17]) + by olra.theworths.org (Postfix) with ESMTP id 50C8C429E39 + for ; Mon, 10 Feb 2014 10:43:54 -0800 (PST) +Received: from omta13.westchester.pa.mail.comcast.net ([76.96.62.52]) + by qmta10.westchester.pa.mail.comcast.net with comcast + id QcWY1n00217dt5G5Aijueg; Mon, 10 Feb 2014 18:43:54 +0000 +Received: from odin.tremily.us ([24.18.63.50]) + by omta13.westchester.pa.mail.comcast.net with comcast + id Qihs1n00S152l3L3Ziht4A; Mon, 10 Feb 2014 18:41:54 +0000 +Received: from mjolnir.tremily.us (unknown [192.168.0.140]) + by odin.tremily.us (Postfix) with ESMTPS id 4B50210167A3; + Mon, 10 Feb 2014 10:41:52 -0800 (PST) +Received: (nullmailer pid 1244 invoked by uid 1000); + Mon, 10 Feb 2014 18:40:44 -0000 +From: "W. Trevor King" +To: notmuch@notmuchmail.org +Subject: [PATCH v2 01/20] nmbug-status: Convert to Python-3-compatible print + functions +Date: Mon, 10 Feb 2014 10:40:22 -0800 +Message-Id: + <273f26f98609938ace1190cfc6b5321b643b598f.1392056624.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=1392057834; + bh=y6i6O0KRcTpMSQ+TPACJnXYqtAN+oy+644LeSkVQkJI=; + h=Received:Received:Received:Received:From:To:Subject:Date: + Message-Id; + b=Nn52N4adikw0n9Xwyuly56W1mBQeBj+GPSNQtrL8w80ybuLE4uood567LSV+2gQYx + vPfc+XiCndpY6qNLBZZXs4zcDu5M17CxuKaf3poU52S0B36biEkZ/g1mLeERqIPhFI + qxtQuGvgTm+ESOUY/XxdRhIC7Ms9Fqw/slzYjk1HVq0BnxuhVwUGicxGB4mFPuPCvN + leUV4TynfTUkdmqRNeQV6GoT0M7M2AGWARTm9RVGB5XLVrgE8PNiqhrTFC+0IV8PdO + 2AZqZMeN/clcf8MPidgMpfc3fKTKV3swDsm5uEnl+5gyaJRMk8ZI78b4GxV6GOiCuP + TnaUxF2UD/P4Q== +Cc: Tomi Ollila +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, 10 Feb 2014 18:44:38 -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