Skip to content

Commit e7bf59f

Browse files
committed
Run 2to3's print fixer over some places that had been missed.
1 parent 716c3ac commit e7bf59f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+253
-253
lines changed

Mac/BuildScript/build-installer.py

+36-36
Original file line numberDiff line numberDiff line change
@@ -336,16 +336,16 @@ def parseOptions(args=None):
336336
options, args = getopt.getopt(args, '?hb',
337337
[ 'build-dir=', 'third-party=', 'sdk-path=' , 'src-dir='])
338338
except getopt.error as msg:
339-
print msg
339+
print(msg)
340340
sys.exit(1)
341341

342342
if args:
343-
print "Additional arguments"
343+
print("Additional arguments")
344344
sys.exit(1)
345345

346346
for k, v in options:
347347
if k in ('-h', '-?'):
348-
print USAGE
348+
print(USAGE)
349349
sys.exit(0)
350350

351351
elif k in ('-d', '--build-dir'):
@@ -368,12 +368,12 @@ def parseOptions(args=None):
368368
SDKPATH=os.path.abspath(SDKPATH)
369369
DEPSRC=os.path.abspath(DEPSRC)
370370

371-
print "Settings:"
372-
print " * Source directory:", SRCDIR
373-
print " * Build directory: ", WORKDIR
374-
print " * SDK location: ", SDKPATH
375-
print " * third-party source:", DEPSRC
376-
print ""
371+
print("Settings:")
372+
print(" * Source directory:", SRCDIR)
373+
print(" * Build directory: ", WORKDIR)
374+
print(" * SDK location: ", SDKPATH)
375+
print(" * third-party source:", DEPSRC)
376+
print("")
377377

378378

379379

@@ -440,7 +440,7 @@ def downloadURL(url, fname):
440440
pass
441441
else:
442442
if KNOWNSIZES.get(url) == size:
443-
print "Using existing file for", url
443+
print("Using existing file for", url)
444444
return
445445
fpIn = urllib2.urlopen(url)
446446
fpOut = open(fname, 'wb')
@@ -479,14 +479,14 @@ def buildRecipe(recipe, basedir, archList):
479479

480480

481481
if os.path.exists(sourceArchive):
482-
print "Using local copy of %s"%(name,)
482+
print("Using local copy of %s"%(name,))
483483

484484
else:
485-
print "Downloading %s"%(name,)
485+
print("Downloading %s"%(name,))
486486
downloadURL(url, sourceArchive)
487-
print "Archive for %s stored as %s"%(name, sourceArchive)
487+
print("Archive for %s stored as %s"%(name, sourceArchive))
488488

489-
print "Extracting archive for %s"%(name,)
489+
print("Extracting archive for %s"%(name,))
490490
buildDir=os.path.join(WORKDIR, '_bld')
491491
if not os.path.exists(buildDir):
492492
os.mkdir(buildDir)
@@ -549,24 +549,24 @@ def buildRecipe(recipe, basedir, archList):
549549
configure_args.insert(0, configure)
550550
configure_args = [ shellQuote(a) for a in configure_args ]
551551

552-
print "Running configure for %s"%(name,)
552+
print("Running configure for %s"%(name,))
553553
runCommand(' '.join(configure_args) + ' 2>&1')
554554

555-
print "Running install for %s"%(name,)
555+
print("Running install for %s"%(name,))
556556
runCommand('{ ' + install + ' ;} 2>&1')
557557

558-
print "Done %s"%(name,)
559-
print ""
558+
print("Done %s"%(name,))
559+
print("")
560560

561561
os.chdir(curdir)
562562

563563
def buildLibraries():
564564
"""
565565
Build our dependencies into $WORKDIR/libraries/usr/local
566566
"""
567-
print ""
568-
print "Building required libraries"
569-
print ""
567+
print("")
568+
print("Building required libraries")
569+
print("")
570570
universal = os.path.join(WORKDIR, 'libraries')
571571
os.mkdir(universal)
572572
os.makedirs(os.path.join(universal, 'usr', 'local', 'lib'))
@@ -580,21 +580,21 @@ def buildLibraries():
580580
def buildPythonDocs():
581581
# This stores the documentation as Resources/English.lproj/Docuentation
582582
# inside the framwork. pydoc and IDLE will pick it up there.
583-
print "Install python documentation"
583+
print("Install python documentation")
584584
rootDir = os.path.join(WORKDIR, '_root')
585585
version = getVersion()
586586
docdir = os.path.join(rootDir, 'pydocs')
587587

