mirror of
https://github.com/freedoom/freedoom.git
synced 2025-09-02 07:25:45 -04:00
build: Update Python scripts to work with Python 3.
Python 3 makes a number of changes to the language and breaks backward compatibility with Python 2 in some places. This change updates the Python scripts used in the build system to work with Python 3, although the updated scripts still run in Python 2 as well. Most of the changes are minor; the biggest changes are to the palette / colormap generation scripts. Signed-off-by: Simon Howard <fraggle@gmail.com>
This commit is contained in:
parent
8bad55ffef
commit
d6907ea974
5 changed files with 39 additions and 36 deletions
|
@ -48,26 +48,26 @@ def parse_texture_file():
|
|||
|
||||
patches[name] = True
|
||||
|
||||
print "; autogenerated patch list\n"
|
||||
print("; autogenerated patch list\n")
|
||||
|
||||
for name in sorted(patches.keys()):
|
||||
print name
|
||||
print(name)
|
||||
|
||||
# Generate a full list of textures from the files in the
|
||||
# patches/ directory
|
||||
|
||||
def list_all_textures():
|
||||
print "; autogenerated patch list\n"
|
||||
print("; autogenerated patch list\n")
|
||||
|
||||
for filename in sorted(glob.glob("patches/*.gif")):
|
||||
base = os.path.basename(filename)
|
||||
patch_name = base[0:-4]
|
||||
print patch_name
|
||||
print(patch_name)
|
||||
|
||||
if len(sys.argv) == 1:
|
||||
parse_texture_file()
|
||||
elif sys.argv[1] == "-a":
|
||||
list_all_textures()
|
||||
else:
|
||||
print "Usage: extract-pnames.pl [-a]"
|
||||
print("Usage: extract-pnames.py [-a]")
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ def parse_stream(stream):
|
|||
raise Exception("Mismatched #if in '%s'" % stream.name)
|
||||
|
||||
def parse_file(filename):
|
||||
f = file(filename)
|
||||
f = open(filename)
|
||||
|
||||
try:
|
||||
parse_stream(f)
|
||||
|
@ -209,7 +209,7 @@ def read_block(stream, ignore):
|
|||
func(arg)
|
||||
else:
|
||||
if not ignore:
|
||||
print line
|
||||
print(line)
|
||||
|
||||
parse_cmdline()
|
||||
parse_stream(sys.stdin)
|
||||
|
|
|
@ -73,9 +73,9 @@ def find_file(section, name):
|
|||
# Warning header displayed at the top of an output file.
|
||||
|
||||
def print_warning_header():
|
||||
print "; This file is automatically generated."
|
||||
print "; Do not edit it directly!"
|
||||
print
|
||||
print("; This file is automatically generated.")
|
||||
print("; Do not edit it directly!")
|
||||
print("")
|
||||
|
||||
# Remove comments beginning with "#" or ";"
|
||||
|
||||
|
@ -171,7 +171,7 @@ def parse_stream(stream):
|
|||
if match:
|
||||
line = parse_assignment(section, line, match)
|
||||
|
||||
print line
|
||||
print(line)
|
||||
|
||||
# Parse command line options:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue