util: Fix cpt_upgrader

This had multiple issues related to the upgrade
to Python 3.

Change-Id: Iebac5618a05d7c3ad08b34652bf2ba08a82b5948
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44105
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
This commit is contained in:
Daniel R. Carvalho
2021-04-03 21:18:24 -03:00
committed by Daniel Carvalho
parent 667cad35db
commit 1525ee8cdd

View File

@@ -193,14 +193,14 @@ def process_file(path, **kwargs):
import shutil
shutil.copyfile(path, path + '.bak')
cpt = configparser.SafeConfigParser()
cpt = configparser.ConfigParser()
# gem5 is case sensitive with paramaters
cpt.optionxform = str
# Read the current data
cpt_file = file(path, 'r')
cpt.readfp(cpt_file)
cpt_file = open(path, 'r')
cpt.read_file(cpt_file)
cpt_file.close()
change = False
@@ -257,7 +257,7 @@ def process_file(path, **kwargs):
# Write the old data back
verboseprint("...completed")
cpt.write(file(path, 'w'))
cpt.write(open(path, 'w'))
if __name__ == '__main__':
from optparse import OptionParser, SUPPRESS_HELP