588588
name = 'html-%s.tar.bz2'%(getFullVersion(),)
589589
sourceArchive = os.path.join(DEPSRC, name)
590590
if os.path.exists(sourceArchive):
591-
print "Using local copy of %s"%(name,)
591+
print("Using local copy of %s"%(name,))
592592

593593
else:
594-
print "Downloading %s"%(name,)
594+
print("Downloading %s"%(name,))
595595
downloadURL('http://www.python.org/ftp/python/doc/%s/%s'%(
596596
getFullVersion(), name), sourceArchive)
597-
print "Archive for %s stored as %s"%(name, sourceArchive)
597+
print("Archive for %s stored as %s"%(name, sourceArchive))
598598

599599
extractArchive(os.path.dirname(docdir), sourceArchive)
600600
os.rename(
@@ -604,7 +604,7 @@ def buildPythonDocs():
604604

605605

606606
def buildPython():
607-
print "Building a universal python"
607+
print("Building a universal python")
608608

609609
buildDir = os.path.join(WORKDIR, '_bld', 'python')
610610
rootDir = os.path.join(WORKDIR, '_root')
@@ -627,24 +627,24 @@ def buildPython():
627627
# several paths.
628628
version = getVersion()
629629

630-
print "Running configure..."
630+
print("Running configure...")
631631
runCommand("%s -C --enable-framework --enable-universalsdk=%s LDFLAGS='-g -L%s/libraries/usr/local/lib' OPT='-g -O3 -I%s/libraries/usr/local/include' 2>&1"%(
632632
shellQuote(os.path.join(SRCDIR, 'configure')),
633633
shellQuote(SDKPATH), shellQuote(WORKDIR)[1:-1],
634634
shellQuote(WORKDIR)[1:-1]))
635635

636-
print "Running make"
636+
print("Running make")
637637
runCommand("make")
638638

639-
print "Running make frameworkinstall"
639+
print("Running make frameworkinstall")
640640
runCommand("make frameworkinstall DESTDIR=%s"%(
641641
shellQuote(rootDir)))
642642

643-
print "Running make frameworkinstallextras"
643+
print("Running make frameworkinstallextras")
644644
runCommand("make frameworkinstallextras DESTDIR=%s"%(
645645
shellQuote(rootDir)))
646646

647-
print "Copying required shared libraries"
647+
print("Copying required shared libraries")
648648
if os.path.exists(os.path.join(WORKDIR, 'libraries', 'Library')):
649649
runCommand("mv %s/* %s"%(
650650
shellQuote(os.path.join(
@@ -655,7 +655,7 @@ def buildPython():
655655
'Python.framework', 'Versions', getVersion(),
656656
'lib'))))
657657

658-
print "Fix file modes"
658+
print("Fix file modes")
659659
frmDir = os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework')
660660
gid = grp.getgrnam('admin').gr_gid
661661

@@ -744,7 +744,7 @@ def packageFromRecipe(targetDir, recipe):
744744
readme = textwrap.dedent(recipe['readme'])
745745
isRequired = recipe.get('required', True)
746746

747-
print "- building package %s"%(pkgname,)
747+
print("- building package %s"%(pkgname,))
748748

749749
# Substitute some variables
750750
textvars = dict(
@@ -1047,9 +1047,9 @@ def main():
10471047
shutil.copy('../../LICENSE', os.path.join(WORKDIR, 'installer', 'License.txt'))
10481048

10491049
fp = open(os.path.join(WORKDIR, 'installer', 'Build.txt'), 'w')
1050-
print >> fp, "# BUILD INFO"
1051-
print >> fp, "# Date:", time.ctime()
1052-
print >> fp, "# By:", pwd.getpwuid(os.getuid()).pw_gecos
1050+
print("# BUILD INFO", file=fp)
1051+
print("# Date:", time.ctime(), file=fp)
1052+
print("# By:", pwd.getpwuid(os.getuid()).pw_gecos, file=fp)
10531053
fp.close()
10541054

10551055
# Custom icon for the DMG, shown when the DMG is mounted.

Mac/Demo/PICTbrowse/PICTbrowse.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,17 @@ def open(self, (resid, resname)):
6969
self.resid = resid
7070
picture = Qd.GetPicture(self.resid)
7171
# Get rect for picture
72-
print repr(picture.data[:16])
72+
print(repr(picture.data[:16]))
7373
sz, t, l, b, r = struct.unpack('hhhhh', picture.data[:10])
74-
print 'pict:', t, l, b, r
74+
print('pict:', t, l, b, r)
7575
width = r-l
7676
height = b-t
7777
if width < 64: width = 64
7878
elif width > 480: width = 480
7979
if height < 64: height = 64
8080
elif height > 320: height = 320
8181
bounds = (LEFT, TOP, LEFT+width, TOP+height)
82-
print 'bounds:', bounds
82+
print('bounds:', bounds)
8383

8484
self.wid = Win.NewWindow(bounds, resname, 1, 0, -1, 1, 0)
8585
self.wid.SetWindowPic(picture)

Mac/Demo/PICTbrowse/oldPICTbrowse.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,17 @@ def open(self, (resid, resname)):
6868
self.resid = resid
6969
picture = Qd.GetPicture(self.resid)
7070
# Get rect for picture
71-
print repr(picture.data[:16])
71+
print(repr(picture.data[:16]))
7272
sz, t, l, b, r = struct.unpack('hhhhh', picture.data[:10])
73-
print 'pict:', t, l, b, r
73+
print('pict:', t, l, b, r)
7474
width = r-l
7575
height = b-t
7676
if width < 64: width = 64
7777
elif width > 480: width = 480
7878
if height < 64: height = 64
7979
elif height > 320: height = 320
8080
bounds = (LEFT, TOP, LEFT+width, TOP+height)
81-
print 'bounds:', bounds
81+
print('bounds:', bounds)
8282

8383
self.wid = Win.NewWindow(bounds, resname, 1, 0, -1, 1, 0)
8484
self.wid.SetWindowPic(picture)
@@ -115,7 +115,7 @@ def do_listhit(self, event):
115115
(what, message, when, where, modifiers) = event
116116
Qd.SetPort(self.wid)
117117
where = Qd.GlobalToLocal(where)
118-
print 'LISTHIT', where
118+
print('LISTHIT', where)
119119
if self.list.LClick(where, modifiers):
120120
self.do_show()
121121

Mac/Demo/applescript/makedisk.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
try:
99
objref = talker.create('my disk image', saving_as=filespec, leave_image_mounted=1)
1010
except Disk_Copy.Error as arg:
11-
print "ERROR: my disk image:", arg
11+
print("ERROR: my disk image:", arg)
1212
else:
13-
print 'objref=', objref
14-
print 'Type return to exit-'
13+
print('objref=', objref)
14+
print('Type return to exit-')
1515
sys.stdin.readline()

Mac/Demo/imgbrowse/imgbrowse.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626

2727
def main():
28-
print 'hello world'
28+
print('hello world')
2929
imgbrowse()
3030

3131
class imgbrowse(FrameWork.Application):
@@ -84,10 +84,10 @@ def open(self, width, height, pixmap, data):
8484
def do_update(self, *args):
8585
pass
8686
currect = self.fitrect()
87-
print 'PICT:', self.pictrect
88-
print 'WIND:', currect
89-
print 'ARGS:', (self.pixmap, self.wid.GetWindowPort().GetPortBitMapForCopyBits(), self.pictrect,
90-
currect, QuickDraw.srcCopy, None)
87+
print('PICT:', self.pictrect)
88+
print('WIND:', currect)
89+
print('ARGS:', (self.pixmap, self.wid.GetWindowPort().GetPortBitMapForCopyBits(), self.pictrect,
90+
currect, QuickDraw.srcCopy, None))
9191
self.info()
9292
Qd.CopyBits(self.pixmap, self.wid.GetWindowPort().GetPortBitMapForCopyBits(), self.pictrect,
9393
currect, QuickDraw.srcCopy, None)

Mac/Demo/imgbrowse/mac_image.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,19 @@ def dumppixmap(data):
3838
cmpCount, cmpSize, \
3939
planeBytes, pmTable, pmReserved \
4040
= struct.unpack("lhhhhhhhlllhhhhlll", data)
41-
print 'Base: 0x%x'%baseAddr
42-
print 'rowBytes: %d (0x%x)'%(rowBytes&0x3fff, rowBytes)
43-
print 'rect: %d, %d, %d, %d'%(t, l, b, r)
44-
print 'pmVersion: 0x%x'%pmVersion
45-
print 'packing: %d %d'%(packType, packSize)
46-
print 'resolution: %f x %f'%(float(hRes)/0x10000, float(vRes)/0x10000)
47-
print 'pixeltype: %d, size %d'%(pixelType, pixelSize)
48-
print 'components: %d, size %d'%(cmpCount, cmpSize)
49-
print 'planeBytes: %d (0x%x)'%(planeBytes, planeBytes)
50-
print 'pmTable: 0x%x'%pmTable
51-
print 'pmReserved: 0x%x'%pmReserved
41+
print('Base: 0x%x'%baseAddr)
42+
print('rowBytes: %d (0x%x)'%(rowBytes&0x3fff, rowBytes))
43+
print('rect: %d, %d, %d, %d'%(t, l, b, r))
44+
print('pmVersion: 0x%x'%pmVersion)
45+
print('packing: %d %d'%(packType, packSize))
46+
print('resolution: %f x %f'%(float(hRes)/0x10000, float(vRes)/0x10000))
47+
print('pixeltype: %d, size %d'%(pixelType, pixelSize))
48+
print('components: %d, size %d'%(cmpCount, cmpSize))
49+
print('planeBytes: %d (0x%x)'%(planeBytes, planeBytes))
50+
print('pmTable: 0x%x'%pmTable)
51+
print('pmReserved: 0x%x'%pmReserved)
5252
for i in range(0, len(data), 16):
5353
for j in range(16):
5454
if i + j < len(data):
55-
print '%02.2x'%ord(data[i+j]),
56-
print
55+
print('%02.2x'%ord(data[i+j]), end=' ')
56+
print()

Mac/Demo/quicktime/VerySimplePlayer.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# XXXX maxbounds = (40, 40, 1000, 1000)
1919

2020
def main():
21-
print 'hello world' # XXXX
21+
print('hello world') # XXXX
2222
# skip the toolbox initializations, already done
2323
# XXXX Should use gestalt here to check for quicktime version
2424
Qt.EnterMovies()
@@ -75,7 +75,7 @@ def main():
7575
whichWindow = Win.WhichWindow(message)
7676
if not whichWindow:
7777
# Probably the console window. Print something, hope it helps.
78-
print 'update'
78+
print('update')
7979
else:
8080
Qd.SetPort(whichWindow)
8181
whichWindow.BeginUpdate()

Mac/Demo/resources/copyres.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,23 @@ def copyres(src, dst):
3434
id, type, name = res.GetResInfo()
3535
size = res.SizeResource()
3636
attrs = res.GetResAttrs()
37-
print id, type, name, size, hex(attrs)
37+
print(id, type, name, size, hex(attrs))
3838
res.DetachResource()
3939
UseResFile(output)
4040
try:
4141
res2 = Get1Resource(type, id)
4242
except (RuntimeError, Res.Error) as msg:
4343
res2 = None
4444
if res2:
45-
print "Duplicate type+id, not copied"
45+
print("Duplicate type+id, not copied")
4646
print (res2.size, res2.data)
47-
print res2.GetResInfo()
47+
print(res2.GetResInfo())
4848
if res2.HomeResFile() == output:
4949
'OK'
5050
elif res2.HomeResFile() == input:
5151
'BAD!'
5252
else:
53-
print 'Home:', res2.HomeResFile()
53+
print('Home:', res2.HomeResFile())
5454
else:
5555
res.AddResource(type, id, name)
5656
#res.SetResAttrs(attrs)

Mac/Demo/resources/listres.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def list1resources():
77
ntypes = Res.Count1Types()
88
for itype in range(1, 1+ntypes):
99
type = Res.Get1IndType(itype)
10-
print "Type:", repr(type)
10+
print("Type:", repr(type))
1111
nresources = Res.Count1Resources(type)
1212
for i in range(1, 1 + nresources):
1313
Res.SetResLoad(0)
@@ -19,7 +19,7 @@ def listresources():
1919
ntypes = Res.CountTypes()
2020
for itype in range(1, 1+ntypes):
2121
type = Res.GetIndType(itype)
22-
print "Type:", repr(type)
22+
print("Type:", repr(type))
2323
nresources = Res.CountResources(type)
2424
for i in range(1, 1 + nresources):
2525
Res.SetResLoad(0)
@@ -28,7 +28,7 @@ def listresources():
2828
info(res)
2929

3030
def info(res):
31-
print res.GetResInfo(), res.SizeResource(), decodeattrs(res.GetResAttrs())
31+
print(res.GetResInfo(), res.SizeResource(), decodeattrs(res.GetResAttrs()))
3232

3333
attrnames = {
3434
resChanged: 'Changed',
@@ -51,9 +51,9 @@ def decodeattrs(attrs):
5151
return names
5252

5353
def test():
54-
print "=== Local resourcess ==="
54+
print("=== Local resourcess ===")
5555
list1resources()
56-
print "=== All resources ==="
56+
print("=== All resources ===")
5757
listresources()
5858

5959
if __name__ == '__main__':

0 commit comments

Comments
 (0)