From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QF2Tx-0003dT-6M for garchives@archives.gentoo.org; Wed, 27 Apr 2011 11:00:33 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 66F221C0BA; Wed, 27 Apr 2011 10:58:46 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 13F7F1C0B9 for ; Wed, 27 Apr 2011 10:58:45 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D4B0F1BC032 for ; Wed, 27 Apr 2011 10:58:44 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 4343480509 for ; Wed, 27 Apr 2011 10:58:44 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: Subject: [gentoo-commits] proj/layman:master commit in: layman/ X-VCS-Repository: proj/layman X-VCS-Files: layman/api.py layman/cli.py layman/dbbase.py layman/debug.py layman/output.py layman/version.py X-VCS-Directories: layman/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: e14906b88ec2da99dba82d565d88ed5ca1d40099 Date: Wed, 27 Apr 2011 10:58:44 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 64d117fd06a63b0a9ed58b79884e4ba5 commit: e14906b88ec2da99dba82d565d88ed5ca1d40099 Author: Brian Dolbec gmail com> AuthorDate: Sun Mar 27 03:24:26 2011 +0000 Commit: Brian Dolbec gmail com> CommitDate: Sun Mar 27 03:24:26 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/layman.git;a=3D= commit;h=3De14906b8 migrate to print() --- layman/api.py | 10 +++++--- layman/cli.py | 22 ++++++++++--------- layman/dbbase.py | 6 +++- layman/debug.py | 59 +++++++++++++++++++++++++++--------------------= ----- layman/output.py | 15 +++++++------ layman/version.py | 4 ++- 6 files changed, 64 insertions(+), 52 deletions(-) diff --git a/layman/api.py b/layman/api.py index 75d0c10..9dfb1a3 100644 --- a/layman/api.py +++ b/layman/api.py @@ -13,6 +13,8 @@ # Brian Dolbec # =20 +from __future__ import print_function + from sys import stderr import os =20 @@ -248,10 +250,10 @@ class LaymanAPI(object): continue try: overlay =3D db.select(ovl) - #print "overlay =3D ", ovl - #print "!!!", overlay + #print("overlay =3D ", ovl) + #print("!!!", overlay) except UnknownOverlayException, error: - #print "ERRORS", str(error) + #print("ERRORS", str(error)) self._error(error) result[ovl] =3D ('', False, False) else: @@ -422,7 +424,7 @@ class LaymanAPI(object): #msg =3D "Error: %d," % num, message self._error_messages.append(message) if self.report_errors: - print >>stderr, msg + print(msg, file=3Dstderr) =20 =20 def get_errors(self): diff --git a/layman/cli.py b/layman/cli.py index 8f94f4a..1187ef2 100644 --- a/layman/cli.py +++ b/layman/cli.py @@ -19,6 +19,8 @@ # ''' Provides the command line actions that can be performed by layman.''= ' =20 +from __future__ import print_function + __version__ =3D "$Id: cli.py 2011-01-15 23:52 PST Brian Dolbec$" =20 =20 @@ -48,27 +50,27 @@ class ListPrinter(object): self.my_lister =3D self.short_list =20 def print_shortdict(self, info, complain): - #print "ListPrinter.print_shortdict()",info, "\n\n" + #print("ListPrinter.print_shortdict()",info, "\n\n") overlays =3D sorted(info) - #print "ids =3D=3D=3D=3D=3D=3D=3D>", overlays, "\n" + #print("ids =3D=3D=3D=3D=3D=3D=3D>", overlays, "\n") for ovl in overlays: overlay =3D info[ovl] - #print "overlay =3D", overlay + #print("overlay =3D", overlay) summary, supported, official =3D overlay self.print_overlay(summary, supported, official, complain) =20 def print_shortlist(self, info, complain): - #print "ListPrinter.print_shortlist()",info + #print("ListPrinter.print_shortlist()",info) for summary, supported, official in info: self.print_overlay(summary, supported, official, complain) =20 =20 def print_fulldict(self, info, complain): ids =3D sorted(info) - #print "ids =3D=3D=3D=3D=3D=3D=3D>", ids, "\n" + #print("ids =3D=3D=3D=3D=3D=3D=3D>", ids, "\n") for ovl in ids: overlay =3D info[ovl] - #print overlay + #print(overlay) self.print_overlay(self.my_lister(overlay), overlay['supported'], overlay['official'], @@ -101,7 +103,7 @@ class ListPrinter(object): =20 def short_list(self, overlay): ''' - >>> print short_list(overlay) + >>> print(short_list(overlay)) wrobel [Subversion] (https://o.g.o/svn/dev/wr= obel ) ''' name =3D pad(overlay['name'], 25) @@ -127,7 +129,7 @@ class Main(object): =20 def __init__(self, config): self.config =3D config - #print "config.keys()", config.keys() + #print("config.keys()", config.keys()) self.output =3D config['output'] self.api =3D LaymanAPI(config, report_errors=3DTrue, @@ -260,7 +262,7 @@ class Main(object): =20 info =3D self.api.get_info_str(selection, local=3DFalse, verbose=3DTrue, width=3Dlist_printer.width) - #print "info =3D", info + #print("info =3D", info) list_printer.print_shortdict(info, complain=3D_complain) =20 return info !=3D {} @@ -284,7 +286,7 @@ class Main(object): def ListLocal(self): ''' Lists the local overlays. ''' - #print "ListLocal()" + #print("ListLocal()") self.output.debug('Printing installed overlays.', 6) list_printer =3D ListPrinter(self.config) =20 diff --git a/layman/dbbase.py b/layman/dbbase.py index 776a90f..02aeb9d 100644 --- a/layman/dbbase.py +++ b/layman/dbbase.py @@ -20,6 +20,8 @@ # '''Main handler for overlays.''' =20 +from __future__ import print_function + __version__ =3D "$Id: overlay.py 273 2006-12-30 15:54:50Z wrobel $" =20 #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D @@ -240,7 +242,7 @@ class DbBase: >>> config =3D {'svn_command': '/usr/bin/svn', 'rsync_command':'= /usr/bin/rsync'} >>> a =3D DbBase([here + '/tests/testfiles/global-overlays.xml',= ], config) >>> for i in a.list(True): - ... print i[0] + ... print(i[0]) wrobel ~~~~~~ Source : https://overlays.gentoo.org/svn/dev/wrobel @@ -263,7 +265,7 @@ class DbBase: =20 >>> for i in a.list(False, 80): - ... print i[0] + ... print(i[0]) wrobel [Subversion] (https://o.g.o/svn/dev/wr= obel ) wrobel-stable [Rsync ] (rsync://gunnarwrobel.de/= wrobel-stable) ''' diff --git a/layman/debug.py b/layman/debug.py index f5c247b..ab04f40 100644 --- a/layman/debug.py +++ b/layman/debug.py @@ -6,6 +6,8 @@ # Copyright 2005 - 2008 Gunnar Wrobel # Distributed under the terms of the GNU General Public License v2 =20 +from __future__ import print_function + __version__ =3D "$Id: debug.py 153 2006-06-05 06:03:16Z wrobel $" =20 ########################################################################= ######### @@ -101,7 +103,7 @@ class DebugMessage(Message): =20 def cli_opts(self, parser): =20 - #print "Parsing debug opts" + #print("Parsing debug opts") =20 group =3D OptionGroup(parser, '', @@ -327,11 +329,11 @@ class DebugMessage(Message): if lines > 0: for j in range(lines): ## Print line with continuation marker - print >> self.debug_out, ls + '// ' + x[0:60] + ' \\= ' + print(ls + '// ' + x[0:60] + ' \\', file=3Dself.debu= g_out) ## Remove printed characters from output x =3D x[60:] ## Print final line - print >> self.debug_out, ls + '// ' + x + print(ls + '// ' + x, file=3Dself.debug_out) =20 if self.debug_vrb =3D=3D 1: # Top line indicates class and method @@ -340,60 +342,61 @@ class DebugMessage(Message): c +=3D 'Class: ' + str(callerobject.__class__.__name__) = + ' | ' if callermethod: c +=3D 'Method: ' + str(callermethod) - print >> self.debug_out, '// ' + c + print('// ' + c, file=3Dself.debug_out) # Selected variables follow if callerlocals: for i,j in callerlocals.items(): - print >> self.debug_out, '// ' = \ - + self.maybe_color('turquoise', str(i)) + ':' = + str(j) + print('// ' + self.maybe_color('turquoise', + str(i)) + ':' + str(j), file=3Dself.debug_out) # Finally the message - print >> self.debug_out, self.maybe_color('yellow', message) + print(self.maybe_color('yellow', message), file=3Dself.debug= _out) return =20 if self.debug_vrb =3D=3D 3: - print >> self.debug_out, ls + '/////////////////////////////= ////' + \ - '////////////////////////////////' + print(ls + '/////////////////////////////////' + \ + '////////////////////////////////', file=3Dself.debug_= out) =20 # General information about what is being debugged #(module name or similar) - print >> self.debug_out, ls + '// ' + self.debug_env - print >> self.debug_out, ls + '//-------------------------------= ----' + \ - '----------------------------' + print(ls + '// ' + self.debug_env, file=3Dself.debug_out) + print(ls + '//-----------------------------------' + \ + '----------------------------', file=3Dself.debug_out) =20 ## If the caller is a class print the name here if callerobject: - print >> self.debug_out, ls + = \ - '// Object Class: ' + str(callerobject.__class__.__nam= e__) + print(ls + '// Object Class: ' + + str(callerobject.__class__.__name__), file=3Dself.debug_= out) =20 ## If the method has been extracted print it here if callermethod: - print >> self.debug_out, ls + '// ' = \ - + self.maybe_color('green', 'Method: ') + str(callerme= thod) + print(ls + '// ' + self.maybe_color('green', 'Method: ') + + str(callermethod), file=3Dself.debug_out) if self.debug_vrb =3D=3D 3: - print >> self.debug_out, ls + '//-----------------------= ----' + \ - '------------------------------------' + print(ls + '//---------------------------' + \ + '------------------------------------', file=3Dself.= debug_out) =20 ## Print the information on all available local variables if callerlocals: if self.debug_vrb =3D=3D 3: - print >> self.debug_out, ls + '//' - print >> self.debug_out, ls + '// VALUES ' + print(ls + '//', file=3Dself.debug_out) + print(ls + '// VALUES ', file=3Dself.debug_out) for i,j in callerlocals.items(): - print >> self.debug_out, ls + '// ------------------> ' = \ - + self.maybe_color('turquoise', str(i)) + ':' + print(ls + '// ------------------> ' \ + + self.maybe_color('turquoise', str(i)) + ':', + file=3Dself.debug_out) breaklines(str(j)) if self.debug_vrb =3D=3D 3: - print >> self.debug_out, ls + '//-----------------------= -------'\ - '---------------------------------' + print(ls + '//------------------------------'\ + '---------------------------------', file=3Dself.d= ebug_out) =20 # Finally print the message breaklines(self.maybe_color('yellow', message)) =20 if self.debug_vrb =3D=3D 3: - print >> self.debug_out, ls + '//---------------------------= ----' + \ - '--------------------------------' - print >> self.debug_out, ls + '/////////////////////////////= ////' + \ - '////////////////////////////////' + print(ls + '//-------------------------------' + \ + '--------------------------------', file=3Dself.debug_= out) + print(ls + '/////////////////////////////////' + \ + '////////////////////////////////', file=3Dself.debug_= out) =20 ## gloabal message handler OUT =3D Message('layman') diff --git a/layman/output.py b/layman/output.py index 469f673..caccd93 100644 --- a/layman/output.py +++ b/layman/output.py @@ -6,6 +6,7 @@ Distributed under the terms of the GNU General Public License v2 """ =20 +from __future__ import print_function =20 __version__ =3D "0.1" =20 @@ -112,7 +113,7 @@ class Message(MessageBase): =20 =20 def notice (self, note): - print >> self.std_out, note + print(note, file=3Dself.std_out) =20 =20 def info (self, info, level =3D INFO_LEVEL): @@ -124,7 +125,7 @@ class Message(MessageBase): return =20 for i in info.split('\n'): - print >> self.std_out, self.color_func('green', '* ') + i + print(self.color_func('green', '* ') + i, file=3Dself.std_ou= t) =20 =20 def status (self, message, status, info =3D 'ignored'): @@ -138,7 +139,7 @@ class Message(MessageBase): return =20 for i in lines[0:-1]: - print >> self.std_out, self.color_func('green', '* ') + i + print(self.color_func('green', '* ') + i, file=3Dself.std_ou= t) =20 i =3D lines[-1] =20 @@ -152,8 +153,8 @@ class Message(MessageBase): else: result =3D '[' + self.color_func('yellow', info) + ']' =20 - print >> self.std_out, self.color_func('green', '* ') + i + ' '= + \ - '.' * (58 - len(i)) + ' ' + result + print(self.color_func('green', '* ') + i + ' ' + \ + '.' * (58 - len(i)) + ' ' + result, file=3Dself.std_out) =20 =20 def warn (self, warn, level =3D WARN_LEVEL): @@ -165,7 +166,7 @@ class Message(MessageBase): return =20 for i in warn.split('\n'): - print >> self.std_out, self.color_func('yellow', '* ') + i + print(self.color_func('yellow', '* ') + i, file=3Dself.std_o= ut) =20 =20 def error (self, error): @@ -178,7 +179,7 @@ class Message(MessageBase): # stay in nice order. This is a workaround for calls like # "layman -L |& less". sys.stdout.flush() - print >> self.error_out, self.color_func('red', '* ') + i + print(self.color_func('red', '* ') + i, file=3Dself.error_ou= t) self.error_out.flush() self.do_error_callback(error) =20 diff --git a/layman/version.py b/layman/version.py index 5d7a73d..02750c5 100644 --- a/layman/version.py +++ b/layman/version.py @@ -17,10 +17,12 @@ # Sebastian Pipping # =20 +from __future__ import print_function + __version__ =3D "$Id: version.py 309 2007-04-09 16:23:38Z wrobel $" =20 =20 VERSION =3D '1.4.2' =20 if __name__ =3D=3D '__main__': - print VERSION + print(VERSION)