141 lines
5.6 KiB
Diff
141 lines
5.6 KiB
Diff
|
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>
|
||
|
---
|
||
|
Makefile | 2 +-
|
||
|
scripts/acpi_extract.py | 2 +-
|
||
|
scripts/acpi_extract_preprocess.py | 2 +-
|
||
|
scripts/acpi_extract.py | 2 +-
|
||
|
scripts/layoutrom.py | 28 ++++++++++++++--------------
|
||
|
scripts/vgafixup.py | 2 +-
|
||
|
6 files changed, 19 insertions(+), 19 deletions(-)
|
||
|
|
||
|
--- a/Makefile
|
||
|
+++ b/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
|
||
|
--- a/scripts/acpi_extract.py
|
||
|
+++ b/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.
|
||
|
--- a/scripts/acpi_extract_preprocess.py
|
||
|
+++ b/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.
|
||
|
--- a/scripts/acpi_extract.py
|
||
|
+++ b/scripts/acpi_extract.py
|
||
|
@@ -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 = []
|
||
|
--- a/scripts/layoutrom.py
|
||
|
+++ b/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, exports
|
||
|
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,
|
||
|
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
|
||
|
--- a/scripts/vgafixup.py
|
||
|
+++ b/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')
|