summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordol-sen <brian.dolbec@gmail.com>2011-08-09 16:44:32 -0700
committerdol-sen <brian.dolbec@gmail.com>2011-08-09 16:44:32 -0700
commite9742ba56ea23e9d61505a41e9a5cdda60bbfc99 (patch)
tree51ea5296abbdba379174808d108aa9790748ae3f
parente0f12ac23154baf04f4c82146501450103a8b12a (diff)
downloadlayman-e9742ba56ea23e9d61505a41e9a5cdda60bbfc99.tar.gz
layman-e9742ba56ea23e9d61505a41e9a5cdda60bbfc99.tar.bz2
layman-e9742ba56ea23e9d61505a41e9a5cdda60bbfc99.zip
Revert "migrate to print()" to restore py-2.5 compatibility.
This reverts commit e14906b88ec2da99dba82d565d88ed5ca1d40099. Conflicts: layman/api.py layman/cli.py layman/dbbase.py layman/output.py
-rwxr-xr-xlayman/api.py12
-rw-r--r--layman/argsparser.py2
-rw-r--r--layman/cli.py18
-rw-r--r--layman/dbbase.py6
-rw-r--r--layman/debug.py59
-rw-r--r--layman/output.py17
-rw-r--r--layman/version.py4
7 files changed, 53 insertions, 65 deletions
diff --git a/layman/api.py b/layman/api.py
index 69baddd..80b927f 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -13,8 +13,6 @@
# Brian Dolbec <dol-sen@sourceforge.net>
#
-from __future__ import print_function
-
from sys import stderr
import os
@@ -256,10 +254,10 @@ class LaymanAPI(object):
continue
try:
overlay = db.select(ovl)
- #print("overlay = ", ovl)
- #print("!!!", overlay)
- except UnknownOverlayException as error:
- #print("ERRORS", str(error))
+ #print "overlay = ", ovl
+ #print "!!!", overlay
+ except UnknownOverlayException, error:
+ #print "ERRORS", str(error)
self._error(error)
result[ovl] = ('', False, False)
else:
@@ -505,7 +503,7 @@ class LaymanAPI(object):
self._error_messages.append(message)
self.output.debug("API._error(); _error_messages = %s" % str(self._error_messages), 4)
if self.report_errors:
- print(message, file=self.config['stderr'])
+ print >>self.config['stderr'], message
def get_errors(self):
diff --git a/layman/argsparser.py b/layman/argsparser.py
index 93f11d6..af95901 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -242,7 +242,7 @@ class ArgsParser(BareConfig):
# Parse the command line first since we need to get the config
# file option.
if len(args) == 1:
- print('Usage:%s' % _USAGE)
+ print >> self.std_out, 'Usage:%s' % _USAGE
sys.exit(0)
(self.options, remain_args) = self.parser.parse_args(args)
diff --git a/layman/cli.py b/layman/cli.py
index fde52c3..53d81c6 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -19,8 +19,6 @@
#
''' Provides the command line actions that can be performed by layman.'''
-from __future__ import print_function
-
__version__ = "$Id: cli.py 2011-01-15 23:52 PST Brian Dolbec$"
@@ -50,12 +48,12 @@ class ListPrinter(object):
self.my_lister = self.short_list
def print_shortdict(self, info, complain):
- #print("ListPrinter.print_shortdict()",info, "\n\n")
+ #print "ListPrinter.print_shortdict()",info, "\n\n"
overlays = sorted(info)
- #print("ids =======>", overlays, "\n")
+ #print "ids =======>", overlays, "\n"
for ovl in overlays:
overlay = info[ovl]
- #print("overlay =", overlay)
+ #print "overlay =", overlay
summary, supported, official = overlay
self.print_overlay(summary, supported, official, complain)
@@ -66,10 +64,10 @@ class ListPrinter(object):
def print_fulldict(self, info, complain):
ids = sorted(info)
- #print("ids =======>", ids, "\n")
+ #print "ids =======>", ids, "\n"
for ovl in ids:
overlay = info[ovl]
- #print(overlay)
+ #print overlay
self.print_overlay(self.my_lister(overlay),
overlay['supported'],
overlay['official'],
@@ -105,7 +103,7 @@ class ListPrinter(object):
def short_list(self, overlay):
'''
- >>> print(short_list(overlay))
+ >>> print short_list(overlay)
wrobel [Subversion] (https://o.g.o/svn/dev/wrobel )
'''
name = pad(overlay['name'], 25)
@@ -131,7 +129,7 @@ class Main(object):
def __init__(self, config):
self.config = config
- #print("config.keys()", config.keys())
+ #print "config.keys()", config.keys()
self.output = config['output']
self.api = LaymanAPI(config,
report_errors=False,
@@ -311,7 +309,7 @@ class Main(object):
def ListLocal(self):
''' Lists the local overlays.
'''
- #print("ListLocal()")
+ #print "ListLocal()"
self.output.debug('Printing installed overlays.', 6)
list_printer = ListPrinter(self.config)
diff --git a/layman/dbbase.py b/layman/dbbase.py
index dfe6ec8..8eafbf7 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -20,8 +20,6 @@
#
'''Main handler for overlays.'''
-from __future__ import print_function
-
__version__ = "$Id: overlay.py 273 2006-12-30 15:54:50Z wrobel $"
#===============================================================================
@@ -257,7 +255,7 @@ class DbBase(object):
>>> config = {'output': output, 'svn_command': '/usr/bin/svn', 'rsync_command':'/usr/bin/rsync'}
>>> a = DbBase(config, [here + '/tests/testfiles/global-overlays.xml', ])
>>> for i in a.list(verbose=True):
- ... print(i[0])
+ ... print i[0]
wrobel
~~~~~~
Source : https://overlays.gentoo.org/svn/dev/wrobel
@@ -280,7 +278,7 @@ class DbBase(object):
<BLANKLINE>
>>> for i in a.list(verbose=False, width=80):
- ... print(i[0])
+ ... print i[0]
wrobel [Subversion] (https://o.g.o/svn/dev/wrobel )
wrobel-stable [Rsync ] (rsync://gunnarwrobel.de/wrobel-stable)
'''
diff --git a/layman/debug.py b/layman/debug.py
index ab04f40..f5c247b 100644
--- a/layman/debug.py
+++ b/layman/debug.py
@@ -6,8 +6,6 @@
# Copyright 2005 - 2008 Gunnar Wrobel
# Distributed under the terms of the GNU General Public License v2
-from __future__ import print_function
-
__version__ = "$Id: debug.py 153 2006-06-05 06:03:16Z wrobel $"
#################################################################################
@@ -103,7 +101,7 @@ class DebugMessage(Message):
def cli_opts(self, parser):
- #print("Parsing debug opts")
+ #print "Parsing debug opts"
group = OptionGroup(parser,
'<Debugging options>',
@@ -329,11 +327,11 @@ class DebugMessage(Message):
if lines > 0:
for j in range(lines):
## Print line with continuation marker
- print(ls + '// ' + x[0:60] + ' \\', file=self.debug_out)
+ print >> self.debug_out, ls + '// ' + x[0:60] + ' \\'
## Remove printed characters from output
x = x[60:]
## Print final line
- print(ls + '// ' + x, file=self.debug_out)
+ print >> self.debug_out, ls + '// ' + x
if self.debug_vrb == 1:
# Top line indicates class and method
@@ -342,61 +340,60 @@ class DebugMessage(Message):
c += 'Class: ' + str(callerobject.__class__.__name__) + ' | '
if callermethod:
c += 'Method: ' + str(callermethod)
- print('// ' + c, file=self.debug_out)
+ print >> self.debug_out, '// ' + c
# Selected variables follow
if callerlocals:
for i,j in callerlocals.items():
- print('// ' + self.maybe_color('turquoise',
- str(i)) + ':' + str(j), file=self.debug_out)
+ print >> self.debug_out, '// ' \
+ + self.maybe_color('turquoise', str(i)) + ':' + str(j)
# Finally the message
- print(self.maybe_color('yellow', message), file=self.debug_out)
+ print >> self.debug_out, self.maybe_color('yellow', message)
return
if self.debug_vrb == 3:
- print(ls + '/////////////////////////////////' + \
- '////////////////////////////////', file=self.debug_out)
+ print >> self.debug_out, ls + '/////////////////////////////////' + \
+ '////////////////////////////////'
# General information about what is being debugged
#(module name or similar)
- print(ls + '// ' + self.debug_env, file=self.debug_out)
- print(ls + '//-----------------------------------' + \
- '----------------------------', file=self.debug_out)
+ print >> self.debug_out, ls + '// ' + self.debug_env
+ print >> self.debug_out, ls + '//-----------------------------------' + \
+ '----------------------------'
## If the caller is a class print the name here
if callerobject:
- print(ls + '// Object Class: ' +
- str(callerobject.__class__.__name__), file=self.debug_out)
+ print >> self.debug_out, ls + \
+ '// Object Class: ' + str(callerobject.__class__.__name__)
## If the method has been extracted print it here
if callermethod:
- print(ls + '// ' + self.maybe_color('green', 'Method: ')
- + str(callermethod), file=self.debug_out)
+ print >> self.debug_out, ls + '// ' \
+ + self.maybe_color('green', 'Method: ') + str(callermethod)
if self.debug_vrb == 3:
- print(ls + '//---------------------------' + \
- '------------------------------------', file=self.debug_out)
+ print >> self.debug_out, ls + '//---------------------------' + \
+ '------------------------------------'
## Print the information on all available local variables
if callerlocals:
if self.debug_vrb == 3:
- print(ls + '//', file=self.debug_out)
- print(ls + '// VALUES ', file=self.debug_out)
+ print >> self.debug_out, ls + '//'
+ print >> self.debug_out, ls + '// VALUES '
for i,j in callerlocals.items():
- print(ls + '// ------------------> ' \
- + self.maybe_color('turquoise', str(i)) + ':',
- file=self.debug_out)
+ print >> self.debug_out, ls + '// ------------------> ' \
+ + self.maybe_color('turquoise', str(i)) + ':'
breaklines(str(j))
if self.debug_vrb == 3:
- print(ls + '//------------------------------'\
- '---------------------------------', file=self.debug_out)
+ print >> self.debug_out, ls + '//------------------------------'\
+ '---------------------------------'
# Finally print the message
breaklines(self.maybe_color('yellow', message))
if self.debug_vrb == 3:
- print(ls + '//-------------------------------' + \
- '--------------------------------', file=self.debug_out)
- print(ls + '/////////////////////////////////' + \
- '////////////////////////////////', file=self.debug_out)
+ print >> self.debug_out, ls + '//-------------------------------' + \
+ '--------------------------------'
+ print >> self.debug_out, ls + '/////////////////////////////////' + \
+ '////////////////////////////////'
## gloabal message handler
OUT = Message('layman')
diff --git a/layman/output.py b/layman/output.py
index 3e82305..c900a31 100644
--- a/layman/output.py
+++ b/layman/output.py
@@ -6,7 +6,6 @@
Distributed under the terms of the GNU General Public License v2
"""
-from __future__ import print_function
__version__ = "0.1"
@@ -117,11 +116,11 @@ class Message(MessageBase):
return
for i in info.split('\n'):
- print(self.color_func('yellow', 'DEBUG: ') + i, file=self.std_out)
+ print >> self.std_out, self.color_func('yellow', 'DEBUG: ') + i
def notice (self, note):
- print(note, file=self.std_out)
+ print >> self.std_out, note
def info (self, info, level = INFO_LEVEL):
@@ -133,7 +132,7 @@ class Message(MessageBase):
return
for i in info.split('\n'):
- print(self.color_func('green', ' * ') + i, file=self.std_out)
+ print >> self.std_out, self.color_func('green', ' * ') + i
def status (self, message, status, info = 'ignored'):
@@ -147,7 +146,7 @@ class Message(MessageBase):
return
for i in lines[0:-1]:
- print(self.color_func('green', ' * ') + i, file=self.std_out)
+ print >> self.std_out, self.color_func('green', ' * ') + i
i = lines[-1]
@@ -161,8 +160,8 @@ class Message(MessageBase):
else:
result = '[' + self.color_func('yellow', info) + ']'
- print(self.color_func('green', ' * ') + i + ' ' + \
- '.' * (58 - len(i)) + ' ' + result, file=self.std_out)
+ print >> self.color_func('green', ' * ') + i + ' ' + \
+ '.' * (58 - len(i)) + ' ' + result
def warn (self, warn, level = WARN_LEVEL):
@@ -174,7 +173,7 @@ class Message(MessageBase):
return
for i in warn.split('\n'):
- print(self.color_func('yellow', ' * ') + i, file=self.std_out)
+ print >> self.std_out, self.color_func('yellow', ' * ') + i
def error (self, error):
@@ -188,7 +187,7 @@ class Message(MessageBase):
# "layman -L |& less".
sys.stdout.flush()
self.error_out.flush()
- print(self.color_func('red', ' * ') + i, file=self.std_out)
+ print >> self.std_out, self.color_func('red', ' * ') + i
sys.stdout.flush()
self.do_error_callback(error)
diff --git a/layman/version.py b/layman/version.py
index 6fadd2a..90c7412 100644
--- a/layman/version.py
+++ b/layman/version.py
@@ -19,12 +19,10 @@
# Brian Dolbec <brian.dolbec@gmail.com>
#
-from __future__ import print_function
-
__version__ = "$Id: version.py 309 2007-04-09 16:23:38Z wrobel $"
VERSION = '2.0.0-git'
if __name__ == '__main__':
- print(VERSION)
+ print VERSION