aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJohannes Krampf <johannes.krampf@googlemail.com>2014-01-12 11:14:54 -0500
committerKevin O'Connor <kevin@koconnor.net>2014-01-20 12:42:43 -0500
commit064fd069ef88aebe0fdf9850dc35bcffcb616763 (patch)
treefbe4c723b603af0811d18f5dd4b71151e3f92cca /scripts
parent24ef4fd0d25d5133ced303eb225eceb08549081f (diff)
downloadseabios-hppa-064fd069ef88aebe0fdf9850dc35bcffcb616763.zip
seabios-hppa-064fd069ef88aebe0fdf9850dc35bcffcb616763.tar.gz
seabios-hppa-064fd069ef88aebe0fdf9850dc35bcffcb616763.tar.bz2
build: Make print statements in scripts python3 compatible.
Signed-off-by: Johannes Krampf <johannes.krampf@googlemail.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkrom.py26
-rwxr-xr-xscripts/checkstack.py12
-rwxr-xr-xscripts/checksum.py2
-rwxr-xr-xscripts/layoutrom.py32
-rwxr-xr-xscripts/readserial.py4
5 files changed, 38 insertions, 38 deletions
diff --git a/scripts/checkrom.py b/scripts/checkrom.py
index aa3dd0d..e724844 100755
--- a/scripts/checkrom.py
+++ b/scripts/checkrom.py
@@ -40,11 +40,11 @@ def main():
if datasize > 128*1024:
finalsize = 256*1024
if datasize > finalsize:
- print "Error! ROM doesn't fit (%d > %d)" % (datasize, finalsize)
- print " You have to either increate the size (CONFIG_ROM_SIZE)"
- print " or turn off some features (such as hardware support not"
- print " needed) to make it fit. Trying a more recent gcc version"
- print " might work too."
+ print("Error! ROM doesn't fit (%d > %d)" % (datasize, finalsize))
+ print(" You have to either increate the size (CONFIG_ROM_SIZE)")
+ print(" or turn off some features (such as hardware support not")
+ print(" needed) to make it fit. Trying a more recent gcc version")
+ print(" might work too.")
sys.exit(1)
# Sanity checks
@@ -52,17 +52,17 @@ def main():
end = symbols['code32flat_end'].offset
expend = layoutrom.BUILD_BIOS_ADDR + layoutrom.BUILD_BIOS_SIZE
if end != expend:
- print "Error! Code does not end at 0x%x (got 0x%x)" % (
- expend, end)
+ print("Error! Code does not end at 0x%x (got 0x%x)" % (
+ expend, end))
sys.exit(1)
if datasize > finalsize:
- print "Error! Code is too big (0x%x vs 0x%x)" % (
- datasize, finalsize)
+ print("Error! Code is too big (0x%x vs 0x%x)" % (
+ datasize, finalsize))
sys.exit(1)
expdatasize = end - start
if datasize != expdatasize:
- print "Error! Unknown extra data (0x%x vs 0x%x)" % (
- datasize, expdatasize)
+ print("Error! Unknown extra data (0x%x vs 0x%x)" % (
+ datasize, expdatasize))
sys.exit(1)
# Fix up CSM Compatibility16 table
@@ -83,10 +83,10 @@ def main():
# Print statistics
runtimesize = end - symbols['code32init_end'].offset
- print "Total size: %d Fixed: %d Free: %d (used %.1f%% of %dKiB rom)" % (
+ print("Total size: %d Fixed: %d Free: %d (used %.1f%% of %dKiB rom)" % (
datasize, runtimesize, finalsize - datasize
, (datasize / float(finalsize)) * 100.0
- , finalsize / 1024)
+ , finalsize / 1024))
# Write final file
f = open(outfile, 'wb')
diff --git a/scripts/checkstack.py b/scripts/checkstack.py
index 23b7c8e..62fef36 100755
--- a/scripts/checkstack.py
+++ b/scripts/checkstack.py
@@ -182,12 +182,12 @@ def calc():
elif insn.startswith('calll'):
noteCall(cur, subfuncs, insnaddr, calladdr, stackusage + 4)
else:
- print "unknown call", ref
+ print("unknown call", ref)
noteCall(cur, subfuncs, insnaddr, calladdr, stackusage)
# Reset stack usage to preamble usage
stackusage = cur[1]
- #print "other", repr(line)
+ #print("other", repr(line))
# Calculate maxstackusage
for funcaddr, info in funcs.items():
@@ -199,7 +199,7 @@ def calc():
funcaddrs = orderfuncs(funcs.keys(), funcs.copy())
# Show all functions
- print OUTPUTDESC
+ print(OUTPUTDESC)
for funcaddr in funcaddrs:
name, basicusage, maxusage, yieldusage, maxyieldusage, count, calls = \
funcs[funcaddr]
@@ -208,15 +208,15 @@ def calc():
yieldstr = ""
if maxyieldusage is not None:
yieldstr = ",%d" % maxyieldusage
- print "\n%s[%d,%d%s]:" % (name, basicusage, maxusage, yieldstr)
+ print("\n%s[%d,%d%s]:" % (name, basicusage, maxusage, yieldstr))
for insnaddr, calladdr, stackusage in calls:
callinfo = funcs.get(calladdr, ("<unknown>", 0, 0, 0, None))
yieldstr = ""
if callinfo[4] is not None:
yieldstr = ",%d" % (stackusage + callinfo[4])
- print " %04s:%-40s [%d+%d,%d%s]" % (
+ print(" %04s:%-40s [%d+%d,%d%s]" % (
insnaddr, callinfo[0], stackusage, callinfo[1]
- , stackusage+callinfo[2], yieldstr)
+ , stackusage+callinfo[2], yieldstr))
def main():
calc()
diff --git a/scripts/checksum.py b/scripts/checksum.py
index 8c7665d..773fa7a 100755
--- a/scripts/checksum.py
+++ b/scripts/checksum.py
@@ -10,7 +10,7 @@ import sys
def main():
data = sys.stdin.read()
ords = map(ord, data)
- print "sum=%x\n" % sum(ords)
+ print("sum=%x\n" % sum(ords))
if __name__ == '__main__':
main()
diff --git a/scripts/layoutrom.py b/scripts/layoutrom.py
index 24cd7a4..c0b325d 100755
--- a/scripts/layoutrom.py
+++ b/scripts/layoutrom.py
@@ -76,8 +76,8 @@ def fitSections(sections, fillsections):
section.finalsegloc = addr
fixedsections.append((addr, section))
if section.align != 1:
- print "Error: Fixed section %s has non-zero alignment (%d)" % (
- section.name, section.align)
+ print("Error: Fixed section %s has non-zero alignment (%d)" % (
+ section.name, section.align))
sys.exit(1)
fixedsections.sort()
firstfixed = fixedsections[0][0]
@@ -106,8 +106,8 @@ def fitSections(sections, fillsections):
addpos = fixedsection.finalsegloc + fixedsection.size
totalused += fixedsection.size
nextfixedaddr = addpos + freespace
-# print "Filling section %x uses %d, next=%x, available=%d" % (
-# fixedsection.finalloc, fixedsection.size, nextfixedaddr, freespace)
+# print("Filling section %x uses %d, next=%x, available=%d" % (
+# fixedsection.finalloc, fixedsection.size, nextfixedaddr, freespace))
while 1:
canfit = None
for fitsection in canrelocate:
@@ -115,8 +115,8 @@ def fitSections(sections, fillsections):
# Can't fit and nothing else will fit.
break
fitnextaddr = alignpos(addpos, fitsection.align) + fitsection.size
-# print "Test %s - %x vs %x" % (
-# fitsection.name, fitnextaddr, nextfixedaddr)
+# print("Test %s - %x vs %x" % (
+# fitsection.name, fitnextaddr, nextfixedaddr))
if fitnextaddr > nextfixedaddr:
# This item can't fit.
continue
@@ -130,9 +130,9 @@ def fitSections(sections, fillsections):
fitsection.finalsegloc = addpos
addpos = fitnextaddr
totalused += fitsection.size
-# print " Adding %s (size %d align %d) pos=%x avail=%d" % (
+# print(" Adding %s (size %d align %d) pos=%x avail=%d" % (
# fitsection[2], fitsection[0], fitsection[1]
-# , fitnextaddr, nextfixedaddr - fitnextaddr)
+# , fitnextaddr, nextfixedaddr - fitnextaddr))
# Report stats
total = BUILD_BIOS_SIZE-firstfixed
@@ -273,12 +273,12 @@ def doLayout(sections, config, genreloc):
size32flat = li.sec32fseg_start - li.sec32flat_start
size32init = li.sec32flat_start - li.sec32init_start
sizelow = sec32low_end - li.sec32low_start
- print "16bit size: %d" % size16
- print "32bit segmented size: %d" % size32seg
- print "32bit flat size: %d" % size32flat
- print "32bit flat init size: %d" % size32init
- print "Lowmem size: %d" % sizelow
- print "f-segment var size: %d" % size32fseg
+ print("16bit size: %d" % size16)
+ print("32bit segmented size: %d" % size32seg)
+ print("32bit flat size: %d" % size32flat)
+ print("32bit flat init size: %d" % size32init)
+ print("Lowmem size: %d" % sizelow)
+ print("f-segment var size: %d" % size32fseg)
return li
@@ -458,8 +458,8 @@ def markRuntime(section, sections, chain=[]):
or '.init.' in section.name or section.fileid != '32flat'):
return
if '.data.varinit.' in section.name:
- print "ERROR: %s is VARVERIFY32INIT but used from %s" % (
- section.name, chain)
+ print("ERROR: %s is VARVERIFY32INIT but used from %s" % (
+ section.name, chain))
sys.exit(1)
section.category = '32flat'
# Recursively mark all sections this section points to
diff --git a/scripts/readserial.py b/scripts/readserial.py
index d85392e..5b40fdc 100755
--- a/scripts/readserial.py
+++ b/scripts/readserial.py
@@ -156,11 +156,11 @@ def main():
try:
import serial
except ImportError:
- print """
+ print("""
Unable to find pyserial package ( http://pyserial.sourceforge.net/ ).
On Linux machines try: yum install pyserial
Or: apt-get install python-serial
-"""
+""")
sys.exit(1)
ser = serial.Serial(serialport, baud, timeout=0)
else: