Use print function

This commit is contained in:
Brad Walker
2016-06-21 16:27:04 -07:00
committed by Bob Lantz
parent 57abd9baef
commit 70fcc45893
25 changed files with 189 additions and 141 deletions
+2 -1
View File
@@ -40,6 +40,7 @@ Bob Lantz, rlantz@cs.stanford.edu
1/24/2010
"""
from __future__ import print_function
import re, sys
def fixUnderscoreTriplet( match ):
@@ -195,4 +196,4 @@ def convertFromPep8( program ):
return program
if __name__ == '__main__':
print convertFromPep8( sys.stdin.read() )
print( convertFromPep8( sys.stdin.read() ) )
+3 -2
View File
@@ -1,5 +1,6 @@
#!/usr/bin/python
from __future__ import print_function
from subprocess import check_output as co
from sys import exit
@@ -16,8 +17,8 @@ for line in lines.split( '\n' ):
if line and 'Binary' not in line:
fname, fversion = line.split( ':' )
if version != fversion:
print "%s: incorrect version '%s' (should be '%s')" % (
fname, fversion, version )
print( "%s: incorrect version '%s' (should be '%s')" % (
fname, fversion, version ) )
error = True
if error:
+8 -7
View File
@@ -26,6 +26,7 @@ Basic idea:
"""
from __future__ import print_function
import os
from os import stat, path
from stat import ST_MODE, ST_SIZE
@@ -112,9 +113,9 @@ def log( *args, **kwargs ):
msg = ' '.join( str( arg ) for arg in args )
output = '%s [ %.3f ] %s' % ( clocktime, elapsed, msg )
if cr:
print output
print( output )
else:
print output,
print( output, )
# Optionally mirror to LogFile
if type( LogFile ) is file:
if cr:
@@ -202,7 +203,7 @@ def attachNBD( cow, flags='' ):
continue
srun( 'modprobe nbd max-part=64' )
srun( 'qemu-nbd %s -c %s %s' % ( flags, nbd, cow ) )
print
print()
return nbd
raise Exception( "Error: could not find unused /dev/nbdX device" )
@@ -221,7 +222,7 @@ def extractKernel( image, flavor, imageDir=VMImageDir ):
return kernel, initrd
log( '* Extracting kernel to', kernel )
nbd = attachNBD( image, flags='-r' )
print srun( 'partx ' + nbd )
print( srun( 'partx ' + nbd ) )
# Assume kernel is in partition 1/boot/vmlinuz*generic for now
part = nbd + 'p1'
mnt = mkdtemp()
@@ -988,7 +989,7 @@ def parseArgs():
if args.depend:
depend()
if args.list:
print buildFlavorString()
print( buildFlavorString() )
if args.clean:
cleanup()
if args.verbose:
@@ -1009,8 +1010,8 @@ def parseArgs():
Chown = args.chown
for flavor in args.flavor:
if flavor not in isoURLs:
print "Unknown build flavor:", flavor
print buildFlavorString()
print( "Unknown build flavor:", flavor )
print( buildFlavorString() )
break
try:
build( flavor, tests=args.test, pre=args.run, post=args.post,