summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Rogers <brogers@suse.com>2019-06-27 10:15:24 -0600
committerSoonKyu Park <sk7.park@samsung.com>2021-11-23 13:46:18 +0900
commit65c7932a6db90f8b3f83e377972254b2afca2320 (patch)
treeccae54f5dd8ad520c1962cd6f6ebca947518acce
parente64f04c1164a6cd0c87d2b730b0c0d38f2d0877f (diff)
downloadqemu-65c7932a6db90f8b3f83e377972254b2afca2320.tar.gz
qemu-65c7932a6db90f8b3f83e377972254b2afca2320.tar.bz2
qemu-65c7932a6db90f8b3f83e377972254b2afca2320.zip
seabios: switch to python3 as needed
Switch to python3 the places where "python2" is explicitly referenced. (Ignore the uses of #!/usr/bin/env python, since that usage does the right thing in our build environment). Include changes proposed by the python3 2to3 tool. Signed-off-by: Bruce Rogers <brogers@suse.com>
-rw-r--r--roms/seabios/Makefile2
-rwxr-xr-xroms/seabios/scripts/acpi_extract.py4
-rwxr-xr-xroms/seabios/scripts/acpi_extract_preprocess.py2
-rwxr-xr-xroms/seabios/scripts/layoutrom.py28
-rw-r--r--roms/seabios/scripts/vgafixup.py2
5 files changed, 19 insertions, 19 deletions
diff --git a/roms/seabios/Makefile b/roms/seabios/Makefile
index 87a6ac92e..edb83b7a1 100644
--- a/roms/seabios/Makefile
+++ b/roms/seabios/Makefile
@@ -22,7 +22,7 @@ LD=$(CROSS_PREFIX)ld
OBJCOPY=$(CROSS_PREFIX)objcopy
OBJDUMP=$(CROSS_PREFIX)objdump
STRIP=$(CROSS_PREFIX)strip
-PYTHON=python2
+PYTHON=python3
CPP=cpp
IASL:=iasl
LD32BIT_FLAG:=-melf_i386
diff --git a/roms/seabios/scripts/acpi_extract.py b/roms/seabios/scripts/acpi_extract.py
index 86c6226c0..7ac054e62 100755
--- a/roms/seabios/scripts/acpi_extract.py
+++ b/roms/seabios/scripts/acpi_extract.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin <mst@redhat.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
@@ -348,7 +348,7 @@ def main():
# Pretty print output
outstrs = ["/* DO NOT EDIT! This is an autogenerated file."
" See scripts/acpi_extract.py. */"]
- for array in output.keys():
+ for array in list(output.keys()):
otype = get_value_type(max(output[array]))
outstrs.append("static unsigned %s %s[] = {" % (otype, array))
odata = []
diff --git a/roms/seabios/scripts/acpi_extract_preprocess.py b/roms/seabios/scripts/acpi_extract_preprocess.py
index b8e92a525..6963847a8 100755
--- a/roms/seabios/scripts/acpi_extract_preprocess.py
+++ b/roms/seabios/scripts/acpi_extract_preprocess.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin <mst@redhat.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
diff --git a/roms/seabios/scripts/layoutrom.py b/roms/seabios/scripts/layoutrom.py
index 6616721d1..c6d003273 100755
--- a/roms/seabios/scripts/layoutrom.py
+++ b/roms/seabios/scripts/layoutrom.py
@@ -81,8 +81,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(key=operator.itemgetter(0))
firstfixed = fixedsections[0][0]
@@ -142,10 +142,10 @@ def fitSections(sections, fillsections):
# Report stats
total = BUILD_BIOS_SIZE-firstfixed
slack = total - totalused
- print ("Fixed space: 0x%x-0x%x total: %d slack: %d"
+ print(("Fixed space: 0x%x-0x%x total: %d slack: %d"
" Percent slack: %.1f%%" % (
firstfixed, BUILD_BIOS_SIZE, total, slack,
- (float(slack) / total) * 100.0))
+ (float(slack) / total) * 100.0)))
return firstfixed + BUILD_BIOS_ADDR
@@ -288,12 +288,12 @@ def doLayout(sections, config, genreloc):
size32flat = sec32fseg_start - sec32flat_start
size32init = sec32flat_start - sec32init_start
sizelow = li.sec32low_end - li.sec32low_start
- print("16bit size: %d" % size16)
- print("32bit segmented size: %d" % size32seg)
- print("32bit flat size: %d" % (size32flat + size32textfseg))
- 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 + size32textfseg)))
+ print(("32bit flat init size: %d" % size32init))
+ print(("Lowmem size: %d" % sizelow))
+ print(("f-segment var size: %d" % size32fseg))
return li
@@ -312,7 +312,7 @@ def outXRefs(sections, useseg=0, exportsyms=[], forcedelta=0):
and (symbol.section.fileid != section.fileid
or symbol.name != reloc.symbolname)):
xrefs[reloc.symbolname] = symbol
- for symbolname, symbol in xrefs.items():
+ for symbolname, symbol in list(xrefs.items()):
loc = symbol.section.finalloc
if useseg:
loc = symbol.section.finalsegloc
@@ -482,8 +482,8 @@ def checkRuntime(reloc, rsection, data, chain):
if section is None or '.init.' in section.name:
return 0
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)
return 1
@@ -691,7 +691,7 @@ def main():
li = doLayout(sections, config, genreloc)
# Exported symbols
- li.varlowsyms = [symbol for symbol in symbols['32flat'].values()
+ li.varlowsyms = [symbol for symbol in list(symbols['32flat'].values())
if (symbol.section is not None
and symbol.section.finalloc is not None
and '.data.varlow.' in symbol.section.name
diff --git a/roms/seabios/scripts/vgafixup.py b/roms/seabios/scripts/vgafixup.py
index 2053cd5d7..dc662480f 100644
--- a/roms/seabios/scripts/vgafixup.py
+++ b/roms/seabios/scripts/vgafixup.py
@@ -29,7 +29,7 @@ re_leal = re.compile(
def handle_leal(sline):
m = re_leal.match(sline[5:])
if m is None or m.group('index') == '%esp':
- print("Unable to fixup leal instruction: %s" % (sline,))
+ print(("Unable to fixup leal instruction: %s" % (sline,)))
sys.exit(-1)
offset, base, index, scale, dest = m.group(
'offset', 'base', 'index', 'scale', 'dest')