summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael <kensington@astralcloak.net>2011-08-02 17:02:09 -0400
committerDave Jones <davej@redhat.com>2011-08-02 17:02:09 -0400
commitaa57556f60c89eb84f65cb55e0215ff9be97dbec (patch)
treea044190241853b2ac3ee83daeb978d217a68bf71
parent434e9dadc6b274d2278cd7151a9ca60dfb50cc24 (diff)
Make createheader.py work with python3
As noted on the Gentoo bugzilla (https://bugs.gentoo.org/show_bug.cgi?id=367823) x86info fails to compile with python-3.
-rw-r--r--scripts/createheader.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/scripts/createheader.py b/scripts/createheader.py
index 820a062..fa8b208 100644
--- a/scripts/createheader.py
+++ b/scripts/createheader.py
@@ -39,27 +39,27 @@ import os
progname=os.path.basename(sys.argv[0])
if len(sys.argv) < 3:
- print progname + ": invalid number of argumenst"
- print "\nUSAGE:"
- print progname + " <input file> <struct name>"
- print "\nEXAMPLE:"
- print progname + " k8regs.txt k8 >k8.h"
+ print(progname + ": invalid number of argumenst")
+ print("\nUSAGE:")
+ print(progname + " <input file> <struct name>")
+ print("\nEXAMPLE:")
+ print(progname + " k8regs.txt k8 >k8.h")
sys.exit(1)
f=open(sys.argv[1])
family=sys.argv[2]
-print \
+print(\
"/*\n"\
" * Licensed under the terms of the GNU GENERAL PUBLIC LICENSE version 2.\n"\
" * See file COPYING for details.\n"\
-" */\n"
-print "#ifndef " + family + "_h"
-print "#define " + family + "_h\n"
+" */\n")
+print("#ifndef " + family + "_h")
+print("#define " + family + "_h\n")
if (re.search("/", sys.argv[1])):
- print "#include \"../msr.h\"\n"
+ print("#include \"../msr.h\"\n")
else:
- print "#include \"msr.h\"\n"
+ print("#include \"msr.h\"\n")
struct=[]
for line in f:
if (re.search("^#",line)):
@@ -88,8 +88,8 @@ for line in f:
str1 += "," + e[1]
str1 += ",0);"
str2 += ");"
- print str1
- print str2
+ print(str1)
+ print(str2)
str3 = "_SPEC(" + reg_addr + ", " + reg_name + ", "
if reg_desc != "":
str3 += "\"" + reg_desc + "\", "
@@ -104,10 +104,10 @@ for line in f:
fwidth=field[1].strip()
spec.append([fname, fwidth])
-print "\nstruct reg_spec " + family + "_spec [] = {"
+print("\nstruct reg_spec " + family + "_spec [] = {")
for i in struct:
- print "\t" + i + ","
-print " {0, NULL, NULL, NULL, NULL},"
-print "};\n"
-print "#endif /* " + family + "_h */"
+ print("\t" + i + ",")
+print(" {0, NULL, NULL, NULL, NULL},")
+print("};\n")
+print("#endif /* " + family + "_h */")
f.close()