[Python-3000-checkins] r56706 - in python/branches/py3k-struni/Tools: audiopy/audiopy bgen/bgen/bgenGenerator.py bgen/bgen/bgenGeneratorGroup.py bgen/bgen/scantools.py faqwiz/faqw.py faqwiz/faqwiz.py framer/framer/bases.py framer/framer/function.py framer/framer/member.py i18n/makelocalealias.py i18n/msgfmt.py i18n/pygettext.py modulator/Tkextra.py msi/msi.py msi/msilib.py pybench/pybench.py pynche/ColorDB.py pynche/Main.py pynche/Switchboard.py scripts/byext.py scripts/byteyears.py scripts/checkappend.py scripts/checkpyc.py scripts/cleanfuture.py scripts/combinerefs.py scripts/crlf.py scripts/cvsfiles.py scripts/dutree.py scripts/finddiv.py scripts/findlinksto.py scripts/findnocoding.py scripts/fixcid.py scripts/fixdiv.py scripts/fixheader.py scripts/fixnotice.py scripts/fixps.py scripts/ftpmirror.py scripts/google.py scripts/lfcr.py scripts/linktree.py scripts/lll.py scripts/logmerge.py scripts/mailerdaemon.py scripts/mkreal.py scripts/ndiff.py scripts/objgraph.py scripts/pdeps.py scripts/pysource.py scripts/rgrep.py scripts/suff.py scripts/texcheck.py scripts/texi2html.py scripts/treesync.py scripts/untabify.py scripts/which.py scripts/xxci.py unicode/comparecodecs.py unicode/gencodec.py unicode/listcodecs.py unicode/makeunicodedata.py unicode/mkstringprep.py versioncheck/checkversions.py versioncheck/pyversioncheck.py webchecker/wcgui.py webchecker/webchecker.py webchecker/websucker.py

collin.winter python-3000-checkins at python.org
Fri Aug 3 19:06:46 CEST 2007


Author: collin.winter
Date: Fri Aug  3 19:06:41 2007
New Revision: 56706

Modified:
   python/branches/py3k-struni/Tools/audiopy/audiopy
   python/branches/py3k-struni/Tools/bgen/bgen/bgenGenerator.py
   python/branches/py3k-struni/Tools/bgen/bgen/bgenGeneratorGroup.py
   python/branches/py3k-struni/Tools/bgen/bgen/scantools.py
   python/branches/py3k-struni/Tools/faqwiz/faqw.py
   python/branches/py3k-struni/Tools/faqwiz/faqwiz.py
   python/branches/py3k-struni/Tools/framer/framer/bases.py
   python/branches/py3k-struni/Tools/framer/framer/function.py
   python/branches/py3k-struni/Tools/framer/framer/member.py
   python/branches/py3k-struni/Tools/i18n/makelocalealias.py
   python/branches/py3k-struni/Tools/i18n/msgfmt.py
   python/branches/py3k-struni/Tools/i18n/pygettext.py
   python/branches/py3k-struni/Tools/modulator/Tkextra.py
   python/branches/py3k-struni/Tools/msi/msi.py
   python/branches/py3k-struni/Tools/msi/msilib.py
   python/branches/py3k-struni/Tools/pybench/pybench.py
   python/branches/py3k-struni/Tools/pynche/ColorDB.py
   python/branches/py3k-struni/Tools/pynche/Main.py
   python/branches/py3k-struni/Tools/pynche/Switchboard.py
   python/branches/py3k-struni/Tools/scripts/byext.py
   python/branches/py3k-struni/Tools/scripts/byteyears.py
   python/branches/py3k-struni/Tools/scripts/checkappend.py
   python/branches/py3k-struni/Tools/scripts/checkpyc.py
   python/branches/py3k-struni/Tools/scripts/cleanfuture.py
   python/branches/py3k-struni/Tools/scripts/combinerefs.py
   python/branches/py3k-struni/Tools/scripts/crlf.py
   python/branches/py3k-struni/Tools/scripts/cvsfiles.py
   python/branches/py3k-struni/Tools/scripts/dutree.py
   python/branches/py3k-struni/Tools/scripts/finddiv.py
   python/branches/py3k-struni/Tools/scripts/findlinksto.py
   python/branches/py3k-struni/Tools/scripts/findnocoding.py
   python/branches/py3k-struni/Tools/scripts/fixcid.py
   python/branches/py3k-struni/Tools/scripts/fixdiv.py
   python/branches/py3k-struni/Tools/scripts/fixheader.py
   python/branches/py3k-struni/Tools/scripts/fixnotice.py
   python/branches/py3k-struni/Tools/scripts/fixps.py
   python/branches/py3k-struni/Tools/scripts/ftpmirror.py
   python/branches/py3k-struni/Tools/scripts/google.py
   python/branches/py3k-struni/Tools/scripts/lfcr.py
   python/branches/py3k-struni/Tools/scripts/linktree.py
   python/branches/py3k-struni/Tools/scripts/lll.py
   python/branches/py3k-struni/Tools/scripts/logmerge.py
   python/branches/py3k-struni/Tools/scripts/mailerdaemon.py
   python/branches/py3k-struni/Tools/scripts/mkreal.py
   python/branches/py3k-struni/Tools/scripts/ndiff.py
   python/branches/py3k-struni/Tools/scripts/objgraph.py
   python/branches/py3k-struni/Tools/scripts/pdeps.py
   python/branches/py3k-struni/Tools/scripts/pysource.py
   python/branches/py3k-struni/Tools/scripts/rgrep.py
   python/branches/py3k-struni/Tools/scripts/suff.py
   python/branches/py3k-struni/Tools/scripts/texcheck.py
   python/branches/py3k-struni/Tools/scripts/texi2html.py
   python/branches/py3k-struni/Tools/scripts/treesync.py
   python/branches/py3k-struni/Tools/scripts/untabify.py
   python/branches/py3k-struni/Tools/scripts/which.py
   python/branches/py3k-struni/Tools/scripts/xxci.py
   python/branches/py3k-struni/Tools/unicode/comparecodecs.py
   python/branches/py3k-struni/Tools/unicode/gencodec.py
   python/branches/py3k-struni/Tools/unicode/listcodecs.py
   python/branches/py3k-struni/Tools/unicode/makeunicodedata.py
   python/branches/py3k-struni/Tools/unicode/mkstringprep.py
   python/branches/py3k-struni/Tools/versioncheck/checkversions.py
   python/branches/py3k-struni/Tools/versioncheck/pyversioncheck.py
   python/branches/py3k-struni/Tools/webchecker/wcgui.py
   python/branches/py3k-struni/Tools/webchecker/webchecker.py
   python/branches/py3k-struni/Tools/webchecker/websucker.py
Log:
Convert print statements to function calls in Tools/.

Modified: python/branches/py3k-struni/Tools/audiopy/audiopy
==============================================================================
--- python/branches/py3k-struni/Tools/audiopy/audiopy	(original)
+++ python/branches/py3k-struni/Tools/audiopy/audiopy	Fri Aug  3 19:06:41 2007
@@ -401,9 +401,9 @@
 
 
 def usage(code, msg=''):
-    print __doc__ % globals()
+    print(__doc__ % globals())
     if msg:
-        print msg
+        print(msg)
     sys.exit(code)
 
 
@@ -455,11 +455,11 @@
             i = i + 1
             continue
         elif arg in ('-v', '--version'):
-            print '''\
+            print('''\
 audiopy -- a program to control the Solaris audio device.
 Contact: Barry Warsaw
 Email:   bwarsaw at python.org
-Version: %s''' % __version__            
+Version: %s''' % __version__)            
             sys.exit(0)
         for long, short, io, mask in options:
             if arg in (long, short):

Modified: python/branches/py3k-struni/Tools/bgen/bgen/bgenGenerator.py
==============================================================================
--- python/branches/py3k-struni/Tools/bgen/bgen/bgenGenerator.py	(original)
+++ python/branches/py3k-struni/Tools/bgen/bgen/bgenGenerator.py	Fri Aug  3 19:06:41 2007
@@ -16,7 +16,7 @@
 class BaseFunctionGenerator:
 
     def __init__(self, name, condition=None, callname=None, modifiers=None):
-        if DEBUG: print "<--", name
+        if DEBUG: print("<--", name)
         self.name = name
         if callname:
             self.callname = callname
@@ -36,7 +36,7 @@
     def generate(self):
         if not self.checkgenerate():
             return
-        if DEBUG: print "-->", self.name
+        if DEBUG: print("-->", self.name)
         if self.condition:
             Output()
             Output(self.condition)
@@ -157,7 +157,7 @@
                         continue
                 else:
                     typeName = "?"
-                    print "Nameless type", arg.type
+                    print("Nameless type", arg.type)
 
                 str = typeName + ' ' + arg.name
             if arg.mode in (InMode, InOutMode):
@@ -294,7 +294,7 @@
                  (int, 'status', ErrorMode),
                  )
     eggs.setprefix("spam")
-    print "/* START */"
+    print("/* START */")
     eggs.generate()
 
 

Modified: python/branches/py3k-struni/Tools/bgen/bgen/bgenGeneratorGroup.py
==============================================================================
--- python/branches/py3k-struni/Tools/bgen/bgen/bgenGeneratorGroup.py	(original)
+++ python/branches/py3k-struni/Tools/bgen/bgen/bgenGeneratorGroup.py	Fri Aug  3 19:06:41 2007
@@ -9,7 +9,7 @@
     def add(self, g, dupcheck=0):
         if dupcheck:
             if g in self.generators:
-                print 'DUP', g.name
+                print('DUP', g.name)
                 return
         g.setprefix(self.prefix)
         self.generators.append(g)
@@ -33,7 +33,7 @@
     group = GeneratorGroup("spam")
     eggs = FunctionGenerator(void, "eggs")
     group.add(eggs)
-    print "/* START */"
+    print("/* START */")
     group.generate()
 
 if __name__ == "__main__":

Modified: python/branches/py3k-struni/Tools/bgen/bgen/scantools.py
==============================================================================
--- python/branches/py3k-struni/Tools/bgen/bgen/scantools.py	(original)
+++ python/branches/py3k-struni/Tools/bgen/bgen/scantools.py	Fri Aug  3 19:06:41 2007
@@ -162,11 +162,11 @@
 
     def error(self, format, *args):
         if self.silent >= 0:
-            print format%args
+            print(format%args)
 
     def report(self, format, *args):
         if not self.silent:
-            print format%args
+            print(format%args)
 
     def writeinitialdefs(self):
         pass
@@ -221,7 +221,7 @@
         """
         f = self.openrepairfile()
         if not f: return []
-        print "Reading repair file", repr(f.name), "..."
+        print("Reading repair file", repr(f.name), "...")
         list = []
         lineno = 0
         while 1:
@@ -237,31 +237,31 @@
             words = [s.strip() for s in line.split(':')]
             if words == ['']: continue
             if len(words) <> 3:
-                print "Line", startlineno,
-                print ": bad line (not 3 colon-separated fields)"
-                print repr(line)
+                print("Line", startlineno, end=' ')
+                print(": bad line (not 3 colon-separated fields)")
+                print(repr(line))
                 continue
             [fpat, pat, rep] = words
             if not fpat: fpat = "*"
             if not pat:
-                print "Line", startlineno,
-                print "Empty pattern"
-                print repr(line)
+                print("Line", startlineno, end=' ')
+                print("Empty pattern")
+                print(repr(line))
                 continue
             patparts = [s.strip() for s in pat.split(',')]
             repparts = [s.strip() for s in rep.split(',')]
             patterns = []
             for p in patparts:
                 if not p:
-                    print "Line", startlineno,
-                    print "Empty pattern part"
-                    print repr(line)
+                    print("Line", startlineno, end=' ')
+                    print("Empty pattern part")
+                    print(repr(line))
                     continue
                 pattern = p.split()
                 if len(pattern) > 3:
-                    print "Line", startlineno,
-                    print "Pattern part has > 3 words"
-                    print repr(line)
+                    print("Line", startlineno, end=' ')
+                    print("Pattern part has > 3 words")
+                    print(repr(line))
                     pattern = pattern[:3]
                 else:
                     while len(pattern) < 3:
@@ -270,15 +270,15 @@
             replacements = []
             for p in repparts:
                 if not p:
-                    print "Line", startlineno,
-                    print "Empty replacement part"
-                    print repr(line)
+                    print("Line", startlineno, end=' ')
+                    print("Empty replacement part")
+                    print(repr(line))
                     continue
                 replacement = p.split()
                 if len(replacement) > 3:
-                    print "Line", startlineno,
-                    print "Pattern part has > 3 words"
-                    print repr(line)
+                    print("Line", startlineno, end=' ')
+                    print("Pattern part has > 3 words")
+                    print(repr(line))
                     replacement = replacement[:3]
                 else:
                     while len(replacement) < 3:
@@ -294,8 +294,8 @@
         try:
             return open(filename, "rU")
         except IOError as msg:
-            print repr(filename), ":", msg
-            print "Cannot open repair file -- assume no repair needed"
+            print(repr(filename), ":", msg)
+            print("Cannot open repair file -- assume no repair needed")
             return None
 
     def initfiles(self):

Modified: python/branches/py3k-struni/Tools/faqwiz/faqw.py
==============================================================================
--- python/branches/py3k-struni/Tools/faqwiz/faqw.py	(original)
+++ python/branches/py3k-struni/Tools/faqwiz/faqw.py	Fri Aug  3 19:06:41 2007
@@ -28,6 +28,6 @@
     sys.exit(n)
 except:
     t, v, tb = sys.exc_info()
-    print
+    print()
     import cgi
     cgi.print_exception(t, v, tb)

Modified: python/branches/py3k-struni/Tools/faqwiz/faqwiz.py
==============================================================================
--- python/branches/py3k-struni/Tools/faqwiz/faqwiz.py	(original)
+++ python/branches/py3k-struni/Tools/faqwiz/faqwiz.py	Fri Aug  3 19:06:41 2007
@@ -158,8 +158,8 @@
     then = now + COOKIE_LIFETIME
     gmt = time.gmtime(then)
     path = os.environ.get('SCRIPT_NAME', '/cgi-bin/')
-    print "Set-Cookie: %s=%s; path=%s;" % (name, value, path),
-    print time.strftime("expires=%a, %d-%b-%y %X GMT", gmt)
+    print("Set-Cookie: %s=%s; path=%s;" % (name, value, path), end=' ')
+    print(time.strftime("expires=%a, %d-%b-%y %X GMT", gmt))
 
 class MagicDict:
 
@@ -273,22 +273,22 @@
                 raw = 0
                 continue
             if raw:
-                print line
+                print(line)
                 continue
             if not line.strip():
                 if pre:
-                    print '</PRE>'
+                    print('</PRE>')
                     pre = 0
                 else:
-                    print '<P>'
+                    print('<P>')
             else:
                 if not line[0].isspace():
                     if pre:
-                        print '</PRE>'
+                        print('</PRE>')
                         pre = 0
                 else:
                     if not pre:
-                        print '<PRE>'
+                        print('<PRE>')
                         pre = 1
                 if '/' in line or '@' in line:
                     line = translate(line, pre)
@@ -296,16 +296,16 @@
                     line = escape(line)
                 if not pre and '*' in line:
                     line = emphasize(line)
-                print line
+                print(line)
         if pre:
-            print '</PRE>'
+            print('</PRE>')
             pre = 0
         if edit:
-            print '<P>'
+            print('<P>')
             emit(ENTRY_FOOTER, self)
             if self.last_changed_date:
                 emit(ENTRY_LOGINFO, self)
-        print '<P>'
+        print('<P>')
 
 class FaqDir:
 
@@ -377,7 +377,7 @@
         self.dir = FaqDir()
 
     def go(self):
-        print 'Content-type: text/html'
+        print('Content-type: text/html')
         req = self.ui.req or 'home'
         mname = 'do_%s' % req
         try:
@@ -493,7 +493,7 @@
                 mtime = mtime = entry.getmtime()
                 if mtime > latest:
                     latest = mtime
-        print time.strftime(LAST_CHANGED, time.localtime(latest))
+        print(time.strftime(LAST_CHANGED, time.localtime(latest)))
         emit(EXPLAIN_MARKS)
 
     def format_all(self, files, edit=1, headers=1):
@@ -637,7 +637,7 @@
                 rev = line[9:].split()
                 mami = revparse(rev)
                 if not mami:
-                    print line
+                    print(line)
                 else:
                     emit(REVISIONLINK, entry, rev=rev, line=line)
                     if mami[1] > 1:
@@ -647,7 +647,7 @@
                         emit(DIFFLINK, entry, prev=rev, rev=headrev)
                     else:
                         headrev = rev
-                    print
+                    print()
                 athead = 0
             else:
                 athead = 0
@@ -656,8 +656,8 @@
                     athead = 1
                     sys.stdout.write('<HR>')
                 else:
-                    print line
-        print '</PRE>'
+                    print(line)
+        print('</PRE>')
 
     def do_revision(self):
         entry = self.dir.open(self.ui.file)
@@ -686,8 +686,8 @@
     def shell(self, command):
         output = os.popen(command).read()
         sys.stdout.write('<PRE>')
-        print escape(output)
-        print '</PRE>'
+        print(escape(output))
+        print('</PRE>')
 
     def do_new(self):
         entry = self.dir.new(section=int(self.ui.section))
@@ -759,9 +759,9 @@
 
     def cantcommit(self):
         self.prologue(T_CANTCOMMIT)
-        print CANTCOMMIT_HEAD
+        print(CANTCOMMIT_HEAD)
         self.errordetail()
-        print CANTCOMMIT_TAIL
+        print(CANTCOMMIT_TAIL)
 
     def errordetail(self):
         if PASSWORD and self.ui.password != PASSWORD:
@@ -827,7 +827,7 @@
         else:
             self.error(T_COMMITFAILED)
             emit(COMMITFAILED, sts=sts)
-        print '<PRE>%s</PRE>' % escape(output)
+        print('<PRE>%s</PRE>' % escape(output))
 
         try:
             os.unlink(tf.name)

Modified: python/branches/py3k-struni/Tools/framer/framer/bases.py
==============================================================================
--- python/branches/py3k-struni/Tools/framer/framer/bases.py	(original)
+++ python/branches/py3k-struni/Tools/framer/framer/bases.py	Fri Aug  3 19:06:41 2007
@@ -27,7 +27,7 @@
 
     def dump_methoddef(self, f, functions, vars):
         def p(templ, vars=vars): # helper function to generate output
-            print >> f, templ % vars
+            print(templ % vars, file=f)
 
         if not functions:
             return
@@ -77,12 +77,12 @@
 
     def dump(self, f):
         def p(templ, vars=self.__vars): # helper function to generate output
-            print >> f, templ % vars
+            print(templ % vars, file=f)
 
         p(template.module_start)
         if self.__members:
             p(template.member_include)
-        print >> f
+        print(file=f)
 
         if self.__doc__:
             p(template.module_doc)
@@ -111,10 +111,10 @@
 
         # defined after initvars() so that __vars is defined
         def p(templ, vars=self.__vars):
-            print >> f, templ % vars
+            print(templ % vars, file=f)
 
         if self.struct is not None:
-            print >> f, unindent(self.struct, False)
+            print(unindent(self.struct, False), file=f)
 
         if self.__doc__:
             p(template.docstring)
@@ -185,7 +185,7 @@
 
     def dump_memberdef(self, f):
         def p(templ, vars=self.__vars):
-            print >> f, templ % vars
+            print(templ % vars, file=f)
 
         if not self.__members:
             return
@@ -196,7 +196,7 @@
 
     def dump_slots(self, f):
         def p(templ, vars=self.__vars):
-            print >> f, templ % vars
+            print(templ % vars, file=f)
 
         if self.struct:
             p(template.dealloc_func, {"name" : self.__slots[TP_DEALLOC]})
@@ -206,12 +206,12 @@
             val = self.__slots.get(s, s.default)
             ntabs = 4 - (4 + len(val)) / 8
             line = "        %s,%s/* %s */" % (val, "\t" * ntabs, s.name)
-            print >> f, line
+            print(line, file=f)
         p(template.type_struct_end)
 
     def dump_init(self, f):
         def p(templ):
-            print >> f, templ % self.__vars
+            print(templ % self.__vars, file=f)
 
         p(template.type_init_type)
         p(template.module_add_type)

Modified: python/branches/py3k-struni/Tools/framer/framer/function.py
==============================================================================
--- python/branches/py3k-struni/Tools/framer/framer/function.py	(original)
+++ python/branches/py3k-struni/Tools/framer/framer/function.py	Fri Aug  3 19:06:41 2007
@@ -96,7 +96,7 @@
 
     def dump_decls(self, f):
         for a in self.args:
-            print >> f, "        %s" % a.decl()
+            print("        %s" % a.decl(), file=f)
 
 def ArgumentList(func, method):
     code = func.func_code
@@ -135,7 +135,7 @@
         def p(templ, vars=None): # helper function to generate output
             if vars is None:
                 vars = self.vars
-            print >> f, templ % vars
+            print(templ % vars, file=f)
 
         if self.__doc__:
             p(template.docstring)

Modified: python/branches/py3k-struni/Tools/framer/framer/member.py
==============================================================================
--- python/branches/py3k-struni/Tools/framer/framer/member.py	(original)
+++ python/branches/py3k-struni/Tools/framer/framer/member.py	Fri Aug  3 19:06:41 2007
@@ -68,6 +68,6 @@
 
     def dump(self, f):
         if self.doc is None:
-            print >> f, template.memberdef_def % self.vars
+            print(template.memberdef_def % self.vars, file=f)
         else:
-            print >> f, template.memberdef_def_doc % self.vars
+            print(template.memberdef_def_doc % self.vars, file=f)

Modified: python/branches/py3k-struni/Tools/i18n/makelocalealias.py
==============================================================================
--- python/branches/py3k-struni/Tools/i18n/makelocalealias.py	(original)
+++ python/branches/py3k-struni/Tools/i18n/makelocalealias.py	Fri Aug  3 19:06:41 2007
@@ -49,7 +49,7 @@
     items = data.items()
     items.sort()
     for k,v in items:
-        print '    %-40s%r,' % ('%r:' % k, v)
+        print('    %-40s%r,' % ('%r:' % k, v))
 
 def print_differences(data, olddata):
 
@@ -57,17 +57,17 @@
     items.sort()
     for k, v in items:
         if not data.has_key(k):
-            print '#    removed %r' % k
+            print('#    removed %r' % k)
         elif olddata[k] != data[k]:
-            print '#    updated %r -> %r to %r' % \
-                  (k, olddata[k], data[k])
+            print('#    updated %r -> %r to %r' % \
+                  (k, olddata[k], data[k]))
         # Additions are not mentioned
 
 if __name__ == '__main__':
     data = locale.locale_alias.copy()
     data.update(parse(LOCALE_ALIAS))
     print_differences(data, locale.locale_alias)
-    print
-    print 'locale_alias = {'
+    print()
+    print('locale_alias = {')
     pprint(data)
-    print '}'
+    print('}')

Modified: python/branches/py3k-struni/Tools/i18n/msgfmt.py
==============================================================================
--- python/branches/py3k-struni/Tools/i18n/msgfmt.py	(original)
+++ python/branches/py3k-struni/Tools/i18n/msgfmt.py	Fri Aug  3 19:06:41 2007
@@ -38,9 +38,9 @@
 
 
 def usage(code, msg=''):
-    print >> sys.stderr, __doc__
+    print(__doc__, file=sys.stderr)
     if msg:
-        print >> sys.stderr, msg
+        print(msg, file=sys.stderr)
     sys.exit(code)
 
 
@@ -111,7 +111,7 @@
     try:
         lines = open(infile).readlines()
     except IOError as msg:
-        print >> sys.stderr, msg
+        print(msg, file=sys.stderr)
         sys.exit(1)
 
     section = None
@@ -154,9 +154,9 @@
         elif section == STR:
             msgstr += l
         else:
-            print >> sys.stderr, 'Syntax error on %s:%d' % (infile, lno), \
-                  'before:'
-            print >> sys.stderr, l
+            print('Syntax error on %s:%d' % (infile, lno), \
+                  'before:', file=sys.stderr)
+            print(l, file=sys.stderr)
             sys.exit(1)
     # Add last entry
     if section == STR:
@@ -168,7 +168,7 @@
     try:
         open(outfile,"wb").write(output)
     except IOError as msg:
-        print >> sys.stderr, msg
+        print(msg, file=sys.stderr)
 
 
 
@@ -185,14 +185,14 @@
         if opt in ('-h', '--help'):
             usage(0)
         elif opt in ('-V', '--version'):
-            print >> sys.stderr, "msgfmt.py", __version__
+            print("msgfmt.py", __version__, file=sys.stderr)
             sys.exit(0)
         elif opt in ('-o', '--output-file'):
             outfile = arg
     # do it
     if not args:
-        print >> sys.stderr, 'No input file given'
-        print >> sys.stderr, "Try `msgfmt --help' for more information."
+        print('No input file given', file=sys.stderr)
+        print("Try `msgfmt --help' for more information.", file=sys.stderr)
         return
 
     for filename in args:

Modified: python/branches/py3k-struni/Tools/i18n/pygettext.py
==============================================================================
--- python/branches/py3k-struni/Tools/i18n/pygettext.py	(original)
+++ python/branches/py3k-struni/Tools/i18n/pygettext.py	Fri Aug  3 19:06:41 2007
@@ -197,9 +197,9 @@
 
 
 def usage(code, msg=''):
-    print >> sys.stderr, __doc__ % globals()
+    print(__doc__ % globals(), file=sys.stderr)
     if msg:
-        print >> sys.stderr, msg
+        print(msg, file=sys.stderr)
     sys.exit(code)
 
 
@@ -423,13 +423,13 @@
         elif ttype not in [tokenize.COMMENT, token.INDENT, token.DEDENT,
                            token.NEWLINE, tokenize.NL]:
             # warn if we see anything else than STRING or whitespace
-            print >> sys.stderr, _(
+            print(_(
                 '*** %(file)s:%(lineno)s: Seen unexpected token "%(token)s"'
                 ) % {
                 'token': tstring,
                 'file': self.__curfile,
                 'lineno': self.__lineno
-                }
+                }, file=sys.stderr)
             self.__state = self.__waiting
 
     def __addentry(self, msg, lineno=None, isdocstring=0):
@@ -448,7 +448,7 @@
         timestamp = time.strftime('%Y-%m-%d %H:%M+%Z')
         # The time stamp in the header doesn't have the same format as that
         # generated by xgettext...
-        print >> fp, pot_header % {'time': timestamp, 'version': __version__}
+        print(pot_header % {'time': timestamp, 'version': __version__}, file=fp)
         # Sort the entries.  First sort each particular entry's keys, then
         # sort all the entries by their first item.
         reverse = {}
@@ -477,8 +477,8 @@
                 elif options.locationstyle == options.SOLARIS:
                     for filename, lineno in v:
                         d = {'filename': filename, 'lineno': lineno}
-                        print >>fp, _(
-                            '# File: %(filename)s, line: %(lineno)d') % d
+                        print(_(
+                            '# File: %(filename)s, line: %(lineno)d') % d, file=fp)
                 elif options.locationstyle == options.GNU:
                     # fit as many locations on one line, as long as the
                     # resulting line length doesn't exceeds 'options.width'
@@ -489,14 +489,14 @@
                         if len(locline) + len(s) <= options.width:
                             locline = locline + s
                         else:
-                            print >> fp, locline
+                            print(locline, file=fp)
                             locline = "#:" + s
                     if len(locline) > 2:
-                        print >> fp, locline
+                        print(locline, file=fp)
                 if isdocstring:
-                    print >> fp, '#, docstring'
-                print >> fp, 'msgid', normalize(k)
-                print >> fp, 'msgstr ""\n'
+                    print('#, docstring', file=fp)
+                print('msgid', normalize(k), file=fp)
+                print('msgstr ""\n', file=fp)
 
 
 
@@ -570,7 +570,7 @@
         elif opt in ('-v', '--verbose'):
             options.verbose = 1
         elif opt in ('-V', '--version'):
-            print _('pygettext.py (xgettext for Python) %s') % __version__
+            print(_('pygettext.py (xgettext for Python) %s') % __version__)
             sys.exit(0)
         elif opt in ('-w', '--width'):
             try:
@@ -603,8 +603,8 @@
             options.toexclude = fp.readlines()
             fp.close()
         except IOError:
-            print >> sys.stderr, _(
-                "Can't read --exclude-file: %s") % options.excludefilename
+            print(_(
+                "Can't read --exclude-file: %s") % options.excludefilename, file=sys.stderr)
             sys.exit(1)
     else:
         options.toexclude = []
@@ -623,12 +623,12 @@
     for filename in args:
         if filename == '-':
             if options.verbose:
-                print _('Reading standard input')
+                print(_('Reading standard input'))
             fp = sys.stdin
             closep = 0
         else:
             if options.verbose:
-                print _('Working on %s') % filename
+                print(_('Working on %s') % filename)
             fp = open(filename)
             closep = 1
         try:
@@ -636,8 +636,8 @@
             try:
                 tokenize.tokenize(fp.readline, eater)
             except tokenize.TokenError as e:
-                print >> sys.stderr, '%s: %s, line %d, column %d' % (
-                    e[0], filename, e[1][0], e[1][1])
+                print('%s: %s, line %d, column %d' % (
+                    e[0], filename, e[1][0], e[1][1]), file=sys.stderr)
         finally:
             if closep:
                 fp.close()

Modified: python/branches/py3k-struni/Tools/modulator/Tkextra.py
==============================================================================
--- python/branches/py3k-struni/Tools/modulator/Tkextra.py	(original)
+++ python/branches/py3k-struni/Tools/modulator/Tkextra.py	Fri Aug  3 19:06:41 2007
@@ -198,7 +198,7 @@
                '',
                -1,
                'OK')
-    print 'pressed button', i
+    print('pressed button', i)
     i = dialog(mainWidget,
                'File Modified',
                'File "tcl.h" has been modified since '
@@ -209,13 +209,13 @@
                'Save File',
                'Discard Changes',
                'Return To Editor')
-    print 'pressed button', i
-    print message('Test of message')
-    print askyn('Test of yes/no')
-    print askync('Test of yes/no/cancel')
-    print askstr('Type a string:')
-    print strdialog(mainWidget, 'Question', 'Another string:', '',
-                  0, 'Save', 'Save as text')
+    print('pressed button', i)
+    print(message('Test of message'))
+    print(askyn('Test of yes/no'))
+    print(askync('Test of yes/no/cancel'))
+    print(askstr('Type a string:'))
+    print(strdialog(mainWidget, 'Question', 'Another string:', '',
+                  0, 'Save', 'Save as text'))
 
 def _test():
     import sys

Modified: python/branches/py3k-struni/Tools/msi/msi.py
==============================================================================
--- python/branches/py3k-struni/Tools/msi/msi.py	(original)
+++ python/branches/py3k-struni/Tools/msi/msi.py	Fri Aug  3 19:06:41 2007
@@ -114,7 +114,7 @@
     dlltool = find_executable('dlltool')
 
     if not nm or not dlltool:
-        print warning % "nm and/or dlltool were not found"
+        print(warning % "nm and/or dlltool were not found")
         return False
 
     nm_command = '%s -Cs %s' % (nm, lib_file)
@@ -123,23 +123,23 @@
     export_match = re.compile(r"^_imp__(.*) in python\d+\.dll").match
 
     f = open(def_file,'w')
-    print >>f, "LIBRARY %s" % dll_file
-    print >>f, "EXPORTS"
+    print("LIBRARY %s" % dll_file, file=f)
+    print("EXPORTS", file=f)
 
     nm_pipe = os.popen(nm_command)
     for line in nm_pipe.readlines():
         m = export_match(line)
         if m:
-            print >>f, m.group(1)
+            print(m.group(1), file=f)
     f.close()
     exit = nm_pipe.close()
 
     if exit:
-        print warning % "nm did not run successfully"
+        print(warning % "nm did not run successfully")
         return False
 
     if os.system(dlltool_command) != 0:
-        print warning % "dlltool did not run successfully"
+        print(warning % "dlltool did not run successfully")
         return False
 
     return True
@@ -875,7 +875,7 @@
     # Check if _ctypes.pyd exists
     have_ctypes = os.path.exists(srcdir+"/PCBuild/_ctypes.pyd")
     if not have_ctypes:
-        print "WARNING: _ctypes.pyd not found, ctypes will not be included"
+        print("WARNING: _ctypes.pyd not found, ctypes will not be included")
         extensions.remove("_ctypes.pyd")
 
     # Add all .py files in Lib, except lib-tk, test
@@ -953,7 +953,7 @@
                 if f.endswith(".au") or f.endswith(".gif"):
                     lib.add_file(f)
                 else:
-                    print "WARNING: New file %s in email/test/data" % f
+                    print("WARNING: New file %s in email/test/data" % f)
         for f in os.listdir(lib.absolute):
             if os.path.isdir(os.path.join(lib.absolute, f)):
                 pydirs.append((lib, f))
@@ -968,7 +968,7 @@
         if f=="_tkinter.pyd":
             continue
         if not os.path.exists(srcdir+"/PCBuild/"+f):
-            print "WARNING: Missing extension", f
+            print("WARNING: Missing extension", f)
             continue
         dlls.append(f)
         lib.add_file(f)
@@ -982,7 +982,7 @@
     lib.add_file(srcdir+"/"+sqlite_dir+sqlite_arch+"/sqlite3.dll")
     if have_tcl:
         if not os.path.exists(srcdir+"/PCBuild/_tkinter.pyd"):
-            print "WARNING: Missing _tkinter.pyd"
+            print("WARNING: Missing _tkinter.pyd")
         else:
             lib.start_component("TkDLLs", tcltk)
             lib.add_file("_tkinter.pyd")
@@ -994,7 +994,7 @@
     for f in glob.glob1(srcdir+"/PCBuild", "*.pyd"):
         if f.endswith("_d.pyd"): continue # debug version
         if f in dlls: continue
-        print "WARNING: Unknown extension", f
+        print("WARNING: Unknown extension", f)
 
     # Add headers
     default_feature.set_current()

Modified: python/branches/py3k-struni/Tools/msi/msilib.py
==============================================================================
--- python/branches/py3k-struni/Tools/msi/msilib.py	(original)
+++ python/branches/py3k-struni/Tools/msi/msilib.py	Fri Aug  3 19:06:41 2007
@@ -95,7 +95,7 @@
             index -= 1
             unk = type & ~knownbits
             if unk:
-                print "%s.%s unknown bits %x" % (self.name, name, unk)
+                print("%s.%s unknown bits %x" % (self.name, name, unk))
             size = type & datasizemask
             dtype = type & typemask
             if dtype == type_string:
@@ -114,7 +114,7 @@
                 tname="OBJECT"
             else:
                 tname="unknown"
-                print "%s.%sunknown integer type %d" % (self.name, name, size)
+                print("%s.%sunknown integer type %d" % (self.name, name, size))
             if type & type_nullable:
                 flags = ""
             else:
@@ -202,7 +202,7 @@
     v = seqmsi.OpenView("SELECT * FROM _Tables");
     v.Execute(None)
     f = open(destpath, "w")
-    print >>f, "import msilib,os;dirname=os.path.dirname(__file__)"
+    print("import msilib,os;dirname=os.path.dirname(__file__)", file=f)
     tables = []
     while 1:
         r = v.Fetch()
@@ -364,9 +364,9 @@
             logical = self.gen_id(dir, file)
         self.index += 1
         if full.find(" ")!=-1:
-            print >>self.file, '"%s" %s' % (full, logical)
+            print('"%s" %s' % (full, logical), file=self.file)
         else:
-            print >>self.file, '%s %s' % (full, logical)
+            print('%s %s' % (full, logical), file=self.file)
         return self.index, logical
 
     def commit(self, db):
@@ -386,7 +386,7 @@
             if not os.path.exists(cabarc):continue
             break
         else:
-            print "WARNING: cabarc.exe not found in registry"
+            print("WARNING: cabarc.exe not found in registry")
             cabarc = "cabarc.exe"
         cmd = r'"%s" -m lzx:21 n %s.cab @%s.txt' % (cabarc, self.name, self.name)
         p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,

Modified: python/branches/py3k-struni/Tools/pybench/pybench.py
==============================================================================
--- python/branches/py3k-struni/Tools/pybench/pybench.py	(original)
+++ python/branches/py3k-struni/Tools/pybench/pybench.py	Fri Aug  3 19:06:41 2007
@@ -547,11 +547,11 @@
                            min_overhead * MILLI_SECONDS))
             self.roundtimes.append(total_eff_time)
             if self.verbose:
-                print(('                   '
-                       '               ------------------------------'))
-                print(('                   '
+                print('                   '
+                       '               ------------------------------')
+                print('                   '
                        '     Totals:    %6.0fms' %
-                       (total_eff_time * MILLI_SECONDS)))
+                       (total_eff_time * MILLI_SECONDS))
                 print()
             else:
                 print('* Round %i done in %.3f seconds.' % (i+1,
@@ -595,8 +595,8 @@
 
     def print_benchmark(self, hidenoise=0, limitnames=None):
 
-        print(('Test                          '
-               '   minimum  average  operation  overhead'))
+        print('Test                          '
+               '   minimum  average  operation  overhead')
         print('-' * LINE)
         tests = sorted(self.tests.items())
         total_min_time = 0.0
@@ -619,20 +619,20 @@
                    op_avg * MICRO_SECONDS,
                    min_overhead *MILLI_SECONDS))
         print('-' * LINE)
-        print(('Totals:                        '
+        print('Totals:                        '
                ' %6.0fms %6.0fms' %
                (total_min_time * MILLI_SECONDS,
                 total_avg_time * MILLI_SECONDS,
-                )))
+                ))
         print()
 
     def print_comparison(self, compare_to, hidenoise=0, limitnames=None):
 
         # Check benchmark versions
         if compare_to.version != self.version:
-            print(('* Benchmark versions differ: '
+            print('* Benchmark versions differ: '
                    'cannot compare this benchmark to "%s" !' %
-                   compare_to.name))
+                   compare_to.name)
             print()
             self.print_benchmark(hidenoise=hidenoise,
                                  limitnames=limitnames)
@@ -640,10 +640,10 @@
 
         # Print header
         compare_to.print_header('Comparing with')
-        print(('Test                          '
-               '   minimum run-time        average  run-time'))
-        print(('                              '
-               '   this    other   diff    this    other   diff'))
+        print('Test                          '
+               '   minimum run-time        average  run-time')
+        print('                              '
+               '   this    other   diff    this    other   diff')
         print('-' * LINE)
 
         # Print test comparisons
@@ -726,7 +726,7 @@
                      (other_total_avg_time * compare_to.warp) - 1.0) * PERCENT)
             else:
                 avg_diff = 'n/a'
-        print(('Totals:                       '
+        print('Totals:                       '
                '  %5.0fms %5.0fms %7s %5.0fms %5.0fms %7s' %
                (total_min_time * MILLI_SECONDS,
                 (other_total_min_time * compare_to.warp/self.warp
@@ -736,7 +736,7 @@
                 (other_total_avg_time * compare_to.warp/self.warp
                  * MILLI_SECONDS),
                 avg_diff
-               )))
+               ))
         print()
         print('(this=%s, other=%s)' % (self.name,
                                        compare_to.name))

Modified: python/branches/py3k-struni/Tools/pynche/ColorDB.py
==============================================================================
--- python/branches/py3k-struni/Tools/pynche/ColorDB.py	(original)
+++ python/branches/py3k-struni/Tools/pynche/ColorDB.py	Fri Aug  3 19:06:41 2007
@@ -57,7 +57,7 @@
             # get this compiled regular expression from derived class
             mo = self._re.match(line)
             if not mo:
-                print >> sys.stderr, 'Error in', fp.name, ' line', lineno
+                print('Error in', fp.name, ' line', lineno, file=sys.stderr)
                 lineno += 1
                 continue
             # extract the red, green, blue, and name
@@ -254,26 +254,26 @@
 if __name__ == '__main__':
     colordb = get_colordb('/usr/openwin/lib/rgb.txt')
     if not colordb:
-        print 'No parseable color database found'
+        print('No parseable color database found')
         sys.exit(1)
     # on my system, this color matches exactly
     target = 'navy'
     red, green, blue = rgbtuple = colordb.find_byname(target)
-    print target, ':', red, green, blue, triplet_to_rrggbb(rgbtuple)
+    print(target, ':', red, green, blue, triplet_to_rrggbb(rgbtuple))
     name, aliases = colordb.find_byrgb(rgbtuple)
-    print 'name:', name, 'aliases:', COMMASPACE.join(aliases)
+    print('name:', name, 'aliases:', COMMASPACE.join(aliases))
     r, g, b = (1, 1, 128)                         # nearest to navy
     r, g, b = (145, 238, 144)                     # nearest to lightgreen
     r, g, b = (255, 251, 250)                     # snow
-    print 'finding nearest to', target, '...'
+    print('finding nearest to', target, '...')
     import time
     t0 = time.time()
     nearest = colordb.nearest(r, g, b)
     t1 = time.time()
-    print 'found nearest color', nearest, 'in', t1-t0, 'seconds'
+    print('found nearest color', nearest, 'in', t1-t0, 'seconds')
     # dump the database
     for n in colordb.unique_names():
         r, g, b = colordb.find_byname(n)
         aliases = colordb.aliases_of(r, g, b)
-        print '%20s: (%3d/%3d/%3d) == %s' % (n, r, g, b,
-                                             SPACE.join(aliases[1:]))
+        print('%20s: (%3d/%3d/%3d) == %s' % (n, r, g, b,
+                                             SPACE.join(aliases[1:])))

Modified: python/branches/py3k-struni/Tools/pynche/Main.py
==============================================================================
--- python/branches/py3k-struni/Tools/pynche/Main.py	(original)
+++ python/branches/py3k-struni/Tools/pynche/Main.py	Fri Aug  3 19:06:41 2007
@@ -85,9 +85,9 @@
 
 
 def usage(code, msg=''):
-    print docstring()
+    print(docstring())
     if msg:
-        print msg
+        print(msg)
     sys.exit(code)
 
 
@@ -111,7 +111,7 @@
         # this to be escaped, which is a pain
         r, g, b = scan_color('#' + s)
     if r is None:
-        print 'Bad initial color, using gray50:', s
+        print('Bad initial color, using gray50:', s)
         r, g, b = scan_color('gray50')
     if r is None:
         usage(1, 'Cannot find an initial color to use')
@@ -203,11 +203,11 @@
         if opt in ('-h', '--help'):
             usage(0)
         elif opt in ('-v', '--version'):
-            print """\
+            print("""\
 Pynche -- The PYthon Natural Color and Hue Editor.
 Contact: %(AUTHNAME)s
 Email:   %(AUTHEMAIL)s
-Version: %(__version__)s""" % globals()
+Version: %(__version__)s""" % globals())
             sys.exit(0)
         elif opt in ('-d', '--database'):
             dbfile = arg

Modified: python/branches/py3k-struni/Tools/pynche/Switchboard.py
==============================================================================
--- python/branches/py3k-struni/Tools/pynche/Switchboard.py	(original)
+++ python/branches/py3k-struni/Tools/pynche/Switchboard.py	Fri Aug  3 19:06:41 2007
@@ -65,8 +65,7 @@
                     fp = open(initfile)
                     self.__optiondb = marshal.load(fp)
                     if not isinstance(self.__optiondb, DictType):
-                        print >> sys.stderr, \
-                              'Problem reading options from file:', initfile
+                        print('Problem reading options from file:', initfile, file=sys.stderr)
                         self.__optiondb = {}
                 except (IOError, EOFError, ValueError):
                     pass
@@ -119,8 +118,8 @@
             try:
                 fp = open(self.__initfile, 'w')
             except IOError:
-                print >> sys.stderr, 'Cannot write options to file:', \
-                      self.__initfile
+                print('Cannot write options to file:', \
+                      self.__initfile, file=sys.stderr)
             else:
                 marshal.dump(self.__optiondb, fp)
         finally:

Modified: python/branches/py3k-struni/Tools/scripts/byext.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/byext.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/byext.py	Fri Aug  3 19:06:41 2007
@@ -109,14 +109,14 @@
         cols.insert(0, "ext")
         def printheader():
             for col in cols:
-                print "%*s" % (colwidth[col], col),
-            print
+                print("%*s" % (colwidth[col], col), end=' ')
+            print()
         printheader()
         for ext in exts:
             for col in cols:
                 value = self.stats[ext].get(col, "")
-                print "%*s" % (colwidth[col], value),
-            print
+                print("%*s" % (colwidth[col], value), end=' ')
+            print()
         printheader() # Another header at the bottom
 
 def main():

Modified: python/branches/py3k-struni/Tools/scripts/byteyears.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/byteyears.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/byteyears.py	Fri Aug  3 19:06:41 2007
@@ -52,8 +52,8 @@
             size = st[ST_SIZE]
             age = now - anytime
             byteyears = float(size) * float(age) / secs_per_year
-            print filename.ljust(maxlen),
-            print repr(int(byteyears)).rjust(8)
+            print(filename.ljust(maxlen), end=' ')
+            print(repr(int(byteyears)).rjust(8))
 
     sys.exit(status)
 

Modified: python/branches/py3k-struni/Tools/scripts/checkappend.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/checkappend.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/checkappend.py	Fri Aug  3 19:06:41 2007
@@ -65,7 +65,7 @@
 def check(file):
     if os.path.isdir(file) and not os.path.islink(file):
         if verbose:
-            print "%r: listing directory" % (file,)
+            print("%r: listing directory" % (file,))
         names = os.listdir(file)
         for name in names:
             fullname = os.path.join(file, name)
@@ -82,11 +82,11 @@
         return
 
     if verbose > 1:
-        print "checking %r ..." % (file,)
+        print("checking %r ..." % (file,))
 
     ok = AppendChecker(file, f).run()
     if verbose and ok:
-        print "%r: Clean bill of health." % (file,)
+        print("%r: Clean bill of health." % (file,))
 
 [FIND_DOT,
  FIND_APPEND,
@@ -149,8 +149,8 @@
                         state = FIND_DOT
                 elif token == "," and self.level == 1:
                     self.nerrors = self.nerrors + 1
-                    print "%s(%d):\n%s" % (self.fname, self.lineno,
-                                           self.line)
+                    print("%s(%d):\n%s" % (self.fname, self.lineno,
+                                           self.line))
                     # don't gripe about this stmt again
                     state = FIND_STMT
 

Modified: python/branches/py3k-struni/Tools/scripts/checkpyc.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/checkpyc.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/checkpyc.py	Fri Aug  3 19:06:41 2007
@@ -17,15 +17,15 @@
             silent = 1
     MAGIC = imp.get_magic()
     if not silent:
-        print 'Using MAGIC word', repr(MAGIC)
+        print('Using MAGIC word', repr(MAGIC))
     for dirname in sys.path:
         try:
             names = os.listdir(dirname)
         except os.error:
-            print 'Cannot list directory', repr(dirname)
+            print('Cannot list directory', repr(dirname))
             continue
         if not silent:
-            print 'Checking ', repr(dirname), '...'
+            print('Checking ', repr(dirname), '...')
         names.sort()
         for name in names:
             if name[-3:] == '.py':
@@ -33,29 +33,29 @@
                 try:
                     st = os.stat(name)
                 except os.error:
-                    print 'Cannot stat', repr(name)
+                    print('Cannot stat', repr(name))
                     continue
                 if verbose:
-                    print 'Check', repr(name), '...'
+                    print('Check', repr(name), '...')
                 name_c = name + 'c'
                 try:
                     f = open(name_c, 'r')
                 except IOError:
-                    print 'Cannot open', repr(name_c)
+                    print('Cannot open', repr(name_c))
                     continue
                 magic_str = f.read(4)
                 mtime_str = f.read(4)
                 f.close()
                 if magic_str <> MAGIC:
-                    print 'Bad MAGIC word in ".pyc" file',
-                    print repr(name_c)
+                    print('Bad MAGIC word in ".pyc" file', end=' ')
+                    print(repr(name_c))
                     continue
                 mtime = get_long(mtime_str)
                 if mtime == 0 or mtime == -1:
-                    print 'Bad ".pyc" file', repr(name_c)
+                    print('Bad ".pyc" file', repr(name_c))
                 elif mtime <> st[ST_MTIME]:
-                    print 'Out-of-date ".pyc" file',
-                    print repr(name_c)
+                    print('Out-of-date ".pyc" file', end=' ')
+                    print(repr(name_c))
 
 def get_long(s):
     if len(s) <> 4:

Modified: python/branches/py3k-struni/Tools/scripts/cleanfuture.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/cleanfuture.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/cleanfuture.py	Fri Aug  3 19:06:41 2007
@@ -78,7 +78,7 @@
 def check(file):
     if os.path.isdir(file) and not os.path.islink(file):
         if verbose:
-            print "listing directory", file
+            print("listing directory", file)
         names = os.listdir(file)
         for name in names:
             fullname = os.path.join(file, name)
@@ -89,7 +89,7 @@
         return
 
     if verbose:
-        print "checking", file, "...",
+        print("checking", file, "...", end=' ')
     try:
         f = open(file)
     except IOError as msg:
@@ -103,33 +103,33 @@
     f.close()
     if changed:
         if verbose:
-            print "changed."
+            print("changed.")
             if dryrun:
-                print "But this is a dry run, so leaving it alone."
+                print("But this is a dry run, so leaving it alone.")
         for s, e, line in changed:
-            print "%r lines %d-%d" % (file, s+1, e+1)
+            print("%r lines %d-%d" % (file, s+1, e+1))
             for i in range(s, e+1):
-                print ff.lines[i],
+                print(ff.lines[i], end=' ')
             if line is None:
-                print "-- deleted"
+                print("-- deleted")
             else:
-                print "-- change to:"
-                print line,
+                print("-- change to:")
+                print(line, end=' ')
         if not dryrun:
             bak = file + ".bak"
             if os.path.exists(bak):
                 os.remove(bak)
             os.rename(file, bak)
             if verbose:
-                print "renamed", file, "to", bak
+                print("renamed", file, "to", bak)
             g = open(file, "w")
             ff.write(g)
             g.close()
             if verbose:
-                print "wrote new", file
+                print("wrote new", file)
     else:
         if verbose:
-            print "unchanged."
+            print("unchanged.")
 
 class FutureFinder:
 

Modified: python/branches/py3k-struni/Tools/scripts/combinerefs.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/combinerefs.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/combinerefs.py	Fri Aug  3 19:06:41 2007
@@ -102,7 +102,7 @@
             addr, addr2rc[addr], addr2guts[addr] = m.groups()
             before += 1
         else:
-            print '??? skipped:', line
+            print('??? skipped:', line)
 
     after = 0
     for line in read(fi, crack, True):
@@ -111,17 +111,17 @@
         assert m
         addr, rc, guts = m.groups() # guts is type name here
         if addr not in addr2rc:
-            print '??? new object created while tearing down:', line.rstrip()
+            print('??? new object created while tearing down:', line.rstrip())
             continue
-        print addr,
+        print(addr, end=' ')
         if rc == addr2rc[addr]:
-            print '[%s]' % rc,
+            print('[%s]' % rc, end=' ')
         else:
-            print '[%s->%s]' % (addr2rc[addr], rc),
-        print guts, addr2guts[addr]
+            print('[%s->%s]' % (addr2rc[addr], rc), end=' ')
+        print(guts, addr2guts[addr])
 
     f.close()
-    print "%d objects before, %d after" % (before, after)
+    print("%d objects before, %d after" % (before, after))
 
 if __name__ == '__main__':
     combine(sys.argv[1])

Modified: python/branches/py3k-struni/Tools/scripts/crlf.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/crlf.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/crlf.py	Fri Aug  3 19:06:41 2007
@@ -6,15 +6,15 @@
 def main():
     for filename in sys.argv[1:]:
         if os.path.isdir(filename):
-            print filename, "Directory!"
+            print(filename, "Directory!")
             continue
         data = open(filename, "rb").read()
         if '\0' in data:
-            print filename, "Binary!"
+            print(filename, "Binary!")
             continue
         newdata = data.replace("\r\n", "\n")
         if newdata != data:
-            print filename
+            print(filename)
             f = open(filename, "wb")
             f.write(newdata)
             f.close()

Modified: python/branches/py3k-struni/Tools/scripts/cvsfiles.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/cvsfiles.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/cvsfiles.py	Fri Aug  3 19:06:41 2007
@@ -21,8 +21,8 @@
     try:
         opts, args = getopt.getopt(sys.argv[1:], "n:")
     except getopt.error as msg:
-        print msg
-        print __doc__,
+        print(msg)
+        print(__doc__, end=' ')
         return 1
     global cutofftime
     newerfile = None
@@ -57,7 +57,7 @@
                 if cutofftime and getmtime(fullname) <= cutofftime:
                     pass
                 else:
-                    print fullname
+                    print(fullname)
     for sub in subdirs:
         process(sub)
 

Modified: python/branches/py3k-struni/Tools/scripts/dutree.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/dutree.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/dutree.py	Fri Aug  3 19:06:41 2007
@@ -51,7 +51,7 @@
         if tsub is None:
             psub = prefix
         else:
-            print prefix + repr(tsub).rjust(width) + ' ' + key
+            print(prefix + repr(tsub).rjust(width) + ' ' + key)
             psub = prefix + ' '*(width-1) + '|' + ' '*(len(key)+1)
         if d.has_key(key):
             show(tsub, d[key][1], psub)

Modified: python/branches/py3k-struni/Tools/scripts/finddiv.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/finddiv.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/finddiv.py	Fri Aug  3 19:06:41 2007
@@ -32,7 +32,7 @@
     listnames = 0
     for o, a in opts:
         if o == "-h":
-            print __doc__
+            print(__doc__)
             return
         if o == "-l":
             listnames = 1
@@ -60,11 +60,11 @@
     for type, token, (row, col), end, line in g:
         if token in ("/", "/="):
             if listnames:
-                print filename
+                print(filename)
                 break
             if row != lastrow:
                 lastrow = row
-                print "%s:%d:%s" % (filename, row, line),
+                print("%s:%d:%s" % (filename, row, line), end=' ')
     fp.close()
 
 def processdir(dir, listnames):

Modified: python/branches/py3k-struni/Tools/scripts/findlinksto.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/findlinksto.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/findlinksto.py	Fri Aug  3 19:06:41 2007
@@ -16,8 +16,8 @@
             raise getopt.GetoptError('not enough arguments', None)
     except getopt.GetoptError as msg:
         sys.stdout = sys.stderr
-        print msg
-        print 'usage: findlinksto pattern directory ...'
+        print(msg)
+        print('usage: findlinksto pattern directory ...')
         sys.exit(2)
     pat, dirs = args[0], args[1:]
     prog = re.compile(pat)
@@ -29,13 +29,13 @@
         names[:] = []
         return
     if os.path.ismount(dirname):
-        print 'descend into', dirname
+        print('descend into', dirname)
     for name in names:
         name = os.path.join(dirname, name)
         try:
             linkto = os.readlink(name)
             if prog.search(linkto) is not None:
-                print name, '->', linkto
+                print(name, '->', linkto)
         except os.error:
             pass
 

Modified: python/branches/py3k-struni/Tools/scripts/findnocoding.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/findnocoding.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/findnocoding.py	Fri Aug  3 19:06:41 2007
@@ -28,8 +28,8 @@
     pysource = pysource()
 
 
-    print >>sys.stderr, ("The pysource module is not available; "
-                         "no sophisticated Python source file search will be done.")
+    print("The pysource module is not available; "
+                         "no sophisticated Python source file search will be done.", file=sys.stderr)
 
 
 decl_re = re.compile(r"coding[=:]\s*([-\w.]+)")
@@ -79,8 +79,8 @@
 try:
     opts, args = getopt.getopt(sys.argv[1:], 'cd')
 except getopt.error as msg:
-    print >>sys.stderr, msg
-    print >>sys.stderr, usage
+    print(msg, file=sys.stderr)
+    print(usage, file=sys.stderr)
     sys.exit(1)
 
 is_python = pysource.looks_like_python
@@ -93,12 +93,12 @@
         debug = True
 
 if not args:
-    print >>sys.stderr, usage
+    print(usage, file=sys.stderr)
     sys.exit(1)
 
 for fullpath in pysource.walk_python_files(args, is_python):
     if debug:
-        print "Testing for coding: %s" % fullpath
+        print("Testing for coding: %s" % fullpath)
     result = needs_declaration(fullpath)
     if result:
-        print fullpath
+        print(fullpath)

Modified: python/branches/py3k-struni/Tools/scripts/fixcid.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/fixcid.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/fixcid.py	Fri Aug  3 19:06:41 2007
@@ -244,7 +244,7 @@
             subst = Dict[found]
             if Program is InsideCommentProgram:
                 if not Docomments:
-                    print 'Found in comment:', found
+                    print('Found in comment:', found)
                     i = i + n
                     continue
                 if NotInComment.has_key(found):

Modified: python/branches/py3k-struni/Tools/scripts/fixdiv.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/fixdiv.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/fixdiv.py	Fri Aug  3 19:06:41 2007
@@ -145,7 +145,7 @@
         return 2
     for o, a in opts:
         if o == "-h":
-            print __doc__
+            print(__doc__)
             return
         if o == "-m":
             global multi_ok
@@ -160,7 +160,7 @@
         return 1
     files = warnings.keys()
     if not files:
-        print "No classic division warnings read from", args[0]
+        print("No classic division warnings read from", args[0])
         return
     files.sort()
     exit = None
@@ -203,14 +203,14 @@
     return warnings
 
 def process(filename, list):
-    print "-"*70
+    print("-"*70)
     assert list # if this fails, readwarnings() is broken
     try:
         fp = open(filename)
     except IOError as msg:
         sys.stderr.write("can't open: %s\n" % msg)
         return 1
-    print "Index:", filename
+    print("Index:", filename)
     f = FileContext(fp)
     list.sort()
     index = 0 # list[:index] has been processed, list[index:] is still to do
@@ -248,10 +248,10 @@
                         lastrow = row
                     assert rows
                     if len(rows) == 1:
-                        print "*** More than one / operator in line", rows[0]
+                        print("*** More than one / operator in line", rows[0])
                     else:
-                        print "*** More than one / operator per statement",
-                        print "in lines %d-%d" % (rows[0], rows[-1])
+                        print("*** More than one / operator per statement", end=' ')
+                        print("in lines %d-%d" % (rows[0], rows[-1]))
             intlong = []
             floatcomplex = []
             bad = []
@@ -269,24 +269,24 @@
                 lastrow = row
                 line = chop(line)
                 if line[col:col+1] != "/":
-                    print "*** Can't find the / operator in line %d:" % row
-                    print "*", line
+                    print("*** Can't find the / operator in line %d:" % row)
+                    print("*", line)
                     continue
                 if bad:
-                    print "*** Bad warning for line %d:" % row, bad
-                    print "*", line
+                    print("*** Bad warning for line %d:" % row, bad)
+                    print("*", line)
                 elif intlong and not floatcomplex:
-                    print "%dc%d" % (row, row)
-                    print "<", line
-                    print "---"
-                    print ">", line[:col] + "/" + line[col:]
+                    print("%dc%d" % (row, row))
+                    print("<", line)
+                    print("---")
+                    print(">", line[:col] + "/" + line[col:])
                 elif floatcomplex and not intlong:
-                    print "True division / operator at line %d:" % row
-                    print "=", line
+                    print("True division / operator at line %d:" % row)
+                    print("=", line)
                 elif intlong and floatcomplex:
-                    print "*** Ambiguous / operator (%s, %s) at line %d:" % (
-                        "|".join(intlong), "|".join(floatcomplex), row)
-                    print "?", line
+                    print("*** Ambiguous / operator (%s, %s) at line %d:" % (
+                        "|".join(intlong), "|".join(floatcomplex), row))
+                    print("?", line)
     fp.close()
 
 def reportphantomwarnings(warnings, f):
@@ -301,15 +301,15 @@
     for block in blocks:
         row = block[0]
         whats = "/".join(block[1:])
-        print "*** Phantom %s warnings for line %d:" % (whats, row)
+        print("*** Phantom %s warnings for line %d:" % (whats, row))
         f.report(row, mark="*")
 
 def report(slashes, message):
     lastrow = None
     for (row, col), line in slashes:
         if row != lastrow:
-            print "*** %s on line %d:" % (message, row)
-            print "*", chop(line)
+            print("*** %s on line %d:" % (message, row))
+            print("*", chop(line))
             lastrow = row
 
 class FileContext:
@@ -354,7 +354,7 @@
                 line = self[first]
             except KeyError:
                 line = "<missing line>"
-            print mark, chop(line)
+            print(mark, chop(line))
 
 def scanline(g):
     slashes = []

Modified: python/branches/py3k-struni/Tools/scripts/fixheader.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/fixheader.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/fixheader.py	Fri Aug  3 19:06:41 2007
@@ -32,18 +32,18 @@
             magic = magic + c.upper()
         else: magic = magic + '_'
     sys.stdout = f
-    print '#ifndef', magic
-    print '#define', magic
-    print '#ifdef __cplusplus'
-    print 'extern "C" {'
-    print '#endif'
-    print
+    print('#ifndef', magic)
+    print('#define', magic)
+    print('#ifdef __cplusplus')
+    print('extern "C" {')
+    print('#endif')
+    print()
     f.write(data)
-    print
-    print '#ifdef __cplusplus'
-    print '}'
-    print '#endif'
-    print '#endif /*', '!'+magic, '*/'
+    print()
+    print('#ifdef __cplusplus')
+    print('}')
+    print('#endif')
+    print('#endif /*', '!'+magic, '*/')
 
 if __name__ == '__main__':
     main()

Modified: python/branches/py3k-struni/Tools/scripts/fixnotice.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/fixnotice.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/fixnotice.py	Fri Aug  3 19:06:41 2007
@@ -50,9 +50,9 @@
 
 
 def usage(code, msg=''):
-    print __doc__ % globals()
+    print(__doc__ % globals())
     if msg:
-        print msg
+        print(msg)
     sys.exit(code)
 
 
@@ -92,10 +92,10 @@
     i = data.find(OLD_NOTICE)
     if i < 0:
         if VERBOSE:
-            print 'no change:', file
+            print('no change:', file)
         return
     elif DRYRUN or VERBOSE:
-        print '   change:', file
+        print('   change:', file)
     if DRYRUN:
         # Don't actually change the file
         return

Modified: python/branches/py3k-struni/Tools/scripts/fixps.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/fixps.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/fixps.py	Fri Aug  3 19:06:41 2007
@@ -12,18 +12,18 @@
         try:
             f = open(filename, 'r')
         except IOError as msg:
-            print filename, ': can\'t open :', msg
+            print(filename, ': can\'t open :', msg)
             continue
         line = f.readline()
         if not re.match('^#! */usr/local/bin/python', line):
-            print filename, ': not a /usr/local/bin/python script'
+            print(filename, ': not a /usr/local/bin/python script')
             f.close()
             continue
         rest = f.read()
         f.close()
         line = re.sub('/usr/local/bin/python',
                       '/usr/bin/env python', line)
-        print filename, ':', repr(line)
+        print(filename, ':', repr(line))
         f = open(filename, "w")
         f.write(line)
         f.write(rest)

Modified: python/branches/py3k-struni/Tools/scripts/ftpmirror.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/ftpmirror.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/ftpmirror.py	Fri Aug  3 19:06:41 2007
@@ -29,8 +29,8 @@
 # Print usage message and exit
 def usage(*args):
     sys.stdout = sys.stderr
-    for msg in args: print msg
-    print __doc__
+    for msg in args: print(msg)
+    print(__doc__)
     sys.exit(2)
 
 verbose = 1 # 0 for -q, 2 for -v
@@ -82,22 +82,22 @@
             if args[3:]: usage('too many arguments')
     #
     f = ftplib.FTP()
-    if verbose: print "Connecting to '%s%s'..." % (host,
-                                                   (port and ":%d"%port or ""))
+    if verbose: print("Connecting to '%s%s'..." % (host,
+                                                   (port and ":%d"%port or "")))
     f.connect(host,port)
     if not nologin:
         if verbose:
-            print 'Logging in as %r...' % (login or 'anonymous')
+            print('Logging in as %r...' % (login or 'anonymous'))
         f.login(login, passwd, account)
-    if verbose: print 'OK.'
+    if verbose: print('OK.')
     pwd = f.pwd()
-    if verbose > 1: print 'PWD =', repr(pwd)
+    if verbose > 1: print('PWD =', repr(pwd))
     if remotedir:
-        if verbose > 1: print 'cwd(%s)' % repr(remotedir)
+        if verbose > 1: print('cwd(%s)' % repr(remotedir))
         f.cwd(remotedir)
-        if verbose > 1: print 'OK.'
+        if verbose > 1: print('OK.')
         pwd = f.pwd()
-        if verbose > 1: print 'PWD =', repr(pwd)
+        if verbose > 1: print('PWD =', repr(pwd))
     #
     mirrorsubdir(f, localdir)
 
@@ -105,11 +105,11 @@
 def mirrorsubdir(f, localdir):
     pwd = f.pwd()
     if localdir and not os.path.isdir(localdir):
-        if verbose: print 'Creating local directory', repr(localdir)
+        if verbose: print('Creating local directory', repr(localdir))
         try:
             makedir(localdir)
         except os.error as msg:
-            print "Failed to establish local directory", repr(localdir)
+            print("Failed to establish local directory", repr(localdir))
             return
     infofilename = os.path.join(localdir, '.mirrorinfo')
     try:
@@ -119,15 +119,15 @@
     try:
         info = eval(text)
     except (SyntaxError, NameError):
-        print 'Bad mirror info in', repr(infofilename)
+        print('Bad mirror info in', repr(infofilename))
         info = {}
     subdirs = []
     listing = []
-    if verbose: print 'Listing remote directory %r...' % (pwd,)
+    if verbose: print('Listing remote directory %r...' % (pwd,))
     f.retrlines('LIST', listing.append)
     filesfound = []
     for line in listing:
-        if verbose > 1: print '-->', repr(line)
+        if verbose > 1: print('-->', repr(line))
         if mac:
             # Mac listing has just filenames;
             # trailing / means subdirectory
@@ -141,14 +141,14 @@
             # Parse, assuming a UNIX listing
             words = line.split(None, 8)
             if len(words) < 6:
-                if verbose > 1: print 'Skipping short line'
+                if verbose > 1: print('Skipping short line')
                 continue
             filename = words[-1].lstrip()
             i = filename.find(" -> ")
             if i >= 0:
                 # words[0] had better start with 'l'...
                 if verbose > 1:
-                    print 'Found symbolic link %r' % (filename,)
+                    print('Found symbolic link %r' % (filename,))
                 linkto = filename[i+4:]
                 filename = filename[:i]
             infostuff = words[-5:-1]
@@ -157,21 +157,21 @@
         for pat in skippats:
             if fnmatch(filename, pat):
                 if verbose > 1:
-                    print 'Skip pattern', repr(pat),
-                    print 'matches', repr(filename)
+                    print('Skip pattern', repr(pat), end=' ')
+                    print('matches', repr(filename))
                 skip = 1
                 break
         if skip:
             continue
         if mode[0] == 'd':
             if verbose > 1:
-                print 'Remembering subdirectory', repr(filename)
+                print('Remembering subdirectory', repr(filename))
             subdirs.append(filename)
             continue
         filesfound.append(filename)
         if info.has_key(filename) and info[filename] == infostuff:
             if verbose > 1:
-                print 'Already have this version of',repr(filename)
+                print('Already have this version of',repr(filename))
             continue
         fullname = os.path.join(localdir, filename)
         tempname = os.path.join(localdir, '@'+filename)
@@ -187,20 +187,20 @@
             pass
         if mode[0] == 'l':
             if verbose:
-                print "Creating symlink %r -> %r" % (filename, linkto)
+                print("Creating symlink %r -> %r" % (filename, linkto))
             try:
                 os.symlink(linkto, tempname)
             except IOError as msg:
-                print "Can't create %r: %s" % (tempname, msg)
+                print("Can't create %r: %s" % (tempname, msg))
                 continue
         else:
             try:
                 fp = open(tempname, 'wb')
             except IOError as msg:
-                print "Can't create %r: %s" % (tempname, msg)
+                print("Can't create %r: %s" % (tempname, msg))
                 continue
             if verbose:
-                print 'Retrieving %r from %r as %r...' % (filename, pwd, fullname)
+                print('Retrieving %r from %r as %r...' % (filename, pwd, fullname))
             if verbose:
                 fp1 = LoggingFile(fp, 1024, sys.stdout)
             else:
@@ -210,7 +210,7 @@
                 f.retrbinary('RETR ' + filename,
                              fp1.write, 8*1024)
             except ftplib.error_perm as msg:
-                print msg
+                print(msg)
             t1 = time.time()
             bytes = fp.tell()
             fp.close()
@@ -223,29 +223,29 @@
         try:
             os.rename(tempname, fullname)
         except os.error as msg:
-            print "Can't rename %r to %r: %s" % (tempname, fullname, msg)
+            print("Can't rename %r to %r: %s" % (tempname, fullname, msg))
             continue
         info[filename] = infostuff
         writedict(info, infofilename)
         if verbose and mode[0] != 'l':
             dt = t1 - t0
             kbytes = bytes / 1024.0
-            print int(round(kbytes)),
-            print 'Kbytes in',
-            print int(round(dt)),
-            print 'seconds',
+            print(int(round(kbytes)), end=' ')
+            print('Kbytes in', end=' ')
+            print(int(round(dt)), end=' ')
+            print('seconds', end=' ')
             if t1 > t0:
-                print '(~%d Kbytes/sec)' % \
-                          int(round(kbytes/dt),)
-            print
+                print('(~%d Kbytes/sec)' % \
+                          int(round(kbytes/dt),))
+            print()
     #
     # Remove files from info that are no longer remote
     deletions = 0
     for filename in info.keys():
         if filename not in filesfound:
             if verbose:
-                print "Removing obsolete info entry for",
-                print repr(filename), "in", repr(localdir or ".")
+                print("Removing obsolete info entry for", end=' ')
+                print(repr(filename), "in", repr(localdir or "."))
             del info[filename]
             deletions = deletions + 1
     if deletions:
@@ -264,8 +264,8 @@
         for pat in skippats:
             if fnmatch(name, pat):
                 if verbose > 1:
-                    print 'Skip pattern', repr(pat),
-                    print 'matches', repr(name)
+                    print('Skip pattern', repr(pat), end=' ')
+                    print('matches', repr(name))
                 skip = 1
                 break
         if skip:
@@ -273,10 +273,10 @@
         fullname = os.path.join(localdir, name)
         if not rmok:
             if verbose:
-                print 'Local file', repr(fullname),
-                print 'is no longer pertinent'
+                print('Local file', repr(fullname), end=' ')
+                print('is no longer pertinent')
             continue
-        if verbose: print 'Removing local file/dir', repr(fullname)
+        if verbose: print('Removing local file/dir', repr(fullname))
         remove(fullname)
     #
     # Recursively mirror subdirectories
@@ -284,28 +284,28 @@
         if interactive:
             doit = askabout('subdirectory', subdir, pwd)
             if not doit: continue
-        if verbose: print 'Processing subdirectory', repr(subdir)
+        if verbose: print('Processing subdirectory', repr(subdir))
         localsubdir = os.path.join(localdir, subdir)
         pwd = f.pwd()
         if verbose > 1:
-            print 'Remote directory now:', repr(pwd)
-            print 'Remote cwd', repr(subdir)
+            print('Remote directory now:', repr(pwd))
+            print('Remote cwd', repr(subdir))
         try:
             f.cwd(subdir)
         except ftplib.error_perm as msg:
-            print "Can't chdir to", repr(subdir), ":", repr(msg)
+            print("Can't chdir to", repr(subdir), ":", repr(msg))
         else:
-            if verbose: print 'Mirroring as', repr(localsubdir)
+            if verbose: print('Mirroring as', repr(localsubdir))
             mirrorsubdir(f, localsubdir)
-            if verbose > 1: print 'Remote cwd ..'
+            if verbose > 1: print('Remote cwd ..')
             f.cwd('..')
         newpwd = f.pwd()
         if newpwd != pwd:
-            print 'Ended up in wrong directory after cd + cd ..'
-            print 'Giving up now.'
+            print('Ended up in wrong directory after cd + cd ..')
+            print('Giving up now.')
             break
         else:
-            if verbose > 1: print 'OK.'
+            if verbose > 1: print('OK.')
 
 # Helper to remove a file or directory tree
 def remove(fullname):
@@ -323,13 +323,13 @@
         try:
             os.rmdir(fullname)
         except os.error as msg:
-            print "Can't remove local directory %r: %s" % (fullname, msg)
+            print("Can't remove local directory %r: %s" % (fullname, msg))
             return 0
     else:
         try:
             os.unlink(fullname)
         except os.error as msg:
-            print "Can't remove local file %r: %s" % (fullname, msg)
+            print("Can't remove local file %r: %s" % (fullname, msg))
             return 0
     return 1
 
@@ -366,7 +366,7 @@
             return 1
         if reply in ['', 'n', 'no', 'nop', 'nope']:
             return 0
-        print 'Please answer yes or no.'
+        print('Please answer yes or no.')
 
 # Create a directory if it doesn't exist.  Recursively create the
 # parent directory as well if needed.

Modified: python/branches/py3k-struni/Tools/scripts/google.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/google.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/google.py	Fri Aug  3 19:06:41 2007
@@ -5,7 +5,7 @@
 def main():
     args = sys.argv[1:]
     if not args:
-        print "Usage: %s querystring" % sys.argv[0]
+        print("Usage: %s querystring" % sys.argv[0])
         return
     list = []
     for arg in args:

Modified: python/branches/py3k-struni/Tools/scripts/lfcr.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/lfcr.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/lfcr.py	Fri Aug  3 19:06:41 2007
@@ -7,15 +7,15 @@
 def main():
     for filename in sys.argv[1:]:
         if os.path.isdir(filename):
-            print filename, "Directory!"
+            print(filename, "Directory!")
             continue
         data = open(filename, "rb").read()
         if '\0' in data:
-            print filename, "Binary!"
+            print(filename, "Binary!")
             continue
         newdata = re.sub("\r?\n", "\r\n", data)
         if newdata != data:
-            print filename
+            print(filename)
             f = open(filename, "wb")
             f.write(newdata)
             f.close()

Modified: python/branches/py3k-struni/Tools/scripts/linktree.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/linktree.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/linktree.py	Fri Aug  3 19:06:41 2007
@@ -18,7 +18,7 @@
 
 def main():
     if not 3 <= len(sys.argv) <= 4:
-        print 'usage:', sys.argv[0], 'oldtree newtree [linkto]'
+        print('usage:', sys.argv[0], 'oldtree newtree [linkto]')
         return 2
     oldtree, newtree = sys.argv[1], sys.argv[2]
     if len(sys.argv) > 3:
@@ -28,46 +28,46 @@
         link = LINK
         link_may_fail = 0
     if not os.path.isdir(oldtree):
-        print oldtree + ': not a directory'
+        print(oldtree + ': not a directory')
         return 1
     try:
         os.mkdir(newtree, 0o777)
     except os.error as msg:
-        print newtree + ': cannot mkdir:', msg
+        print(newtree + ': cannot mkdir:', msg)
         return 1
     linkname = os.path.join(newtree, link)
     try:
         os.symlink(os.path.join(os.pardir, oldtree), linkname)
     except os.error as msg:
         if not link_may_fail:
-            print linkname + ': cannot symlink:', msg
+            print(linkname + ': cannot symlink:', msg)
             return 1
         else:
-            print linkname + ': warning: cannot symlink:', msg
+            print(linkname + ': warning: cannot symlink:', msg)
     linknames(oldtree, newtree, link)
     return 0
 
 def linknames(old, new, link):
-    if debug: print 'linknames', (old, new, link)
+    if debug: print('linknames', (old, new, link))
     try:
         names = os.listdir(old)
     except os.error as msg:
-        print old + ': warning: cannot listdir:', msg
+        print(old + ': warning: cannot listdir:', msg)
         return
     for name in names:
         if name not in (os.curdir, os.pardir):
             oldname = os.path.join(old, name)
             linkname = os.path.join(link, name)
             newname = os.path.join(new, name)
-            if debug > 1: print oldname, newname, linkname
+            if debug > 1: print(oldname, newname, linkname)
             if os.path.isdir(oldname) and \
                not os.path.islink(oldname):
                 try:
                     os.mkdir(newname, 0o777)
                     ok = 1
                 except:
-                    print newname + \
-                          ': warning: cannot mkdir:', msg
+                    print(newname + \
+                          ': warning: cannot mkdir:', msg)
                     ok = 0
                 if ok:
                     linkname = os.path.join(os.pardir,

Modified: python/branches/py3k-struni/Tools/scripts/lll.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/lll.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/lll.py	Fri Aug  3 19:06:41 2007
@@ -12,16 +12,16 @@
         if name not in (os.curdir, os.pardir):
             full = os.path.join(dirname, name)
             if os.path.islink(full):
-                print name, '->', os.readlink(full)
+                print(name, '->', os.readlink(full))
 def main():
     args = sys.argv[1:]
     if not args: args = [os.curdir]
     first = 1
     for arg in args:
         if len(args) > 1:
-            if not first: print
+            if not first: print()
             first = 0
-            print arg + ':'
+            print(arg + ':')
     lll(arg)
 
 if __name__ == '__main__':

Modified: python/branches/py3k-struni/Tools/scripts/logmerge.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/logmerge.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/logmerge.py	Fri Aug  3 19:06:41 2007
@@ -53,7 +53,7 @@
         elif o == '-b':
             branch = a
         elif o == '-h':
-            print __doc__
+            print(__doc__)
             sys.exit(0)
     database = []
     while 1:
@@ -169,9 +169,9 @@
     for (date, working_file, rev, author, text) in database:
         if text != prevtext:
             if prev:
-                print sep2,
+                print(sep2, end=' ')
                 for (p_date, p_working_file, p_rev, p_author) in prev:
-                    print p_date, p_author, p_working_file, p_rev
+                    print(p_date, p_author, p_working_file, p_rev)
                 sys.stdout.writelines(prevtext)
             prev = []
         prev.append((date, working_file, rev, author))

Modified: python/branches/py3k-struni/Tools/scripts/mailerdaemon.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/mailerdaemon.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/mailerdaemon.py	Fri Aug  3 19:06:41 2007
@@ -171,11 +171,11 @@
         fp = open(fn)
         m = ErrorMessage(fp)
         sender = m.getaddr('From')
-        print '%s\t%-40s\t'%(fn, sender[1]),
+        print('%s\t%-40s\t'%(fn, sender[1]), end=' ')
 
         if m.is_warning():
             fp.close()
-            print 'warning only'
+            print('warning only')
             nwarn = nwarn + 1
             if modify:
                 os.rename(fn, ','+fn)
@@ -185,11 +185,11 @@
         try:
             errors = m.get_errors()
         except Unparseable:
-            print '** Not parseable'
+            print('** Not parseable')
             nbad = nbad + 1
             fp.close()
             continue
-        print len(errors), 'errors'
+        print(len(errors), 'errors')
 
         # Remember them
         for e in errors:
@@ -211,16 +211,16 @@
             os.rename(fn, ','+fn)
 ##          os.unlink(fn)
 
-    print '--------------'
-    print nok, 'files parsed,',nwarn,'files warning-only,',
-    print nbad,'files unparseable'
-    print '--------------'
+    print('--------------')
+    print(nok, 'files parsed,',nwarn,'files warning-only,', end=' ')
+    print(nbad,'files unparseable')
+    print('--------------')
     list = []
     for e in errordict.keys():
         list.append((errordict[e], errorfirst[e], errorlast[e], e))
     list.sort()
     for num, first, last, e in list:
-        print '%d %s - %s\t%s' % (num, first, last, e)
+        print('%d %s - %s\t%s' % (num, first, last, e))
 
 def main():
     modify = 0

Modified: python/branches/py3k-struni/Tools/scripts/mkreal.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/mkreal.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/mkreal.py	Fri Aug  3 19:06:41 2007
@@ -48,12 +48,12 @@
     if progname == '-c': progname = 'mkreal'
     args = sys.argv[1:]
     if not args:
-        print 'usage:', progname, 'path ...'
+        print('usage:', progname, 'path ...')
         sys.exit(2)
     status = 0
     for name in args:
         if not os.path.islink(name):
-            print progname+':', name+':', 'not a symlink'
+            print(progname+':', name+':', 'not a symlink')
             status = 1
         else:
             if os.path.isdir(name):

Modified: python/branches/py3k-struni/Tools/scripts/ndiff.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/ndiff.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/ndiff.py	Fri Aug  3 19:06:41 2007
@@ -74,7 +74,7 @@
     a = f1.readlines(); f1.close()
     b = f2.readlines(); f2.close()
     for line in difflib.ndiff(a, b):
-        print line,
+        print(line, end=' ')
 
     return 1
 
@@ -109,8 +109,8 @@
         return fail("need 2 filename args")
     f1name, f2name = args
     if noisy:
-        print '-:', f1name
-        print '+:', f2name
+        print('-:', f1name)
+        print('+:', f2name)
     return fcompare(f1name, f2name)
 
 # read ndiff output from stdin, and print file1 (which=='1') or

Modified: python/branches/py3k-struni/Tools/scripts/objgraph.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/objgraph.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/objgraph.py	Fri Aug  3 19:06:41 2007
@@ -80,7 +80,7 @@
             store(file2undef, fn, name)
             store(undef2file, name, fn)
         elif not type in ignore:
-            print fn + ':' + name + ': unknown type ' + type
+            print(fn + ':' + name + ': unknown type ' + type)
 
 # Print all names that were undefined in some module and where they are
 # defined.
@@ -89,7 +89,7 @@
     flist = file2undef.keys()
     flist.sort()
     for filename in flist:
-        print filename + ':'
+        print(filename + ':')
         elist = file2undef[filename]
         elist.sort()
         for ext in elist:
@@ -98,9 +98,9 @@
             else:
                 tabs = '\t\t'
             if not def2file.has_key(ext):
-                print '\t' + ext + tabs + ' *undefined'
+                print('\t' + ext + tabs + ' *undefined')
             else:
-                print '\t' + ext + tabs + flat(def2file[ext])
+                print('\t' + ext + tabs + flat(def2file[ext]))
 
 # Print for each module the names of the other modules that use it.
 #
@@ -114,14 +114,14 @@
                 callers = callers + undef2file[label]
         if callers:
             callers.sort()
-            print filename + ':'
+            print(filename + ':')
             lastfn = ''
             for fn in callers:
                 if fn <> lastfn:
-                    print '\t' + fn
+                    print('\t' + fn)
                 lastfn = fn
         else:
-            print filename + ': unused'
+            print(filename + ': unused')
 
 # Print undefined names and where they are used.
 #
@@ -134,11 +134,11 @@
     elist = undefs.keys()
     elist.sort()
     for ext in elist:
-        print ext + ':'
+        print(ext + ':')
         flist = undefs[ext]
         flist.sort()
         for filename in flist:
-            print '\t' + filename
+            print('\t' + filename)
 
 # Print warning messages about names defined in more than one file.
 #
@@ -149,8 +149,8 @@
     names.sort()
     for name in names:
         if len(def2file[name]) > 1:
-            print 'warning:', name, 'multiply defined:',
-            print flat(def2file[name])
+            print('warning:', name, 'multiply defined:', end=' ')
+            print(flat(def2file[name]))
     sys.stdout = savestdout
 
 # Main program
@@ -160,14 +160,14 @@
         optlist, args = getopt.getopt(sys.argv[1:], 'cdu')
     except getopt.error:
         sys.stdout = sys.stderr
-        print 'Usage:', os.path.basename(sys.argv[0]),
-        print           '[-cdu] [file] ...'
-        print '-c: print callers per objectfile'
-        print '-d: print callees per objectfile'
-        print '-u: print usage of undefined symbols'
-        print 'If none of -cdu is specified, all are assumed.'
-        print 'Use "nm -o" to generate the input (on IRIX: "nm -Bo"),'
-        print 'e.g.: nm -o /lib/libc.a | objgraph'
+        print('Usage:', os.path.basename(sys.argv[0]), end=' ')
+        print('[-cdu] [file] ...')
+        print('-c: print callers per objectfile')
+        print('-d: print callees per objectfile')
+        print('-u: print usage of undefined symbols')
+        print('If none of -cdu is specified, all are assumed.')
+        print('Use "nm -o" to generate the input (on IRIX: "nm -Bo"),')
+        print('e.g.: nm -o /lib/libc.a | objgraph')
         return 1
     optu = optc = optd = 0
     for opt, void in optlist:
@@ -192,15 +192,15 @@
     more = (optu + optc + optd > 1)
     if optd:
         if more:
-            print '---------------All callees------------------'
+            print('---------------All callees------------------')
         printcallee()
     if optu:
         if more:
-            print '---------------Undefined callees------------'
+            print('---------------Undefined callees------------')
         printundef()
     if optc:
         if more:
-            print '---------------All Callers------------------'
+            print('---------------All Callers------------------')
         printcaller()
     return 0
 

Modified: python/branches/py3k-struni/Tools/scripts/pdeps.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/pdeps.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/pdeps.py	Fri Aug  3 19:06:41 2007
@@ -30,25 +30,25 @@
 def main():
     args = sys.argv[1:]
     if not args:
-        print 'usage: pdeps file.py file.py ...'
+        print('usage: pdeps file.py file.py ...')
         return 2
     #
     table = {}
     for arg in args:
         process(arg, table)
     #
-    print '--- Uses ---'
+    print('--- Uses ---')
     printresults(table)
     #
-    print '--- Used By ---'
+    print('--- Used By ---')
     inv = inverse(table)
     printresults(inv)
     #
-    print '--- Closure of Uses ---'
+    print('--- Closure of Uses ---')
     reach = closure(table)
     printresults(reach)
     #
-    print '--- Closure of Used By ---'
+    print('--- Closure of Used By ---')
     invreach = inverse(reach)
     printresults(invreach)
     #
@@ -151,12 +151,12 @@
     for mod in modules:
         list = table[mod]
         list.sort()
-        print mod.ljust(maxlen), ':',
+        print(mod.ljust(maxlen), ':', end=' ')
         if mod in list:
-            print '(*)',
+            print('(*)', end=' ')
         for ref in list:
-            print ref,
-        print
+            print(ref, end=' ')
+        print()
 
 
 # Call main and honor exit status

Modified: python/branches/py3k-struni/Tools/scripts/pysource.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/pysource.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/pysource.py	Fri Aug  3 19:06:41 2007
@@ -27,7 +27,7 @@
 debug = False
 
 def print_debug(msg):
-    if debug: print msg
+    if debug: print(msg)
 
 
 def _open(fullpath):
@@ -124,7 +124,7 @@
 if __name__ == "__main__":
     # Two simple examples/tests
     for fullpath in walk_python_files(['.']):
-        print fullpath
-    print "----------"
+        print(fullpath)
+    print("----------")
     for fullpath in walk_python_files(['.'], is_python=can_be_compiled):
-        print fullpath
+        print(fullpath)

Modified: python/branches/py3k-struni/Tools/scripts/rgrep.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/rgrep.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/rgrep.py	Fri Aug  3 19:06:41 2007
@@ -52,12 +52,12 @@
         lines.reverse()
         for line in lines:
             if prog.search(line):
-                print line
+                print(line)
 
 def usage(msg, code=2):
     sys.stdout = sys.stderr
-    print msg
-    print __doc__
+    print(msg)
+    print(__doc__)
     sys.exit(code)
 
 if __name__ == '__main__':

Modified: python/branches/py3k-struni/Tools/scripts/suff.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/suff.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/suff.py	Fri Aug  3 19:06:41 2007
@@ -17,7 +17,7 @@
     keys = suffixes.keys()
     keys.sort()
     for suff in keys:
-        print repr(suff), len(suffixes[suff])
+        print(repr(suff), len(suffixes[suff]))
 
 def getsuffix(filename):
     suff = ''

Modified: python/branches/py3k-struni/Tools/scripts/texcheck.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/texcheck.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/texcheck.py	Fri Aug  3 19:06:41 2007
@@ -65,10 +65,10 @@
     try:
         o_lineno, o_symbol = openers.pop()
     except IndexError:
-        print "\nDelimiter mismatch.  On line %d, encountered closing '%s' without corresponding open" % (c_lineno, c_symbol)
+        print("\nDelimiter mismatch.  On line %d, encountered closing '%s' without corresponding open" % (c_lineno, c_symbol))
         return
     if o_symbol in pairmap.get(c_symbol, [c_symbol]): return
-    print "\nOpener '%s' on line %d was not closed before encountering '%s' on line %d" % (o_symbol, o_lineno, c_symbol, c_lineno)
+    print("\nOpener '%s' on line %d was not closed before encountering '%s' on line %d" % (o_symbol, o_lineno, c_symbol, c_lineno))
     return
 
 def checkit(source, opts, morecmds=[]):
@@ -120,7 +120,7 @@
         # Check balancing of open/close parenthesis, brackets, and begin/end blocks
         for begend, name, punct in delimiters.findall(line):
             if '-v' in opts:
-                print lineno, '|', begend, name, punct,
+                print(lineno, '|', begend, name, punct, end=' ')
             if begend == 'begin' and '-d' not in opts:
                 openers.append((lineno, name))
             elif punct in openpunct:
@@ -130,7 +130,7 @@
             elif punct in pairmap:
                 matchclose(lineno, punct, openers, pairmap)
             if '-v' in opts:
-                print '   --> ', openers
+                print('   --> ', openers)
 
         # Balance opening and closing braces
         for open, close in braces.findall(line):
@@ -140,7 +140,7 @@
                 try:
                     bracestack.pop()
                 except IndexError:
-                    print r'Warning, unmatched } on line %s.' % (lineno,)
+                    print(r'Warning, unmatched } on line %s.' % (lineno,))
 
         # Optionally, skip LaTeX specific checks
         if '-d' in opts:
@@ -151,11 +151,11 @@
             if '822' in line or '.html' in line:
                 continue    # Ignore false positives for urls and for /rfc822
             if '\\' + cmd in validcmds:
-                print 'Warning, forward slash used on line %d with cmd: /%s' % (lineno, cmd)
+                print('Warning, forward slash used on line %d with cmd: /%s' % (lineno, cmd))
 
         # Check for markup requiring {} for correct spacing
         for cmd in spacingmarkup.findall(line):
-            print r'Warning, \%s should be written as \%s{} on line %d' % (cmd, cmd, lineno)
+            print(r'Warning, \%s should be written as \%s{} on line %d' % (cmd, cmd, lineno))
 
         # Validate commands
         nc = line.find(r'\newcommand')
@@ -165,7 +165,7 @@
             validcmds.add(line[start+1:end])
         for cmd in texcmd.findall(line):
             if cmd not in validcmds:
-                print r'Warning, unknown tex cmd on line %d: \%s' % (lineno, cmd)
+                print(r'Warning, unknown tex cmd on line %d: \%s' % (lineno, cmd))
 
         # Check table levels (make sure lineii only inside tableii)
         m = tablestart.search(line)
@@ -174,23 +174,23 @@
             tablestartline = lineno
         m = tableline.search(line)
         if m and m.group(1) != tablelevel:
-            print r'Warning, \line%s on line %d does not match \table%s on line %d' % (m.group(1), lineno, tablelevel, tablestartline)
+            print(r'Warning, \line%s on line %d does not match \table%s on line %d' % (m.group(1), lineno, tablelevel, tablestartline))
         if tableend.search(line):
             tablelevel = ''
 
         # Style guide warnings
         if 'e.g.' in line or 'i.e.' in line:
-            print r'Style warning, avoid use of i.e or e.g. on line %d' % (lineno,)
+            print(r'Style warning, avoid use of i.e or e.g. on line %d' % (lineno,))
 
         for dw in doubledwords.findall(line):
-            print r'Doubled word warning.  "%s" on line %d' % (dw, lineno)
+            print(r'Doubled word warning.  "%s" on line %d' % (dw, lineno))
 
     lastline = lineno
     for lineno, symbol in openers:
-        print "Unmatched open delimiter '%s' on line %d" % (symbol, lineno)
+        print("Unmatched open delimiter '%s' on line %d" % (symbol, lineno))
     for lineno in bracestack:
-        print "Unmatched { on line %d" % (lineno,)
-    print 'Done checking %d lines.' % (lastline,)
+        print("Unmatched { on line %d" % (lineno,))
+    print('Done checking %d lines.' % (lastline,))
     return 0
 
 def main(args=None):
@@ -199,11 +199,11 @@
     optitems, arglist = getopt.getopt(args, "k:mdhs:v")
     opts = dict(optitems)
     if '-h' in opts or args==[]:
-        print __doc__
+        print(__doc__)
         return 0
 
     if len(arglist) < 1:
-        print 'Please specify a file to be checked'
+        print('Please specify a file to be checked')
         return 1
 
     for i, filespec in enumerate(arglist):
@@ -214,12 +214,12 @@
     err = []
 
     for filename in arglist:
-        print '=' * 30
-        print "Checking", filename
+        print('=' * 30)
+        print("Checking", filename)
         try:
             f = open(filename)
         except IOError:
-            print 'Cannot open file %s.' % arglist[0]
+            print('Cannot open file %s.' % arglist[0])
             return 2
 
         try:

Modified: python/branches/py3k-struni/Tools/scripts/texi2html.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/texi2html.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/texi2html.py	Fri Aug  3 19:06:41 2007
@@ -275,7 +275,7 @@
                     if not self.skip: self.process(accu)
                     accu = []
                 if initial_lineno > 0:
-                    print '*** EOF before @bye'
+                    print('*** EOF before @bye')
                 break
             lineno = lineno + 1
             mo = cmprog.match(line)
@@ -306,10 +306,10 @@
                 accu.append(line)
         #
         if self.skip:
-            print '*** Still skipping at the end'
+            print('*** Still skipping at the end')
         if self.stack:
-            print '*** Stack not empty at the end'
-            print '***', self.stack
+            print('*** Stack not empty at the end')
+            print('***', self.stack)
         if self.includedepth == 0:
             while self.nodestack:
                 self.nodestack[-1].finalize()
@@ -338,7 +338,7 @@
         try:
             text = ''.join(args)
         except:
-            print args
+            print(args)
             raise TypeError
         if self.savetext <> None:
             self.savetext = self.savetext + text
@@ -350,7 +350,7 @@
     # Complete the current node -- write footnotes and close file
     def endnode(self):
         if self.savetext <> None:
-            print '*** Still saving text at end of node'
+            print('*** Still saving text at end of node')
             dummy = self.collectsavings()
         if self.footnotes:
             self.writefootnotes()
@@ -382,10 +382,10 @@
     # This mostly distinguishes between menus and normal text
     def process(self, accu):
         if self.debugging > 1:
-            print '!'*self.debugging, 'process:', self.skip, self.stack,
-            if accu: print accu[0][:30],
-            if accu[0][30:] or accu[1:]: print '...',
-            print
+            print('!'*self.debugging, 'process:', self.skip, self.stack, end=' ')
+            if accu: print(accu[0][:30], end=' ')
+            if accu[0][30:] or accu[1:]: print('...', end=' ')
+            print()
         if self.inmenu():
             # XXX should be done differently
             for line in accu:
@@ -461,7 +461,7 @@
                 continue
             if c == '}':
                 if not stack:
-                    print '*** Unmatched }'
+                    print('*** Unmatched }')
                     self.write('}')
                     continue
                 cmd = stack[-1]
@@ -509,12 +509,12 @@
                 continue
             method()
         if stack:
-            print '*** Stack not empty at para:', stack
+            print('*** Stack not empty at para:', stack)
 
     # --- Handle unknown embedded @-commands ---
 
     def unknown_open(self, cmd):
-        print '*** No open func for @' + cmd + '{...}'
+        print('*** No open func for @' + cmd + '{...}')
         cmd = cmd + '{'
         self.write('@', cmd)
         if not self.unknown.has_key(cmd):
@@ -523,7 +523,7 @@
             self.unknown[cmd] = self.unknown[cmd] + 1
 
     def unknown_close(self, cmd):
-        print '*** No close func for @' + cmd + '{...}'
+        print('*** No close func for @' + cmd + '{...}')
         cmd = '}' + cmd
         self.write('}')
         if not self.unknown.has_key(cmd):
@@ -532,7 +532,7 @@
             self.unknown[cmd] = self.unknown[cmd] + 1
 
     def unknown_handle(self, cmd):
-        print '*** No handler for @' + cmd
+        print('*** No handler for @' + cmd)
         self.write('@', cmd)
         if not self.unknown.has_key(cmd):
             self.unknown[cmd] = 1
@@ -555,9 +555,9 @@
         try:
             fp = open(file, 'r')
         except IOError as msg:
-            print '*** Can\'t open include file', repr(file)
+            print('*** Can\'t open include file', repr(file))
             return
-        print '!'*self.debugging, '--> file', repr(file)
+        print('!'*self.debugging, '--> file', repr(file))
         save_done = self.done
         save_skip = self.skip
         save_stack = self.stack
@@ -568,7 +568,7 @@
         self.done = save_done
         self.skip = save_skip
         self.stack = save_stack
-        print '!'*self.debugging, '<-- file', repr(file)
+        print('!'*self.debugging, '<-- file', repr(file))
 
     # --- Special Insertions ---
 
@@ -764,7 +764,7 @@
         elif os.path.exists(imagelocation+'.gif'):   # MySQL uses GIF files
             filename += '.gif'
         else:
-            print "*** Cannot find image " + imagelocation
+            print("*** Cannot find image " + imagelocation)
         #TODO: what is 'ext'?
         self.write('<IMG SRC="', filename, '"',                     \
                     width  and (' WIDTH="'  + width  + '"') or "",  \
@@ -871,8 +871,8 @@
         cmd = line[a:b]
         args = line[b:].strip()
         if self.debugging > 1:
-            print '!'*self.debugging, 'command:', self.skip, self.stack, \
-                  '@' + cmd, args
+            print('!'*self.debugging, 'command:', self.skip, self.stack, \
+                  '@' + cmd, args)
         try:
             func = getattr(self, 'do_' + cmd)
         except AttributeError:
@@ -890,7 +890,7 @@
             func(args)
 
     def unknown_cmd(self, cmd, args):
-        print '*** unknown', '@' + cmd, args
+        print('*** unknown', '@' + cmd, args)
         if not self.unknown.has_key(cmd):
             self.unknown[cmd] = 1
         else:
@@ -899,11 +899,11 @@
     def do_end(self, args):
         words = args.split()
         if not words:
-            print '*** @end w/o args'
+            print('*** @end w/o args')
         else:
             cmd = words[0]
             if not self.stack or self.stack[-1] <> cmd:
-                print '*** @end', cmd, 'unexpected'
+                print('*** @end', cmd, 'unexpected')
             else:
                 del self.stack[-1]
             try:
@@ -915,7 +915,7 @@
 
     def unknown_end(self, cmd):
         cmd = 'end ' + cmd
-        print '*** unknown', '@' + cmd
+        print('*** unknown', '@' + cmd)
         if not self.unknown.has_key(cmd):
             self.unknown[cmd] = 1
         else:
@@ -965,7 +965,7 @@
                 self.skip = self.skip - 1
             del self.stackinfo[len(self.stack) + 1]
         except KeyError:
-            print '*** end_ifset: KeyError :', len(self.stack) + 1
+            print('*** end_ifset: KeyError :', len(self.stack) + 1)
 
     def bgn_ifclear(self, args):
         if args in self.values.keys() \
@@ -980,7 +980,7 @@
                 self.skip = self.skip - 1
             del self.stackinfo[len(self.stack) + 1]
         except KeyError:
-            print '*** end_ifclear: KeyError :', len(self.stack) + 1
+            print('*** end_ifclear: KeyError :', len(self.stack) + 1)
 
     def open_value(self):
         self.startsaving()
@@ -990,7 +990,7 @@
         if key in self.values.keys():
             self.write(self.values[key])
         else:
-            print '*** Undefined value: ', key
+            print('*** Undefined value: ', key)
 
     # --- Beginning a file ---
 
@@ -1052,9 +1052,9 @@
         [name, next, prev, up] = parts[:4]
         file = self.dirname + '/' + makefile(name)
         if self.filenames.has_key(file):
-            print '*** Filename already in use: ', file
+            print('*** Filename already in use: ', file)
         else:
-            if self.debugging: print '!'*self.debugging, '--- writing', file
+            if self.debugging: print('!'*self.debugging, '--- writing', file)
         self.filenames[file] = 1
         # self.nodefp = open(file, 'w')
         self.nodename = name
@@ -1169,7 +1169,7 @@
         self.expand(args)
         self.write('</', type, '>\n')
         if self.debugging or self.print_headers:
-            print '---', args
+            print('---', args)
 
     def do_contents(self, args):
         # pass
@@ -1549,7 +1549,7 @@
         if self.whichindex.has_key(name):
             self.index(name, args)
         else:
-            print '*** No index named', repr(name)
+            print('*** No index named', repr(name))
 
     def do_cindex(self, args): self.index('cp', args)
     def do_findex(self, args): self.index('fn', args)
@@ -1565,12 +1565,12 @@
     def do_synindex(self, args):
         words = args.split()
         if len(words) <> 2:
-            print '*** bad @synindex', args
+            print('*** bad @synindex', args)
             return
         [old, new] = words
         if not self.whichindex.has_key(old) or \
                   not self.whichindex.has_key(new):
-            print '*** bad key(s) in @synindex', args
+            print('*** bad key(s) in @synindex', args)
             return
         if old <> new and \
                   self.whichindex[old] is not self.whichindex[new]:
@@ -1585,15 +1585,15 @@
             if self.whichindex.has_key(name):
                 self.prindex(name)
             else:
-                print '*** No index named', repr(name)
+                print('*** No index named', repr(name))
 
     def prindex(self, name):
         iscodeindex = (name not in self.noncodeindices)
         index = self.whichindex[name]
         if not index: return
         if self.debugging:
-            print '!'*self.debugging, '--- Generating', \
-                  self.indextitle[name], 'index'
+            print('!'*self.debugging, '--- Generating', \
+                  self.indextitle[name], 'index')
         #  The node already provides a title
         index1 = []
         junkprog = re.compile('^(@[a-z]+)?{')
@@ -1616,7 +1616,7 @@
         for sortkey, key, node in index1:
             if (key, node) == (prevkey, prevnode):
                 continue
-            if self.debugging > 1: print '!'*self.debugging, key, ':', node
+            if self.debugging > 1: print('!'*self.debugging, key, ':', node)
             self.write('<DT>')
             if iscodeindex: key = '@code{' + key + '}'
             if key != prevkey:
@@ -1629,11 +1629,11 @@
 
     def report(self):
         if self.unknown:
-            print '--- Unrecognized commands ---'
+            print('--- Unrecognized commands ---')
             cmds = self.unknown.keys()
             cmds.sort()
             for cmd in cmds:
-                print cmd.ljust(20), self.unknown[cmd]
+                print(cmd.ljust(20), self.unknown[cmd])
 
 
 class TexinfoParserHTML3(TexinfoParser):
@@ -1773,86 +1773,86 @@
         # PROJECT FILE
         try:
             fp = open(projectfile,'w')
-            print>>fp, '[OPTIONS]'
-            print>>fp, 'Auto Index=Yes'
-            print>>fp, 'Binary TOC=No'
-            print>>fp, 'Binary Index=Yes'
-            print>>fp, 'Compatibility=1.1'
-            print>>fp, 'Compiled file=' + resultfile + ''
-            print>>fp, 'Contents file=' + contentfile + ''
-            print>>fp, 'Default topic=' + defaulttopic + ''
-            print>>fp, 'Error log file=ErrorLog.log'
-            print>>fp, 'Index file=' + indexfile + ''
-            print>>fp, 'Title=' + title + ''
-            print>>fp, 'Display compile progress=Yes'
-            print>>fp, 'Full-text search=Yes'
-            print>>fp, 'Default window=main'
-            print>>fp, ''
-            print>>fp, '[WINDOWS]'
-            print>>fp, ('main=,"' + contentfile + '","' + indexfile
+            print('[OPTIONS]', file=fp)
+            print('Auto Index=Yes', file=fp)
+            print('Binary TOC=No', file=fp)
+            print('Binary Index=Yes', file=fp)
+            print('Compatibility=1.1', file=fp)
+            print('Compiled file=' + resultfile + '', file=fp)
+            print('Contents file=' + contentfile + '', file=fp)
+            print('Default topic=' + defaulttopic + '', file=fp)
+            print('Error log file=ErrorLog.log', file=fp)
+            print('Index file=' + indexfile + '', file=fp)
+            print('Title=' + title + '', file=fp)
+            print('Display compile progress=Yes', file=fp)
+            print('Full-text search=Yes', file=fp)
+            print('Default window=main', file=fp)
+            print('', file=fp)
+            print('[WINDOWS]', file=fp)
+            print('main=,"' + contentfile + '","' + indexfile
                         + '","","",,,,,0x23520,222,0x1046,[10,10,780,560],'
-                        '0xB0000,,,,,,0')
-            print>>fp, ''
-            print>>fp, '[FILES]'
-            print>>fp, ''
+                        '0xB0000,,,,,,0', file=fp)
+            print('', file=fp)
+            print('[FILES]', file=fp)
+            print('', file=fp)
             self.dumpfiles(fp)
             fp.close()
         except IOError as msg:
-            print projectfile, ':', msg
+            print(projectfile, ':', msg)
             sys.exit(1)
 
         # CONTENT FILE
         try:
             fp = open(contentfile,'w')
-            print>>fp, '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">'
-            print>>fp, '<!-- This file defines the table of contents -->'
-            print>>fp, '<HTML>'
-            print>>fp, '<HEAD>'
-            print>>fp, ('<meta name="GENERATOR"'
-                        'content="Microsoft&reg; HTML Help Workshop 4.1">')
-            print>>fp, '<!-- Sitemap 1.0 -->'
-            print>>fp, '</HEAD>'
-            print>>fp, '<BODY>'
-            print>>fp, '   <OBJECT type="text/site properties">'
-            print>>fp, '     <param name="Window Styles" value="0x800025">'
-            print>>fp, '     <param name="comment" value="title:">'
-            print>>fp, '     <param name="comment" value="base:">'
-            print>>fp, '   </OBJECT>'
+            print('<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">', file=fp)
+            print('<!-- This file defines the table of contents -->', file=fp)
+            print('<HTML>', file=fp)
+            print('<HEAD>', file=fp)
+            print('<meta name="GENERATOR"'
+                        'content="Microsoft&reg; HTML Help Workshop 4.1">', file=fp)
+            print('<!-- Sitemap 1.0 -->', file=fp)
+            print('</HEAD>', file=fp)
+            print('<BODY>', file=fp)
+            print('   <OBJECT type="text/site properties">', file=fp)
+            print('     <param name="Window Styles" value="0x800025">', file=fp)
+            print('     <param name="comment" value="title:">', file=fp)
+            print('     <param name="comment" value="base:">', file=fp)
+            print('   </OBJECT>', file=fp)
             self.dumpnodes(fp)
-            print>>fp, '</BODY>'
-            print>>fp, '</HTML>'
+            print('</BODY>', file=fp)
+            print('</HTML>', file=fp)
             fp.close()
         except IOError as msg:
-            print contentfile, ':', msg
+            print(contentfile, ':', msg)
             sys.exit(1)
 
         # INDEX FILE
         try:
             fp = open(indexfile  ,'w')
-            print>>fp, '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">'
-            print>>fp, '<!-- This file defines the index -->'
-            print>>fp, '<HTML>'
-            print>>fp, '<HEAD>'
-            print>>fp, ('<meta name="GENERATOR"'
-                        'content="Microsoft&reg; HTML Help Workshop 4.1">')
-            print>>fp, '<!-- Sitemap 1.0 -->'
-            print>>fp, '</HEAD>'
-            print>>fp, '<BODY>'
-            print>>fp, '<OBJECT type="text/site properties">'
-            print>>fp, '</OBJECT>'
+            print('<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">', file=fp)
+            print('<!-- This file defines the index -->', file=fp)
+            print('<HTML>', file=fp)
+            print('<HEAD>', file=fp)
+            print('<meta name="GENERATOR"'
+                        'content="Microsoft&reg; HTML Help Workshop 4.1">', file=fp)
+            print('<!-- Sitemap 1.0 -->', file=fp)
+            print('</HEAD>', file=fp)
+            print('<BODY>', file=fp)
+            print('<OBJECT type="text/site properties">', file=fp)
+            print('</OBJECT>', file=fp)
             self.dumpindex(fp)
-            print>>fp, '</BODY>'
-            print>>fp, '</HTML>'
+            print('</BODY>', file=fp)
+            print('</HTML>', file=fp)
             fp.close()
         except IOError as msg:
-            print indexfile  , ':', msg
+            print(indexfile  , ':', msg)
             sys.exit(1)
 
     def dumpfiles(self, outfile=sys.stdout):
         filelist = self.filenames.values()
         filelist.sort()
         for filename in filelist:
-            print>>outfile, filename
+            print(filename, file=outfile)
 
     def dumpnodes(self, outfile=sys.stdout):
         self.dumped = {}
@@ -1860,10 +1860,10 @@
             nodename, dummy, dummy, dummy, dummy = self.nodelist[0]
             self.topnode = nodename
 
-        print>>outfile,  '<UL>'
+        print('<UL>', file=outfile)
         for node in self.nodelist:
             self.dumpnode(node,0,outfile)
-        print>>outfile,  '</UL>'
+        print('</UL>', file=outfile)
 
     def dumpnode(self, node, indent=0, outfile=sys.stdout):
         if node:
@@ -1877,11 +1877,11 @@
             self.dumped[nodename] = 1
 
             # Print info for this node
-            print>>outfile, ' '*indent,
-            print>>outfile, '<LI><OBJECT type="text/sitemap">',
-            print>>outfile, '<param name="Name" value="' + nodename +'">',
-            print>>outfile, '<param name="Local" value="'+ filename +'">',
-            print>>outfile, '</OBJECT>'
+            print(' '*indent, end=' ', file=outfile)
+            print('<LI><OBJECT type="text/sitemap">', end=' ', file=outfile)
+            print('<param name="Name" value="' + nodename +'">', end=' ', file=outfile)
+            print('<param name="Local" value="'+ filename +'">', end=' ', file=outfile)
+            print('</OBJECT>', file=outfile)
 
             # Does this node have menu items?
             try:
@@ -1894,13 +1894,13 @@
         if menu:
             currentnode = self.current
             if currentnode != self.topnode:    # XXX this is a hack
-                print>>outfile, ' '*indent + '<UL>'
+                print(' '*indent + '<UL>', file=outfile)
                 indent += 2
             for item in menu:
                 menunode = self.getnode(item)
                 self.dumpnode(menunode,indent,outfile)
             if currentnode != self.topnode:    # XXX this is a hack
-                print>>outfile, ' '*indent + '</UL>'
+                print(' '*indent + '</UL>', file=outfile)
                 indent -= 2
 
     def getnode(self, nodename):
@@ -1914,16 +1914,16 @@
 
     # (args,nodename) == (key,location)
     def dumpindex(self, outfile=sys.stdout):
-        print>>outfile,  '<UL>'
+        print('<UL>', file=outfile)
         for (key,location) in self.indexlist:
             key = self.codeexpand(key)
             location = makefile(location)
             location = self.dirname + '/' + location
-            print>>outfile, '<LI><OBJECT type="text/sitemap">',
-            print>>outfile, '<param name="Name" value="' + key + '">',
-            print>>outfile, '<param name="Local" value="' + location + '">',
-            print>>outfile, '</OBJECT>'
-        print>>outfile,  '</UL>'
+            print('<LI><OBJECT type="text/sitemap">', end=' ', file=outfile)
+            print('<param name="Name" value="' + key + '">', end=' ', file=outfile)
+            print('<param name="Local" value="' + location + '">', end=' ', file=outfile)
+            print('</OBJECT>', file=outfile)
+        print('</UL>', file=outfile)
 
     def codeexpand(self, line):
         co = self.codeprog.match(line)
@@ -2041,8 +2041,8 @@
         helpbase = sys.argv[2]
         del sys.argv[1:3]
     if len(sys.argv) <> 3:
-        print 'usage: texi2hh [-d [-d]] [-p] [-c] [-3] [-H htmlhelp]', \
-              'inputfile outputdirectory'
+        print('usage: texi2hh [-d [-d]] [-p] [-c] [-3] [-H htmlhelp]', \
+              'inputfile outputdirectory')
         sys.exit(2)
 
     if html3:
@@ -2064,7 +2064,7 @@
     try:
         fp = open(file, 'r')
     except IOError as msg:
-        print file, ':', msg
+        print(file, ':', msg)
         sys.exit(1)
 
     parser.parse(fp)

Modified: python/branches/py3k-struni/Tools/scripts/treesync.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/treesync.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/treesync.py	Fri Aug  3 19:06:41 2007
@@ -54,35 +54,35 @@
     try:
         [slave, master] = args
     except ValueError:
-        print "usage: python", sys.argv[0] or "treesync.py",
-        print "[-n] [-y] [-m y|n|a] [-s y|n|a] [-d y|n|a] [-f n|y|a]",
-        print "slavedir masterdir"
+        print("usage: python", sys.argv[0] or "treesync.py", end=' ')
+        print("[-n] [-y] [-m y|n|a] [-s y|n|a] [-d y|n|a] [-f n|y|a]", end=' ')
+        print("slavedir masterdir")
         return
     process(slave, master)
 
 def process(slave, master):
     cvsdir = os.path.join(master, "CVS")
     if not os.path.isdir(cvsdir):
-        print "skipping master subdirectory", master
-        print "-- not under CVS"
+        print("skipping master subdirectory", master)
+        print("-- not under CVS")
         return
-    print "-"*40
-    print "slave ", slave
-    print "master", master
+    print("-"*40)
+    print("slave ", slave)
+    print("master", master)
     if not os.path.isdir(slave):
         if not okay("create slave directory %s?" % slave,
                     answer=create_directories):
-            print "skipping master subdirectory", master
-            print "-- no corresponding slave", slave
+            print("skipping master subdirectory", master)
+            print("-- no corresponding slave", slave)
             return
-        print "creating slave directory", slave
+        print("creating slave directory", slave)
         try:
             os.mkdir(slave)
         except os.error as msg:
-            print "can't make slave directory", slave, ":", msg
+            print("can't make slave directory", slave, ":", msg)
             return
         else:
-            print "made slave directory", slave
+            print("made slave directory", slave)
     cvsdir = None
     subdirs = []
     names = os.listdir(master)
@@ -117,13 +117,13 @@
         mf = None
     if not sf:
         if not mf:
-            print "Neither master nor slave exists", master
+            print("Neither master nor slave exists", master)
             return
-        print "Creating missing slave", slave
+        print("Creating missing slave", slave)
         copy(master, slave, answer=create_files)
         return
     if not mf:
-        print "Not updating missing master", master
+        print("Not updating missing master", master)
         return
     if sf and mf:
         if identical(sf, mf):
@@ -134,22 +134,22 @@
         # Master is newer -- copy master to slave
         sf.close()
         mf.close()
-        print "Master             ", master
-        print "is newer than slave", slave
+        print("Master             ", master)
+        print("is newer than slave", slave)
         copy(master, slave, answer=write_slave)
         return
     # Slave is newer -- copy slave to master
-    print "Slave is", sft-mft, "seconds newer than master"
+    print("Slave is", sft-mft, "seconds newer than master")
     # But first check what to do about CRLF
     mf.seek(0)
     fun = funnychars(mf)
     mf.close()
     sf.close()
     if fun:
-        print "***UPDATING MASTER (BINARY COPY)***"
+        print("***UPDATING MASTER (BINARY COPY)***")
         copy(slave, master, "rb", answer=write_master)
     else:
-        print "***UPDATING MASTER***"
+        print("***UPDATING MASTER***")
         copy(slave, master, "r", answer=write_master)
 
 BUFSIZE = 16*1024
@@ -174,8 +174,8 @@
     return 0
 
 def copy(src, dst, rmode="rb", wmode="wb", answer='ask'):
-    print "copying", src
-    print "     to", dst
+    print("copying", src)
+    print("     to", dst)
     if not okay("okay to copy? ", answer):
         return
     f = open(src, rmode)
@@ -203,7 +203,7 @@
         return 1
     if answer[:1] == 'n':
         return 0
-    print "Yes or No please -- try again:"
+    print("Yes or No please -- try again:")
     return okay(prompt)
 
 if __name__ == '__main__':

Modified: python/branches/py3k-struni/Tools/scripts/untabify.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/untabify.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/untabify.py	Fri Aug  3 19:06:41 2007
@@ -13,8 +13,8 @@
         if not args:
             raise getopt.error, "At least one file argument required"
     except getopt.error as msg:
-        print msg
-        print "usage:", sys.argv[0], "[-t tabwidth] file ..."
+        print(msg)
+        print("usage:", sys.argv[0], "[-t tabwidth] file ...")
         return
     for optname, optvalue in opts:
         if optname == '-t':
@@ -29,7 +29,7 @@
         text = f.read()
         f.close()
     except IOError as msg:
-        print "%r: I/O error: %s" % (filename, msg)
+        print("%r: I/O error: %s" % (filename, msg))
         return
     newtext = text.expandtabs(tabsize)
     if newtext == text:
@@ -46,7 +46,7 @@
     f = open(filename, "w")
     f.write(newtext)
     f.close()
-    print filename
+    print(filename)
 
 if __name__ == '__main__':
     main()

Modified: python/branches/py3k-struni/Tools/scripts/which.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/which.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/which.py	Fri Aug  3 19:06:41 2007
@@ -37,7 +37,7 @@
                 mode = S_IMODE(st[ST_MODE])
                 if mode & 0o111:
                     if not ident:
-                        print filename
+                        print(filename)
                         ident = st[:3]
                     else:
                         if st[:3] == ident:

Modified: python/branches/py3k-struni/Tools/scripts/xxci.py
==============================================================================
--- python/branches/py3k-struni/Tools/scripts/xxci.py	(original)
+++ python/branches/py3k-struni/Tools/scripts/xxci.py	Fri Aug  3 19:06:41 2007
@@ -18,14 +18,14 @@
     args = sys.argv[1:]
     if args:
         return args
-    print 'No arguments, checking almost *, in "ls -t" order'
+    print('No arguments, checking almost *, in "ls -t" order')
     list = []
     for file in os.listdir(os.curdir):
         if not skipfile(file):
             list.append((getmtime(file), file))
     list.sort()
     if not list:
-        print 'Nothing to do -- exit 1'
+        print('Nothing to do -- exit 1')
         sys.exit(1)
     list.sort()
     list.reverse()
@@ -89,7 +89,7 @@
 
 def go(args):
     for file in args:
-        print file + ':'
+        print(file + ':')
         if differing(file):
             showdiffs(file)
             if askyesno('Check in ' + file + ' ? '):
@@ -119,4 +119,4 @@
         setup()
         go(getargs())
     except KeyboardInterrupt:
-        print '[Intr]'
+        print('[Intr]')

Modified: python/branches/py3k-struni/Tools/unicode/comparecodecs.py
==============================================================================
--- python/branches/py3k-struni/Tools/unicode/comparecodecs.py	(original)
+++ python/branches/py3k-struni/Tools/unicode/comparecodecs.py	Fri Aug  3 19:06:41 2007
@@ -11,7 +11,7 @@
 
 def compare_codecs(encoding1, encoding2):
 
-    print 'Comparing encoding/decoding of   %r and   %r' % (encoding1, encoding2)
+    print('Comparing encoding/decoding of   %r and   %r' % (encoding1, encoding2))
     mismatch = 0
     # Check encoding
     for i in range(sys.maxunicode):
@@ -25,8 +25,8 @@
         except UnicodeError as reason:
             c2 = '<undefined>'
         if c1 != c2:
-            print ' * encoding mismatch for 0x%04X: %-14r != %r' % \
-                  (i, c1, c2)
+            print(' * encoding mismatch for 0x%04X: %-14r != %r' % \
+                  (i, c1, c2))
             mismatch += 1
     # Check decoding
     for i in range(256):
@@ -40,14 +40,14 @@
         except UnicodeError:
             u2 = u'<undefined>'
         if u1 != u2:
-            print ' * decoding mismatch for 0x%04X: %-14r != %r' % \
-                  (i, u1, u2)
+            print(' * decoding mismatch for 0x%04X: %-14r != %r' % \
+                  (i, u1, u2))
             mismatch += 1
     if mismatch:
-        print
-        print 'Found %i mismatches' % mismatch
+        print()
+        print('Found %i mismatches' % mismatch)
     else:
-        print '-> Codecs are identical.'
+        print('-> Codecs are identical.')
 
 if __name__ == '__main__':
     compare_codecs(sys.argv[1], sys.argv[2])

Modified: python/branches/py3k-struni/Tools/unicode/gencodec.py
==============================================================================
--- python/branches/py3k-struni/Tools/unicode/gencodec.py	(original)
+++ python/branches/py3k-struni/Tools/unicode/gencodec.py	Fri Aug  3 19:06:41 2007
@@ -131,7 +131,7 @@
         return '(' + ', '.join(['0x%0*X' % (precision, item)
                                 for item in t]) + ')'
     except TypeError as why:
-        print '* failed to convert %r: %s' % (t, why)
+        print('* failed to convert %r: %s' % (t, why))
         raise
 
 def python_mapdef_code(varname, map, comments=1, precisions=(2, 4)):
@@ -383,18 +383,18 @@
         name = nameprefix + name
         codefile = name + '.py'
         marshalfile = name + '.mapping'
-        print 'converting %s to %s and %s' % (mapname,
+        print('converting %s to %s and %s' % (mapname,
                                               dirprefix + codefile,
-                                              dirprefix + marshalfile)
+                                              dirprefix + marshalfile))
         try:
             map = readmap(os.path.join(dir,mapname))
             if not map:
-                print '* map is empty; skipping'
+                print('* map is empty; skipping')
             else:
                 pymap(mappathname, map, dirprefix + codefile,name,comments)
                 marshalmap(mappathname, map, dirprefix + marshalfile)
         except ValueError as why:
-            print '* conversion failed: %s' % why
+            print('* conversion failed: %s' % why)
             raise
 
 def rewritepythondir(dir, dirprefix='', comments=1):
@@ -405,17 +405,17 @@
             continue
         name = mapname[:-len('.mapping')]
         codefile = name + '.py'
-        print 'converting %s to %s' % (mapname,
-                                       dirprefix + codefile)
+        print('converting %s to %s' % (mapname,
+                                       dirprefix + codefile))
         try:
             map = marshal.load(open(os.path.join(dir,mapname),
                                'rb'))
             if not map:
-                print '* map is empty; skipping'
+                print('* map is empty; skipping')
             else:
                 pymap(mapname, map, dirprefix + codefile,name,comments)
         except ValueError as why:
-            print '* conversion failed: %s' % why
+            print('* conversion failed: %s' % why)
 
 if __name__ == '__main__':
 

Modified: python/branches/py3k-struni/Tools/unicode/listcodecs.py
==============================================================================
--- python/branches/py3k-struni/Tools/unicode/listcodecs.py	(original)
+++ python/branches/py3k-struni/Tools/unicode/listcodecs.py	Fri Aug  3 19:06:41 2007
@@ -26,8 +26,8 @@
             # Probably an error from importing the codec; still it's
             # a valid code name
             if _debug:
-                print '* problem importing codec %r: %s' % \
-                      (name, reason)
+                print('* problem importing codec %r: %s' % \
+                      (name, reason))
         names.append(name)
     return names
 
@@ -35,7 +35,7 @@
 if __name__ == '__main__':
     names = listcodecs(encodings.__path__[0])
     names.sort()
-    print 'all_codecs = ['
+    print('all_codecs = [')
     for name in names:
-        print '    %r,' % name
-    print ']'
+        print('    %r,' % name)
+    print(']')

Modified: python/branches/py3k-struni/Tools/unicode/makeunicodedata.py
==============================================================================
--- python/branches/py3k-struni/Tools/unicode/makeunicodedata.py	(original)
+++ python/branches/py3k-struni/Tools/unicode/makeunicodedata.py	Fri Aug  3 19:06:41 2007
@@ -60,21 +60,21 @@
 
 def maketables(trace=0):
 
-    print "--- Reading", UNICODE_DATA % "", "..."
+    print("--- Reading", UNICODE_DATA % "", "...")
 
     version = ""
     unicode = UnicodeData(UNICODE_DATA % version,
                           COMPOSITION_EXCLUSIONS % version,
                           EASTASIAN_WIDTH % version)
 
-    print len(filter(None, unicode.table)), "characters"
+    print(len(filter(None, unicode.table)), "characters")
 
     for version in old_versions:
-        print "--- Reading", UNICODE_DATA % ("-"+version), "..."
+        print("--- Reading", UNICODE_DATA % ("-"+version), "...")
         old_unicode = UnicodeData(UNICODE_DATA % ("-"+version),
                                   COMPOSITION_EXCLUSIONS % ("-"+version),
                                   EASTASIAN_WIDTH % ("-"+version))
-        print len(filter(None, old_unicode.table)), "characters"
+        print(len(filter(None, old_unicode.table)), "characters")
         merge_old_version(version, unicode, old_unicode)
 
     makeunicodename(unicode, trace)
@@ -93,7 +93,7 @@
 
     FILE = "Modules/unicodedata_db.h"
 
-    print "--- Preparing", FILE, "..."
+    print("--- Preparing", FILE, "...")
 
     # 1) database properties
 
@@ -203,93 +203,92 @@
         l = comp_last[l]
         comp_data[f*total_last+l] = char
 
-    print len(table), "unique properties"
-    print len(decomp_prefix), "unique decomposition prefixes"
-    print len(decomp_data), "unique decomposition entries:",
-    print decomp_size, "bytes"
-    print total_first, "first characters in NFC"
-    print total_last, "last characters in NFC"
-    print len(comp_pairs), "NFC pairs"
+    print(len(table), "unique properties")
+    print(len(decomp_prefix), "unique decomposition prefixes")
+    print(len(decomp_data), "unique decomposition entries:", end=' ')
+    print(decomp_size, "bytes")
+    print(total_first, "first characters in NFC")
+    print(total_last, "last characters in NFC")
+    print(len(comp_pairs), "NFC pairs")
 
-    print "--- Writing", FILE, "..."
+    print("--- Writing", FILE, "...")
 
     fp = open(FILE, "w")
-    print >>fp, "/* this file was generated by %s %s */" % (SCRIPT, VERSION)
-    print >>fp
-    print >>fp, '#define UNIDATA_VERSION "%s"' % UNIDATA_VERSION
-    print >>fp, "/* a list of unique database records */"
-    print >>fp, \
-          "const _PyUnicode_DatabaseRecord _PyUnicode_Database_Records[] = {"
+    print("/* this file was generated by %s %s */" % (SCRIPT, VERSION), file=fp)
+    print(file=fp)
+    print('#define UNIDATA_VERSION "%s"' % UNIDATA_VERSION, file=fp)
+    print("/* a list of unique database records */", file=fp)
+    print("const _PyUnicode_DatabaseRecord _PyUnicode_Database_Records[] = {", file=fp)
     for item in table:
-        print >>fp, "    {%d, %d, %d, %d, %d}," % item
-    print >>fp, "};"
-    print >>fp
-
-    print >>fp, "/* Reindexing of NFC first characters. */"
-    print >>fp, "#define TOTAL_FIRST",total_first
-    print >>fp, "#define TOTAL_LAST",total_last
-    print >>fp, "struct reindex{int start;short count,index;};"
-    print >>fp, "struct reindex nfc_first[] = {"
+        print("    {%d, %d, %d, %d, %d}," % item, file=fp)
+    print("};", file=fp)
+    print(file=fp)
+
+    print("/* Reindexing of NFC first characters. */", file=fp)
+    print("#define TOTAL_FIRST",total_first, file=fp)
+    print("#define TOTAL_LAST",total_last, file=fp)
+    print("struct reindex{int start;short count,index;};", file=fp)
+    print("struct reindex nfc_first[] = {", file=fp)
     for start,end in comp_first_ranges:
-        print >>fp,"  { %d, %d, %d}," % (start,end-start,comp_first[start])
-    print >>fp,"  {0,0,0}"
-    print >>fp,"};\n"
-    print >>fp, "struct reindex nfc_last[] = {"
+        print("  { %d, %d, %d}," % (start,end-start,comp_first[start]), file=fp)
+    print("  {0,0,0}", file=fp)
+    print("};\n", file=fp)
+    print("struct reindex nfc_last[] = {", file=fp)
     for start,end in comp_last_ranges:
-        print >>fp,"  { %d, %d, %d}," % (start,end-start,comp_last[start])
-    print >>fp,"  {0,0,0}"
-    print >>fp,"};\n"
+        print("  { %d, %d, %d}," % (start,end-start,comp_last[start]), file=fp)
+    print("  {0,0,0}", file=fp)
+    print("};\n", file=fp)
 
     # FIXME: <fl> the following tables could be made static, and
     # the support code moved into unicodedatabase.c
 
-    print >>fp, "/* string literals */"
-    print >>fp, "const char *_PyUnicode_CategoryNames[] = {"
+    print("/* string literals */", file=fp)
+    print("const char *_PyUnicode_CategoryNames[] = {", file=fp)
     for name in CATEGORY_NAMES:
-        print >>fp, "    \"%s\"," % name
-    print >>fp, "    NULL"
-    print >>fp, "};"
+        print("    \"%s\"," % name, file=fp)
+    print("    NULL", file=fp)
+    print("};", file=fp)
 
-    print >>fp, "const char *_PyUnicode_BidirectionalNames[] = {"
+    print("const char *_PyUnicode_BidirectionalNames[] = {", file=fp)
     for name in BIDIRECTIONAL_NAMES:
-        print >>fp, "    \"%s\"," % name
-    print >>fp, "    NULL"
-    print >>fp, "};"
+        print("    \"%s\"," % name, file=fp)
+    print("    NULL", file=fp)
+    print("};", file=fp)
 
-    print >>fp, "const char *_PyUnicode_EastAsianWidthNames[] = {"
+    print("const char *_PyUnicode_EastAsianWidthNames[] = {", file=fp)
     for name in EASTASIANWIDTH_NAMES:
-        print >>fp, "    \"%s\"," % name
-    print >>fp, "    NULL"
-    print >>fp, "};"
+        print("    \"%s\"," % name, file=fp)
+    print("    NULL", file=fp)
+    print("};", file=fp)
 
-    print >>fp, "static const char *decomp_prefix[] = {"
+    print("static const char *decomp_prefix[] = {", file=fp)
     for name in decomp_prefix:
-        print >>fp, "    \"%s\"," % name
-    print >>fp, "    NULL"
-    print >>fp, "};"
+        print("    \"%s\"," % name, file=fp)
+    print("    NULL", file=fp)
+    print("};", file=fp)
 
     # split record index table
     index1, index2, shift = splitbins(index, trace)
 
-    print >>fp, "/* index tables for the database records */"
-    print >>fp, "#define SHIFT", shift
+    print("/* index tables for the database records */", file=fp)
+    print("#define SHIFT", shift, file=fp)
     Array("index1", index1).dump(fp, trace)
     Array("index2", index2).dump(fp, trace)
 
     # split decomposition index table
     index1, index2, shift = splitbins(decomp_index, trace)
 
-    print >>fp, "/* decomposition data */"
+    print("/* decomposition data */", file=fp)
     Array("decomp_data", decomp_data).dump(fp, trace)
 
-    print >>fp, "/* index tables for the decomposition data */"
-    print >>fp, "#define DECOMP_SHIFT", shift
+    print("/* index tables for the decomposition data */", file=fp)
+    print("#define DECOMP_SHIFT", shift, file=fp)
     Array("decomp_index1", index1).dump(fp, trace)
     Array("decomp_index2", index2).dump(fp, trace)
 
     index, index2, shift = splitbins(comp_data, trace)
-    print >>fp, "/* NFC pairs */"
-    print >>fp, "#define COMP_SHIFT", shift
+    print("/* NFC pairs */", file=fp)
+    print("#define COMP_SHIFT", shift, file=fp)
     Array("comp_index", index).dump(fp, trace)
     Array("comp_data", index2).dump(fp, trace)
 
@@ -306,30 +305,30 @@
                 index[i] = cache[record] = len(records)
                 records.append(record)
         index1, index2, shift = splitbins(index, trace)
-        print >>fp, "static const change_record change_records_%s[] = {" % cversion
+        print("static const change_record change_records_%s[] = {" % cversion, file=fp)
         for record in records:
-            print >>fp, "\t{ %s }," % ", ".join(map(str,record))
-        print >>fp, "};"
+            print("\t{ %s }," % ", ".join(map(str,record)), file=fp)
+        print("};", file=fp)
         Array("changes_%s_index" % cversion, index1).dump(fp, trace)
         Array("changes_%s_data" % cversion, index2).dump(fp, trace)
-        print >>fp, "static const change_record* get_change_%s(Py_UCS4 n)" % cversion
-        print >>fp, "{"
-        print >>fp, "\tint index;"
-        print >>fp, "\tif (n >= 0x110000) index = 0;"
-        print >>fp, "\telse {"
-        print >>fp, "\t\tindex = changes_%s_index[n>>%d];" % (cversion, shift)
-        print >>fp, "\t\tindex = changes_%s_data[(index<<%d)+(n & %d)];" % \
-              (cversion, shift, ((1<<shift)-1))
-        print >>fp, "\t}"
-        print >>fp, "\treturn change_records_%s+index;" % cversion
-        print >>fp, "}\n"
-        print >>fp, "static Py_UCS4 normalization_%s(Py_UCS4 n)" % cversion
-        print >>fp, "{"
-        print >>fp, "\tswitch(n) {"
+        print("static const change_record* get_change_%s(Py_UCS4 n)" % cversion, file=fp)
+        print("{", file=fp)
+        print("\tint index;", file=fp)
+        print("\tif (n >= 0x110000) index = 0;", file=fp)
+        print("\telse {", file=fp)
+        print("\t\tindex = changes_%s_index[n>>%d];" % (cversion, shift), file=fp)
+        print("\t\tindex = changes_%s_data[(index<<%d)+(n & %d)];" % \
+              (cversion, shift, ((1<<shift)-1)), file=fp)
+        print("\t}", file=fp)
+        print("\treturn change_records_%s+index;" % cversion, file=fp)
+        print("}\n", file=fp)
+        print("static Py_UCS4 normalization_%s(Py_UCS4 n)" % cversion, file=fp)
+        print("{", file=fp)
+        print("\tswitch(n) {", file=fp)
         for k, v in normalization:
-            print >>fp, "\tcase %s: return 0x%s;" % (hex(k), v)
-        print >>fp, "\tdefault: return 0;"
-        print >>fp, "\t}\n}\n"
+            print("\tcase %s: return 0x%s;" % (hex(k), v), file=fp)
+        print("\tdefault: return 0;", file=fp)
+        print("\t}\n}\n", file=fp)
 
     fp.close()
 
@@ -340,7 +339,7 @@
 
     FILE = "Objects/unicodetype_db.h"
 
-    print "--- Preparing", FILE, "..."
+    print("--- Preparing", FILE, "...")
 
     # extract unicode types
     dummy = (0, 0, 0, 0, 0, 0)
@@ -405,25 +404,25 @@
                 table.append(item)
             index[char] = i
 
-    print len(table), "unique character type entries"
+    print(len(table), "unique character type entries")
 
-    print "--- Writing", FILE, "..."
+    print("--- Writing", FILE, "...")
 
     fp = open(FILE, "w")
-    print >>fp, "/* this file was generated by %s %s */" % (SCRIPT, VERSION)
-    print >>fp
-    print >>fp, "/* a list of unique character type descriptors */"
-    print >>fp, "const _PyUnicode_TypeRecord _PyUnicode_TypeRecords[] = {"
+    print("/* this file was generated by %s %s */" % (SCRIPT, VERSION), file=fp)
+    print(file=fp)
+    print("/* a list of unique character type descriptors */", file=fp)
+    print("const _PyUnicode_TypeRecord _PyUnicode_TypeRecords[] = {", file=fp)
     for item in table:
-        print >>fp, "    {%d, %d, %d, %d, %d, %d}," % item
-    print >>fp, "};"
-    print >>fp
+        print("    {%d, %d, %d, %d, %d, %d}," % item, file=fp)
+    print("};", file=fp)
+    print(file=fp)
 
     # split decomposition index table
     index1, index2, shift = splitbins(index, trace)
 
-    print >>fp, "/* type indexes */"
-    print >>fp, "#define SHIFT", shift
+    print("/* type indexes */", file=fp)
+    print("#define SHIFT", shift, file=fp)
     Array("index1", index1).dump(fp, trace)
     Array("index2", index2).dump(fp, trace)
 
@@ -436,7 +435,7 @@
 
     FILE = "Modules/unicodename_db.h"
 
-    print "--- Preparing", FILE, "..."
+    print("--- Preparing", FILE, "...")
 
     # collect names
     names = [None] * len(unicode.chars)
@@ -448,7 +447,7 @@
             if name and name[0] != "<":
                 names[char] = name + chr(0)
 
-    print len(filter(lambda n: n is not None, names)), "distinct names"
+    print(len(filter(lambda n: n is not None, names)), "distinct names")
 
     # collect unique words from names (note that we differ between
     # words inside a sentence, and words ending a sentence.  the
@@ -469,7 +468,7 @@
                 else:
                     words[w] = [len(words)]
 
-    print n, "words in text;", b, "bytes"
+    print(n, "words in text;", b, "bytes")
 
     wordlist = words.items()
 
@@ -485,19 +484,19 @@
     escapes = 0
     while escapes * 256 < len(wordlist):
         escapes = escapes + 1
-    print escapes, "escapes"
+    print(escapes, "escapes")
 
     short = 256 - escapes
 
     assert short > 0
 
-    print short, "short indexes in lexicon"
+    print(short, "short indexes in lexicon")
 
     # statistics
     n = 0
     for i in range(short):
         n = n + len(wordlist[i][1])
-    print n, "short indexes in phrasebook"
+    print(n, "short indexes in phrasebook")
 
     # pick the most commonly used words, and sort the rest on falling
     # length (to maximize overlap)
@@ -566,29 +565,29 @@
 
     codehash = Hash("code", data, 47)
 
-    print "--- Writing", FILE, "..."
+    print("--- Writing", FILE, "...")
 
     fp = open(FILE, "w")
-    print >>fp, "/* this file was generated by %s %s */" % (SCRIPT, VERSION)
-    print >>fp
-    print >>fp, "#define NAME_MAXLEN", 256
-    print >>fp
-    print >>fp, "/* lexicon */"
+    print("/* this file was generated by %s %s */" % (SCRIPT, VERSION), file=fp)
+    print(file=fp)
+    print("#define NAME_MAXLEN", 256, file=fp)
+    print(file=fp)
+    print("/* lexicon */", file=fp)
     Array("lexicon", lexicon).dump(fp, trace)
     Array("lexicon_offset", lexicon_offset).dump(fp, trace)
 
     # split decomposition index table
     offset1, offset2, shift = splitbins(phrasebook_offset, trace)
 
-    print >>fp, "/* code->name phrasebook */"
-    print >>fp, "#define phrasebook_shift", shift
-    print >>fp, "#define phrasebook_short", short
+    print("/* code->name phrasebook */", file=fp)
+    print("#define phrasebook_shift", shift, file=fp)
+    print("#define phrasebook_short", short, file=fp)
 
     Array("phrasebook", phrasebook).dump(fp, trace)
     Array("phrasebook_offset1", offset1).dump(fp, trace)
     Array("phrasebook_offset2", offset2).dump(fp, trace)
 
-    print >>fp, "/* name->code dictionary */"
+    print("/* name->code dictionary */", file=fp)
     codehash.dump(fp, trace)
 
     fp.close()
@@ -781,7 +780,7 @@
         else:
             raise AssertionError, "ran out of polynominals"
 
-        print size, "slots in hash table"
+        print(size, "slots in hash table")
 
         table = [None] * size
 
@@ -813,7 +812,7 @@
                 if incr > mask:
                     incr = incr ^ poly
 
-        print n, "collisions"
+        print(n, "collisions")
         self.collisions = n
 
         for i in range(len(table)):
@@ -845,7 +844,7 @@
         # write data to file, as a C array
         size = getsize(self.data)
         if trace:
-            print >>sys.stderr, self.name+":", size*len(self.data), "bytes"
+            print(self.name+":", size*len(self.data), "bytes", file=sys.stderr)
         file.write("static ")
         if size == 1:
             file.write("unsigned char")
@@ -895,10 +894,10 @@
     import sys
     if trace:
         def dump(t1, t2, shift, bytes):
-            print >>sys.stderr, "%d+%d bins at shift %d; %d bytes" % (
-                len(t1), len(t2), shift, bytes)
-        print >>sys.stderr, "Size of original table:", len(t)*getsize(t), \
-                            "bytes"
+            print("%d+%d bins at shift %d; %d bytes" % (
+                len(t1), len(t2), shift, bytes), file=sys.stderr)
+        print("Size of original table:", len(t)*getsize(t), \
+                            "bytes", file=sys.stderr)
     n = len(t)-1    # last valid index
     maxshift = 0    # the most we can shift n and still have something left
     if n > 0:
@@ -930,7 +929,7 @@
             bytes = b
     t1, t2, shift = best
     if trace:
-        print >>sys.stderr, "Best:",
+        print("Best:", end=' ', file=sys.stderr)
         dump(t1, t2, shift, bytes)
     if __debug__:
         # exhaustively verify that the decomposition is correct

Modified: python/branches/py3k-struni/Tools/unicode/mkstringprep.py
==============================================================================
--- python/branches/py3k-struni/Tools/unicode/mkstringprep.py	(original)
+++ python/branches/py3k-struni/Tools/unicode/mkstringprep.py	Fri Aug  3 19:06:41 2007
@@ -106,7 +106,7 @@
 
 ########### Generate compact Python versions of the tables #############
 
-print """# This file is generated by mkstringprep.py. DO NOT EDIT.
+print("""# This file is generated by mkstringprep.py. DO NOT EDIT.
 \"\"\"Library that exposes various tables found in the StringPrep RFC 3454.
 
 There are two kinds of tables: sets, for which a member test is provided,
@@ -114,9 +114,9 @@
 \"\"\"
 
 import unicodedata
-"""
+""")
 
-print "assert unicodedata.unidata_version == %s" % repr(unicodedata.unidata_version)
+print("assert unicodedata.unidata_version == %s" % repr(unicodedata.unidata_version))
 
 # A.1 is the table of unassigned characters
 # XXX Plane 15 PUA is listed as unassigned in Python.
@@ -134,13 +134,13 @@
 
 # assert table == Cn
 
-print """
+print("""
 def in_table_a1(code):
     if unicodedata.category(code) != 'Cn': return False
     c = ord(code)
     if 0xFDD0 <= c < 0xFDF0: return False
     return (c & 0xFFFF) not in (0xFFFE, 0xFFFF)
-"""
+""")
 
 # B.1 cannot easily be derived
 name, table = tables[0]
@@ -148,11 +148,11 @@
 assert name == "B.1"
 table = table.keys()
 table.sort()
-print """
+print("""
 b1_set = """ + compact_set(table) + """
 def in_table_b1(code):
     return ord(code) in b1_set
-"""
+""")
 
 # B.2 and B.3 is case folding.
 # It takes CaseFolding.txt into account, which is
@@ -180,20 +180,20 @@
 b3 = b3_exceptions.items()
 b3.sort()
 
-print """
-b3_exceptions = {"""
+print("""
+b3_exceptions = {""")
 for i,(k,v) in enumerate(b3):
-    print "0x%x:%s," % (k, repr(v)),
+    print("0x%x:%s," % (k, repr(v)), end=' ')
     if i % 4 == 3:
-        print
-print "}"
+        print()
+print("}")
 
-print """
+print("""
 def map_table_b3(code):
     r = b3_exceptions.get(ord(code))
     if r is not None: return r
     return code.lower()
-"""
+""")
 
 def map_table_b3(code):
     r = b3_exceptions.get(ord(code))
@@ -222,7 +222,7 @@
 # B.3 should not add any additional special cases
 assert specials == {}
 
-print """
+print("""
 def map_table_b2(a):
     al = map_table_b3(a)
     b = unicodedata.normalize("NFKC", al)
@@ -232,7 +232,7 @@
         return c
     else:
         return al
-"""
+""")
 
 # C.1.1 is a table with a single character
 name, table = tables[0]
@@ -240,10 +240,10 @@
 assert name == "C.1.1"
 assert table == {0x20:0x20}
 
-print """
+print("""
 def in_table_c11(code):
     return code == u" "
-"""
+""")
 
 # C.1.2 is the rest of all space characters
 name, table = tables[0]
@@ -254,13 +254,13 @@
 # Zs = set(gen_category(["Zs"])) - set([0x20])
 # assert Zs == table
 
-print """
+print("""
 def in_table_c12(code):
     return unicodedata.category(code) == "Zs" and code != u" "
 
 def in_table_c11_c12(code):
     return unicodedata.category(code) == "Zs"
-"""
+""")
 
 # C.2.1 ASCII control characters
 name, table_c21 = tables[0]
@@ -272,10 +272,10 @@
 table_c21 = set(table_c21.keys())
 assert Cc_ascii == table_c21
 
-print """
+print("""
 def in_table_c21(code):
     return ord(code) < 128 and unicodedata.category(code) == "Cc"
-"""
+""")
 
 # C.2.2 Non-ASCII control characters. It also includes
 # a number of characters in category Cf.
@@ -290,7 +290,7 @@
 specials = list(table_c22 - Cc_nonascii)
 specials.sort()
 
-print """c22_specials = """ + compact_set(specials) + """
+print("""c22_specials = """ + compact_set(specials) + """
 def in_table_c22(code):
     c = ord(code)
     if c < 128: return False
@@ -300,7 +300,7 @@
 def in_table_c21_c22(code):
     return unicodedata.category(code) == "Cc" or \\
            ord(code) in c22_specials
-"""
+""")
 
 # C.3 Private use
 name, table = tables[0]
@@ -310,10 +310,10 @@
 Co = set(gen_category(["Co"]))
 assert set(table.keys()) == Co
 
-print """
+print("""
 def in_table_c3(code):
     return unicodedata.category(code) == "Co"
-"""
+""")
 
 # C.4 Non-character code points, xFFFE, xFFFF
 # plus process internal codes
@@ -327,13 +327,13 @@
 table = set(table.keys())
 assert table == nonchar
 
-print """
+print("""
 def in_table_c4(code):
     c = ord(code)
     if c < 0xFDD0: return False
     if c < 0xFDF0: return True
     return (ord(code) & 0xFFFF) in (0xFFFE, 0xFFFF)
-"""
+""")
 
 # C.5 Surrogate codes
 name, table = tables[0]
@@ -343,10 +343,10 @@
 Cs = set(gen_category(["Cs"]))
 assert set(table.keys()) == Cs
 
-print """
+print("""
 def in_table_c5(code):
     return unicodedata.category(code) == "Cs"
-"""
+""")
 
 # C.6 Inappropriate for plain text
 name, table = tables[0]
@@ -356,11 +356,11 @@
 table = table.keys()
 table.sort()
 
-print """
+print("""
 c6_set = """ + compact_set(table) + """
 def in_table_c6(code):
     return ord(code) in c6_set
-"""
+""")
 
 # C.7 Inappropriate for canonical representation
 name, table = tables[0]
@@ -370,11 +370,11 @@
 table = table.keys()
 table.sort()
 
-print """
+print("""
 c7_set = """ + compact_set(table) + """
 def in_table_c7(code):
     return ord(code) in c7_set
-"""
+""")
 
 # C.8 Change display properties or are deprecated
 name, table = tables[0]
@@ -384,11 +384,11 @@
 table = table.keys()
 table.sort()
 
-print """
+print("""
 c8_set = """ + compact_set(table) + """
 def in_table_c8(code):
     return ord(code) in c8_set
-"""
+""")
 
 # C.9 Tagging characters
 name, table = tables[0]
@@ -398,11 +398,11 @@
 table = table.keys()
 table.sort()
 
-print """
+print("""
 c9_set = """ + compact_set(table) + """
 def in_table_c9(code):
     return ord(code) in c9_set
-"""
+""")
 
 # D.1 Characters with bidirectional property "R" or "AL"
 name, table = tables[0]
@@ -412,10 +412,10 @@
 RandAL = set(gen_bidirectional(["R","AL"]))
 assert set(table.keys()) == RandAL
 
-print """
+print("""
 def in_table_d1(code):
     return unicodedata.bidirectional(code) in ("R","AL")
-"""
+""")
 
 # D.2 Characters with bidirectional property "L"
 name, table = tables[0]
@@ -425,7 +425,7 @@
 L = set(gen_bidirectional(["L"]))
 assert set(table.keys()) == L
 
-print """
+print("""
 def in_table_d2(code):
     return unicodedata.bidirectional(code) == "L"
-"""
+""")

Modified: python/branches/py3k-struni/Tools/versioncheck/checkversions.py
==============================================================================
--- python/branches/py3k-struni/Tools/versioncheck/checkversions.py	(original)
+++ python/branches/py3k-struni/Tools/versioncheck/checkversions.py	Fri Aug  3 19:06:41 2007
@@ -28,7 +28,7 @@
         try:
             execfile(fullname)
         except:
-            print '** Exception in', fullname
+            print('** Exception in', fullname)
 
 def walk1tree(tree):
     os.path.walk(tree, check1dir, None)
@@ -38,7 +38,7 @@
     try:
         options, arguments = getopt.getopt(sys.argv[1:], 'v:')
     except getopt.error:
-        print USAGE
+        print(USAGE)
         sys.exit(1)
     for o, a in options:
         if o == '-v':

Modified: python/branches/py3k-struni/Tools/versioncheck/pyversioncheck.py
==============================================================================
--- python/branches/py3k-struni/Tools/versioncheck/pyversioncheck.py	(original)
+++ python/branches/py3k-struni/Tools/versioncheck/pyversioncheck.py	Fri Aug  3 19:06:41 2007
@@ -18,12 +18,12 @@
     if verbose > VERBOSE_NORMAL:
         return ok
     if ok < 0:
-        print '%s: No correctly formatted current version file found'%(package)
+        print('%s: No correctly formatted current version file found'%(package))
     elif ok == 1:
-        print '%s: up-to-date (version %s)'%(package, version)
+        print('%s: up-to-date (version %s)'%(package, version))
     else:
-        print '%s: version %s installed, version %s found:' % \
-                        (package, version, newversion)
+        print('%s: version %s installed, version %s found:' % \
+                        (package, version, newversion))
         if verbose > VERBOSE_SILENT:
             while 1:
                 line = fp.readline()
@@ -33,7 +33,7 @@
 
 def checkonly(package, url, version, verbose=0):
     if verbose >= VERBOSE_EACHFILE:
-        print '%s:'%package
+        print('%s:'%package)
     if isinstance(url, str):
         ok, newversion, fp = _check1version(package, url, version, verbose)
     else:
@@ -45,51 +45,51 @@
 
 def _check1version(package, url, version, verbose=0):
     if verbose >= VERBOSE_EACHFILE:
-        print '  Checking %s'%url
+        print('  Checking %s'%url)
     try:
         fp = urllib.urlopen(url)
     except IOError as arg:
         if verbose >= VERBOSE_EACHFILE:
-            print '    Cannot open:', arg
+            print('    Cannot open:', arg)
         return -1, None, None
     msg = rfc822.Message(fp, seekable=0)
     newversion = msg.getheader('current-version')
     if not newversion:
         if verbose >= VERBOSE_EACHFILE:
-            print '    No "Current-Version:" header in URL or URL not found'
+            print('    No "Current-Version:" header in URL or URL not found')
         return -1, None, None
     version = version.lower().strip()
     newversion = newversion.lower().strip()
     if version == newversion:
         if verbose >= VERBOSE_EACHFILE:
-            print '    Version identical (%s)'%newversion
+            print('    Version identical (%s)'%newversion)
         return 1, version, fp
     else:
         if verbose >= VERBOSE_EACHFILE:
-            print '    Versions different (installed: %s, new: %s)'% \
-                        (version, newversion)
+            print('    Versions different (installed: %s, new: %s)'% \
+                        (version, newversion))
         return 0, newversion, fp
 
 
 def _test():
-    print '--- TEST VERBOSE=1'
-    print '--- Testing existing and identical version file'
+    print('--- TEST VERBOSE=1')
+    print('--- Testing existing and identical version file')
     versioncheck('VersionTestPackage', _TESTDIR+'Version10.txt', '1.0', verbose=1)
-    print '--- Testing existing package with new version'
+    print('--- Testing existing package with new version')
     versioncheck('VersionTestPackage', _TESTDIR+'Version11.txt', '1.0', verbose=1)
-    print '--- Testing package with non-existing version file'
+    print('--- Testing package with non-existing version file')
     versioncheck('VersionTestPackage', _TESTDIR+'nonexistent.txt', '1.0', verbose=1)
-    print '--- Test package with 2 locations, first non-existing second ok'
+    print('--- Test package with 2 locations, first non-existing second ok')
     versfiles = [_TESTDIR+'nonexistent.txt', _TESTDIR+'Version10.txt']
     versioncheck('VersionTestPackage', versfiles, '1.0', verbose=1)
-    print '--- TEST VERBOSE=2'
-    print '--- Testing existing and identical version file'
+    print('--- TEST VERBOSE=2')
+    print('--- Testing existing and identical version file')
     versioncheck('VersionTestPackage', _TESTDIR+'Version10.txt', '1.0', verbose=2)
-    print '--- Testing existing package with new version'
+    print('--- Testing existing package with new version')
     versioncheck('VersionTestPackage', _TESTDIR+'Version11.txt', '1.0', verbose=2)
-    print '--- Testing package with non-existing version file'
+    print('--- Testing package with non-existing version file')
     versioncheck('VersionTestPackage', _TESTDIR+'nonexistent.txt', '1.0', verbose=2)
-    print '--- Test package with 2 locations, first non-existing second ok'
+    print('--- Test package with 2 locations, first non-existing second ok')
     versfiles = [_TESTDIR+'nonexistent.txt', _TESTDIR+'Version10.txt']
     versioncheck('VersionTestPackage', versfiles, '1.0', verbose=2)
 

Modified: python/branches/py3k-struni/Tools/webchecker/wcgui.py
==============================================================================
--- python/branches/py3k-struni/Tools/webchecker/wcgui.py	(original)
+++ python/branches/py3k-struni/Tools/webchecker/wcgui.py	Fri Aug  3 19:06:41 2007
@@ -76,8 +76,8 @@
         opts, args = getopt.getopt(sys.argv[1:], 't:m:qva')
     except getopt.error as msg:
         sys.stdout = sys.stderr
-        print msg
-        print __doc__%vars(webchecker)
+        print(msg)
+        print(__doc__%vars(webchecker))
         sys.exit(2)
     webchecker.verbose = webchecker.VERBOSE
     webchecker.nonames = webchecker.NONAMES

Modified: python/branches/py3k-struni/Tools/webchecker/webchecker.py
==============================================================================
--- python/branches/py3k-struni/Tools/webchecker/webchecker.py	(original)
+++ python/branches/py3k-struni/Tools/webchecker/webchecker.py	Fri Aug  3 19:06:41 2007
@@ -155,8 +155,8 @@
         opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vxa')
     except getopt.error as msg:
         sys.stdout = sys.stderr
-        print msg
-        print __doc__%globals()
+        print(msg)
+        print(__doc__%globals())
         sys.exit(2)
 
     # The extra_roots variable collects extra roots.
@@ -186,7 +186,7 @@
             checkext = not checkext
 
     if verbose > 0:
-        print AGENTNAME, "version", __version__
+        print(AGENTNAME, "version", __version__)
 
     if restart:
         c = load_pickle(dumpfile=dumpfile, verbose=verbose)
@@ -222,32 +222,32 @@
                 c.run()
             except KeyboardInterrupt:
                 if verbose > 0:
-                    print "[run interrupted]"
+                    print("[run interrupted]")
 
         try:
             c.report()
         except KeyboardInterrupt:
             if verbose > 0:
-                print "[report interrupted]"
+                print("[report interrupted]")
 
     finally:
         if c.save_pickle(dumpfile):
             if dumpfile == DUMPFILE:
-                print "Use ``%s -R'' to restart." % sys.argv[0]
+                print("Use ``%s -R'' to restart." % sys.argv[0])
             else:
-                print "Use ``%s -R -d %s'' to restart." % (sys.argv[0],
-                                                           dumpfile)
+                print("Use ``%s -R -d %s'' to restart." % (sys.argv[0],
+                                                           dumpfile))
 
 
 def load_pickle(dumpfile=DUMPFILE, verbose=VERBOSE):
     if verbose > 0:
-        print "Loading checkpoint from %s ..." % dumpfile
+        print("Loading checkpoint from %s ..." % dumpfile)
     f = open(dumpfile, "rb")
     c = pickle.load(f)
     f.close()
     if verbose > 0:
-        print "Done."
-        print "Root:", "\n      ".join(c.roots)
+        print("Done.")
+        print("Root:", "\n      ".join(c.roots))
     return c
 
 
@@ -297,7 +297,7 @@
     def message(self, format, *args):
         if args:
             format = format%args
-        print format
+        print(format)
 
     def __getstate__(self):
         return (self.roots, self.todo, self.done, self.bad, self.round)
@@ -689,7 +689,7 @@
             if self.verbose >= level:
                 if args:
                     msg = msg%args
-                print msg
+                print(msg)
 
     # Method to retrieve names.
     def getnames(self):

Modified: python/branches/py3k-struni/Tools/webchecker/websucker.py
==============================================================================
--- python/branches/py3k-struni/Tools/webchecker/websucker.py	(original)
+++ python/branches/py3k-struni/Tools/webchecker/websucker.py	Fri Aug  3 19:06:41 2007
@@ -22,8 +22,8 @@
     try:
         opts, args = getopt.getopt(sys.argv[1:], "qv")
     except getopt.error as msg:
-        print msg
-        print "usage:", sys.argv[0], "[-qv] ... [rooturl] ..."
+        print(msg)
+        print("usage:", sys.argv[0], "[-qv] ... [rooturl] ...")
         return 2
     for o, a in opts:
         if o == "-q":
@@ -36,9 +36,9 @@
             ('User-agent', 'websucker/%s' % __version__),
         ]
     for arg in args:
-        print "Adding root", arg
+        print("Adding root", arg)
         c.addroot(arg)
-    print "Run..."
+    print("Run...")
     c.run()
 
 class Sucker(webchecker.Checker):
@@ -116,7 +116,7 @@
         return
     head, tail = os.path.split(dir)
     if not tail:
-        print "Huh?  Don't know how to make dir", dir
+        print("Huh?  Don't know how to make dir", dir)
         return
     makedirs(head)
     os.mkdir(dir, 0o777)


More information about the Python-3000-checkins mailing list