Ticket #42071: patch-python3-fixes.diff
File patch-python3-fixes.diff, 4.4 KB (added by zpeeters@…, 11 years ago) |
---|
-
src/mapi/mapi/mapi_abi.py
a b 38 38 # number of dynamic entries 39 39 ABI_NUM_DYNAMIC_ENTRIES = 256 40 40 41 from functools import total_ordering 42 @total_ordering 41 43 class ABIEntry(object): 42 44 """Represent an ABI entry.""" 43 45 … … 130 132 res = cmp(self.name, other.name) 131 133 132 134 return res 135 136 def __lt__(self, other): 137 if self.slot == other.slot: 138 if self.alias == other.alias: 139 return self.name < other.name 140 else: 141 return self.alias < other.alias 142 else: 143 return self.slot < other.slot 144 133 145 134 146 def abi_parse_xml(xml): 135 147 """Parse a GLAPI XML file for ABI entries.""" … … 292 304 293 305 # sort entries by their names 294 306 self.entries_sorted_by_names = self.entries[:] 295 self.entries_sorted_by_names.sort( lambda x, y: cmp(x.name, y.name))307 self.entries_sorted_by_names.sort(key=lambda x: x.name) 296 308 297 309 self.indent = ' ' * 3 298 310 self.noop_warn = 'noop_warn' … … 471 483 """Return the string pool for use by stubs.""" 472 484 # sort entries by their names 473 485 sorted_entries = self.entries[:] 474 sorted_entries.sort( lambda x, y: cmp(x.name, y.name))486 sorted_entries.sort(key=lambda x: x.name) 475 487 476 488 pool = [] 477 489 offsets = {} -
src/glsl/builtins/tools/generate_builtins.py
a b 61 61 def run_compiler(args): 62 62 command = [compiler, '--dump-lir'] + args 63 63 p = Popen(command, 1, stdout=PIPE, shell=False) 64 output = p.communicate()[0] 64 output = p.communicate()[0].decode('utf-8') 65 65 66 66 # Clean up output a bit by killing whitespace before a closing paren. 67 67 kill_paren_whitespace = re.compile(r'[ \n]*\)', re.MULTILINE) -
src/mapi/glapi/gen/typeexpr.py
a b 25 25 # Authors: 26 26 # Ian Romanick <idr@us.ibm.com> 27 27 28 import string,copy28 import copy 29 29 30 30 class type_node: 31 31 def __init__(self): … … 125 125 126 126 # Replace '*' with ' * ' in type_string. Then, split the string 127 127 # into tokens, separated by spaces. 128 tokens = string.split( string.replace( type_string, "*", " * " ))128 tokens = type_string.replace("*", " * ").split() 129 129 130 130 const = 0 131 131 t = None -
src/mapi/glapi/gen/gl_XML.py
a b 26 26 # Ian Romanick <idr@us.ibm.com> 27 27 28 28 import libxml2 29 import re, sys , string29 import re, sys 30 30 import typeexpr 31 31 32 32 … … 319 319 320 320 if len(list) == 0: list = ["void"] 321 321 322 return string.join(list, ", ")322 return ", ".join(list) 323 323 324 324 325 325 class gl_item: … … 575 575 list.append( str(s) ) 576 576 577 577 if len(list) > 1 and use_parens : 578 return "(%s)" % ( string.join(list, " * "))578 return "(%s)" % (" * ".join(list)) 579 579 else: 580 return string.join(list, " * ")580 return " * ".join(list) 581 581 582 582 elif self.is_image(): 583 583 return "compsize" -
src/gallium/auxiliary/util/u_format_pack.py
a b 215 215 if type.type == FLOAT: 216 216 return value 217 217 if type.type == FIXED: 218 return int(value * (1 << (type.size/ 2)))218 return int(value * (1 << (type.size//2))) 219 219 if not type.norm: 220 220 return int(value) 221 221 if type.type == UNSIGNED: -
src/gallium/auxiliary/util/u_format_parse.py
a b 77 77 if self.type == FLOAT: 78 78 return VERY_LARGE 79 79 if self.type == FIXED: 80 return (1 << (self.size/ 2)) - 180 return (1 << (self.size//2)) - 1 81 81 if self.norm: 82 82 return 1 83 83 if self.type == UNSIGNED: … … 91 91 if self.type == FLOAT: 92 92 return -VERY_LARGE 93 93 if self.type == FIXED: 94 return -(1 << (self.size/ 2))94 return -(1 << (self.size//2)) 95 95 if self.type == UNSIGNED: 96 96 return 0 97 97 if self.norm: