• R/O
  • SSH
  • HTTPS

tortoisesvn: Commit


Commit MetaInfo

Revision29299 (tree)
Time2021-12-21 04:12:23
Authorstefankueng

Log Message

make scripts work with Python 3

Change Summary

Incremental Difference

--- trunk/doc/scripts/chkidd.py (revision 29298)
+++ trunk/doc/scripts/chkidd.py (revision 29299)
@@ -63,7 +63,7 @@
6363 def onProcessFile(self, dirpath, file):
6464 fullfile = os.path.join(dirpath, file)
6565 if self.verbose > 1:
66- print fullfile
66+ print (fullfile)
6767 elif self.verbose > 0:
6868 sys.stdout.write('.')
6969 self.grepHIDD(fullfile)
@@ -78,9 +78,9 @@
7878 ref = "%s:%s:%s" % (fileinput.filename(),
7979 fileinput.lineno(),
8080 m.span()[0])
81- hidd = unicode(m.groups()[0])
81+ hidd = str(m.groups()[0])
8282 if self.verbose > 1:
83- print "%s %s" % (ref, hidd)
83+ print( "%s %s" % (ref, hidd))
8484 HIDDs.setdefault(hidd, []).append(ref)
8585
8686
@@ -121,16 +121,16 @@
121121 # Report for this file
122122 i = set(IDDs.keys()) - set(Ignores.keys())
123123 h = set(HIDDs.keys())
124- print "# IDD/HIDD cross check report for %s" % rcfile
125- print "# XML source tree in %s" % xmldir
126- print "# IDDs found in resource file and missing in XML files"
124+ print ("# IDD/HIDD cross check report for %s" % rcfile)
125+ print ("# XML source tree in %s" % xmldir)
126+ print ("# IDDs found in resource file and missing in XML files")
127127 for idds in sorted(i - h):
128- print "%s: IDD_%s" % (IDDs[idds][0], idds)
128+ print ("%s: IDD_%s" % (IDDs[idds][0], idds))
129129
130130 print
131- print "# HIDDs found in XML files but not defined in resource file"
131+ print ("# HIDDs found in XML files but not defined in resource file")
132132 for hidds in sorted(h - i):
133- print "%s: HIDD_%s" % (HIDDs[hidds][0], hidds)
133+ print ("%s: HIDD_%s" % (HIDDs[hidds][0], hidds))
134134 print
135135
136136
@@ -142,14 +142,14 @@
142142 try:
143143 xw = XMLFileWalker(xmldir)
144144 xw.walk()
145- except IOError, e:
146- print e
145+ except IOError as e:
146+ print (e)
147147 sys.exit(1)
148148
149149
150150 def main():
151151 if len(sys.argv) < 3:
152- print "Usage: xmldir rcfile [ ignorefile ]"
152+ print ("Usage: xmldir rcfile [ ignorefile ]")
153153 sys.exit(0)
154154
155155 xmldir = sys.argv[1]
--- trunk/doc/scripts/fileutil.py (revision 29298)
+++ trunk/doc/scripts/fileutil.py (revision 29299)
@@ -24,6 +24,8 @@
2424 # Exceptions
2525 #
2626
27+def cmp(a, b):
28+ return (a > b) - (a < b)
2729
2830 class FileutilError(Exception):
2931 '''
@@ -307,10 +309,10 @@
307309 '''
308310
309311 def onProcessDir(self, dirpath, dir):
310- print "DIR: <%r> <%r>" % (dirpath, dir)
312+ print ("DIR: <%r> <%r>" % (dirpath, dir))
311313
312314 def onProcessFile(self, dirpath, file):
313- print "FILE: <%r> <%r>" % (dirpath, file)
315+ print ("FILE: <%r> <%r>" % (dirpath, file))
314316
315317 # ---------------------------------------------------------
316318 # Utility Functions
@@ -330,7 +332,7 @@
330332
331333 def __test_walk(dirs):
332334 for dir in dirs:
333- print 'SimpleFileWalker(%r):' % (dir, )
335+ print ('SimpleFileWalker(%r):' % (dir, ))
334336 w = SimpleFileWalker(dir)
335337 w.walk()
336338
Show on old repository browser