You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/games-fps/doomsday/files/doomsday-1.9.8-2to3.patch

310 lines
12 KiB

--- ./build/mac/createfont_osx.py (original)
+++ ./build/mac/createfont_osx.py (refactored)
@@ -36,7 +36,7 @@
def _getBitmapImageRep(size, hasAlpha=True):
- width, height = map(int, size)
+ width, height = list(map(int, size))
return NSBitmapImageRep.alloc().initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bytesPerRow_bitsPerPixel_(None, width, height, 8, 4, hasAlpha, False, NSDeviceRGBColorSpace, width*4, 32)
@@ -55,7 +55,7 @@
def filter_range(n):
offset = 1 # - int(n/5)
- return range(-n/2 + offset, n/2 + offset)
+ return list(range(-n/2 + offset, n/2 + offset))
class SysFont(object):
@@ -79,7 +79,7 @@
self._isBold and 'Bold' or '',
self._isOblique and 'Oblique' or '')
self._font = NSFont.fontWithName_size_(name, self._size)
- print name, self._font
+ print(name, self._font)
if self._font is None:
if self._isBold:
self._font = NSFont.boldSystemFontOfSize(self._size)
@@ -121,10 +121,10 @@
self._isUnderline = isUnderline
def size(self, text):
- return tuple(map(int,map(math.ceil, NSString.sizeWithAttributes_(text, {
+ return tuple(map(int,list(map(math.ceil, NSString.sizeWithAttributes_(text, {
NSFontAttributeName: self._font,
NSUnderlineStyleAttributeName: self._isUnderline and 1.0 or 0,
- }))))
+ })))))
def advancement(self, glyph):
return tuple(self._font.advancementForGlyph_(ord(glyph)))
@@ -196,7 +196,7 @@
[6, 36, 90, 120, 90, 36, 6],
[1, 6, 15, 20, 15, 6, 1]]
else:
- print "factors for filter size", filter_size, "not defined!"
+ print("factors for filter size", filter_size, "not defined!")
factors = 0
# Filter a shadow.
@@ -269,7 +269,7 @@
if __name__=='__main__':
if len(sys.argv) < 5:
- print "usage: " + sys.argv[0] + " (font-name) (font-size) (texture-width) (output-file)"
+ print("usage: " + sys.argv[0] + " (font-name) (font-size) (texture-width) (output-file)")
sys.exit(0)
out_filename = sys.argv[4]
@@ -286,17 +286,17 @@
texture_width = int(sys.argv[3])
font_point_height = s.get_height()
- print "Font texture width =", texture_width
- print "Line height =", font_point_height, "pt"
- print "Font size =", point_size, "pt"
+ print("Font texture width =", texture_width)
+ print("Line height =", font_point_height, "pt")
+ print("Font size =", point_size, "pt")
ascent = s.get_ascent()
descent = s.get_descent()
- print "Ascent =", ascent, "pt Descent =", descent, "pt"
-
- print "Shadow filter is sized %i for this font." % s.shadow_filter_size()
+ print("Ascent =", ascent, "pt Descent =", descent, "pt")
+
+ print("Shadow filter is sized %i for this font." % s.shadow_filter_size())
border_size = s.border_size()
- print "Glyph borders are %i pixels wide." % border_size
+ print("Glyph borders are %i pixels wide." % border_size)
rover = (0, 0)
line_height = 0
@@ -304,7 +304,7 @@
used_pixels = 0
# Only the basic ASCII set, and some specific characters.
- char_range = range(0x20, 0x7F) + [0x96, 0x97, 0xA3, 0xA4, 0xA9, 0xB0, 0xB1]
+ char_range = list(range(0x20, 0x7F)) + [0x96, 0x97, 0xA3, 0xA4, 0xA9, 0xB0, 0xB1]
for code in char_range:
glyph = Glyph(code)
try:
@@ -320,7 +320,7 @@
# No, move to the new row.
rover = (0, rover[1] + line_height)
texture_height += line_height
- print "Finished a %i pixels tall line." % line_height
+ print("Finished a %i pixels tall line." % line_height)
line_height = 0
glyph.pos = rover
@@ -332,20 +332,20 @@
glyphs.append(glyph)
#except Exception, x:
except KeyboardInterrupt:
- print "Code %i: Failed to render." % code
- print x
-
- print "Finished rendering %i glyphs." % len(glyphs)
+ print("Code %i: Failed to render." % code)
+ print(x)
+
+ print("Finished rendering %i glyphs." % len(glyphs))
actual_line_height = glyphs[0].dims[1] - border_size*2
- print "Actual line height is %i pixels." % actual_line_height
-
- print "Size of the finished texture is %i x %i." % (texture_width, texture_height)
+ print("Actual line height is %i pixels." % actual_line_height)
+
+ print("Size of the finished texture is %i x %i." % (texture_width, texture_height))
actual_height = pow2(texture_height)
total_pixels = texture_width * actual_height
- print "Unused texture area: %.2f %%" % (100*(1.0 - used_pixels/float(total_pixels)))
- print "Writing output to file: %s" % out_filename
+ print("Unused texture area: %.2f %%" % (100*(1.0 - used_pixels/float(total_pixels))))
+ print("Writing output to file: %s" % out_filename)
out = file(out_filename, 'wb')
@@ -365,10 +365,10 @@
scale = float(actual_line_height) / font_point_height
pixel_ascent = int(math.ceil(scale * ascent))
pixel_descent = int(math.ceil(scale * descent))
- print " Pixel ascent/descent:", pixel_ascent, '/', pixel_descent
+ print(" Pixel ascent/descent:", pixel_ascent, '/', pixel_descent)
pixel_line_height = int(scale * font_point_height)
- print " Pixel line height:", pixel_line_height
+ print(" Pixel line height:", pixel_line_height)
# Ascent and descent.
out.write(struct.pack('<HHH', pixel_line_height, pixel_ascent, pixel_descent))
@@ -379,7 +379,7 @@
g.dims[0], g.dims[1]))
# Glyph map.
- print " Writing glyph map..."
+ print(" Writing glyph map...")
for y in range(texture_height):
for x in range(texture_width):
pixel = find_pixel(glyphs, x, y)
--- ./build/scripts/packres.py (original)
+++ ./build/scripts/packres.py (refactored)
@@ -6,8 +6,8 @@
import sys, os, os.path, zipfile
if len(sys.argv) < 2:
- print "Usage: %s pk3-target-dir" % sys.argv[0]
- print "(run in build/scripts/)"
+ print("Usage: %s pk3-target-dir" % sys.argv[0])
+ print("(run in build/scripts/)")
sys.exit(0)
# Check quiet flag.
@@ -27,7 +27,7 @@
self.files += fileNamesArray
def msg(self, text):
- if not quietMode: print text
+ if not quietMode: print(text)
def create(self, name):
full_name = os.path.join(target_dir, name)
@@ -61,7 +61,7 @@
process_dir(full_src, dest)
# Write it out.
- print "Created %s (with %i files)." % (os.path.normpath(full_name), len(pk3.namelist()))
+ print("Created %s (with %i files)." % (os.path.normpath(full_name), len(pk3.namelist())))
pk3.close()
# First up, doomsday.pk3.
--- ./build/scripts/wadcompiler.py (original)
+++ ./build/scripts/wadcompiler.py (refactored)
@@ -49,7 +49,7 @@
self.type = self.file.read(4)
count = struct.unpack('<I', self.file.read(4))[0]
info_offset = struct.unpack('<I', self.file.read(4))[0]
- print "%s, type=%s, count=%i, info_offset=%i" % (self.file_name, self.type, count, info_offset)
+ print("%s, type=%s, count=%i, info_offset=%i" % (self.file_name, self.type, count, info_offset))
self.lumps = []
# Read the info table.
self.file.seek(info_offset)
@@ -68,7 +68,7 @@
self.lumps.append( Lump(info[2], data, info[0]) )
def write(self):
- print 'writing', self.file_name
+ print('writing', self.file_name)
self.file.truncate()
self.file.seek(0)
# Type.
@@ -104,17 +104,17 @@
def set_type(self, new_type):
if len(new_type) != 4:
- print "'%s' is not a valid type. Must have 4 chars." % new_type
+ print("'%s' is not a valid type. Must have 4 chars." % new_type)
else:
- print 'setting type to %s' % new_type
+ print('setting type to %s' % new_type)
self.type = new_type
def list(self):
for i in range(len(self.lumps)):
lump = self.lumps[i]
- print "%5i -- %-8s (at %8i, %8i bytes)" % (i, lump.name, lump.offset,
- len(lump.data))
- print "%i lumps total." % len(self.lumps)
+ print("%5i -- %-8s (at %8i, %8i bytes)" % (i, lump.name, lump.offset,
+ len(lump.data)))
+ print("%i lumps total." % len(self.lumps))
def insert(self, at_lump, names):
# Where to insert?
@@ -128,13 +128,13 @@
at = i
break
if at == -1:
- print "could not find insert point, aborting"
+ print("could not find insert point, aborting")
return
- print "inserting at index %i..." % at
+ print("inserting at index %i..." % at)
for name in names:
real, arch = split_name(name)
- print "inserting %s as %s" % (real, valid_lump_name(arch))
+ print("inserting %s as %s" % (real, valid_lump_name(arch)))
self.lumps.insert(at, Lump(valid_lump_name(arch),
file(real, 'rb').read(), 0))
@@ -164,28 +164,28 @@
break
else:
nice_name += ext
- print "extracting", lump.name, "(%i bytes) as %s" % (len(lump.data), nice_name)
+ print("extracting", lump.name, "(%i bytes) as %s" % (len(lump.data), nice_name))
f = file(nice_name, 'wb')
f.write(lump.data)
f.close()
def usage():
- print 'Usage: %s [command] [wad] [files]' % sys.argv[0]
- print 'command = l(ist) | c(reate PWAD) | C(reate IWAD) | x(tract) | a(ppend) | i(nsert) | t(ype)'
- print 'Examples:'
- print '%s l some.wad' % sys.argv[0]
- print '%s c new.wad LUMP1 LUMP2 LUMP3' % sys.argv[0]
- print '%s i LUMP2 some.wad LUMP5 LUMP6 LUMP7 (at LUMP2)' % sys.argv[0]
- print '%s a existing.wad LUMP4 LUMP5' % sys.argv[0]
- print '%s x existing.wad (extracts all lumps)' % sys.argv[0]
- print '%s x existing.wad LUMP4 (extracts selected lumps)' % sys.argv[0]
- print '%s t existing.wad IWAD' % sys.argv[0]
- print 'You can specify files as realfilename@LUMPNAME.'
+ print('Usage: %s [command] [wad] [files]' % sys.argv[0])
+ print('command = l(ist) | c(reate PWAD) | C(reate IWAD) | x(tract) | a(ppend) | i(nsert) | t(ype)')
+ print('Examples:')
+ print('%s l some.wad' % sys.argv[0])
+ print('%s c new.wad LUMP1 LUMP2 LUMP3' % sys.argv[0])
+ print('%s i LUMP2 some.wad LUMP5 LUMP6 LUMP7 (at LUMP2)' % sys.argv[0])
+ print('%s a existing.wad LUMP4 LUMP5' % sys.argv[0])
+ print('%s x existing.wad (extracts all lumps)' % sys.argv[0])
+ print('%s x existing.wad LUMP4 (extracts selected lumps)' % sys.argv[0])
+ print('%s t existing.wad IWAD' % sys.argv[0])
+ print('You can specify files as realfilename@LUMPNAME.')
# Call main function.
-print 'WAD Compiler by skyjake@users.sourceforge.net'
-print '$Date$'
+print('WAD Compiler by skyjake@users.sourceforge.net')
+print('$Date$')
# Check the args.
if len(sys.argv) < 3:
@@ -219,7 +219,7 @@
try:
wad = Wad(wad_name, mode)
except:
- print 'Failure to open %s.' % wad_name
+ print('Failure to open %s.' % wad_name)
import traceback
traceback.print_exc()
sys.exit(2)
--- ./engine/scripts/makedmt.py (original)
+++ ./engine/scripts/makedmt.py (refactored)
@@ -118,7 +118,7 @@
# Translate the type into a real C type.
if '_s' in c_type:
c_type = 'struct ' + c_type
- for symbol, real in type_replacements.items():
+ for symbol, real in list(type_replacements.items()):
c_type = c_type.replace(symbol, real)
# Add some visual padding to align the members.