summaryrefslogtreecommitdiffstats
path: root/layman/debug.py
diff options
context:
space:
mode:
Diffstat (limited to 'layman/debug.py')
-rw-r--r--layman/debug.py59
1 files changed, 31 insertions, 28 deletions
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
+from __future__ import print_function
+
__version__ = "$Id: debug.py 153 2006-06-05 06:03:16Z wrobel $"
#################################################################################
@@ -101,7 +103,7 @@ class DebugMessage(Message):
def cli_opts(self, parser):
- #print "Parsing debug opts"
+ #print("Parsing debug opts")
group = OptionGroup(parser,
'<Debugging options>',
@@ -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=self.debug_out)
## Remove printed characters from output
x = x[60:]
## Print final line
- print >> self.debug_out, ls + '// ' + x
+ print(ls + '// ' + x, file=self.debug_out)
if self.debug_vrb == 1:
# Top line indicates class and method
@@ -340,60 +342,61 @@ class DebugMessage(Message):
c += 'Class: ' + str(callerobject.__class__.__name__) + ' | '
if callermethod:
c += 'Method: ' + str(callermethod)
- print >> self.debug_out, '// ' + c
+ print('// ' + c, file=self.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=self.debug_out)
# Finally the message
- print >> self.debug_out, self.maybe_color('yellow', message)
+ print(self.maybe_color('yellow', message), file=self.debug_out)
return
if self.debug_vrb == 3:
- print >> self.debug_out, ls + '/////////////////////////////////' + \
- '////////////////////////////////'
+ print(ls + '/////////////////////////////////' + \
+ '////////////////////////////////', file=self.debug_out)
# 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=self.debug_out)
+ print(ls + '//-----------------------------------' + \
+ '----------------------------', file=self.debug_out)
## If the caller is a class print the name here
if callerobject:
- print >> self.debug_out, ls + \
- '// Object Class: ' + str(callerobject.__class__.__name__)
+ print(ls + '// Object Class: ' +
+ str(callerobject.__class__.__name__), file=self.debug_out)
## If the method has been extracted print it here
if callermethod:
- print >> self.debug_out, ls + '// ' \
- + self.maybe_color('green', 'Method: ') + str(callermethod)
+ print(ls + '// ' + self.maybe_color('green', 'Method: ')
+ + str(callermethod), file=self.debug_out)
if self.debug_vrb == 3:
- print >> self.debug_out, ls + '//---------------------------' + \
- '------------------------------------'
+ print(ls + '//---------------------------' + \
+ '------------------------------------', file=self.debug_out)
## Print the information on all available local variables
if callerlocals:
if self.debug_vrb == 3:
- print >> self.debug_out, ls + '//'
- print >> self.debug_out, ls + '// VALUES '
+ print(ls + '//', file=self.debug_out)
+ print(ls + '// VALUES ', file=self.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=self.debug_out)
breaklines(str(j))
if self.debug_vrb == 3:
- print >> self.debug_out, ls + '//------------------------------'\
- '---------------------------------'
+ print(ls + '//------------------------------'\
+ '---------------------------------', file=self.debug_out)
# Finally print the message
breaklines(self.maybe_color('yellow', message))
if self.debug_vrb == 3:
- print >> self.debug_out, ls + '//-------------------------------' + \
- '--------------------------------'
- print >> self.debug_out, ls + '/////////////////////////////////' + \
- '////////////////////////////////'
+ print(ls + '//-------------------------------' + \
+ '--------------------------------', file=self.debug_out)
+ print(ls + '/////////////////////////////////' + \
+ '////////////////////////////////', file=self.debug_out)
## gloabal message handler
OUT = Message('layman')