Failure building with python3

https://bugs.webkit.org/show_bug.cgi?id=106645

Patch by Laszlo Papp <lpapp@kde.org> on 2013-08-23
Reviewed by Benjamin Poulain.

Use print functions instead of python statements to be compatible with python 3.X and 2.7 as well.
Archlinux has been using python3 and that is what causes issues while packaging QtWebKit along with Qt5.

* disassembler/udis86/itab.py:
(UdItabGenerator.genInsnTable):
* disassembler/udis86/ud_opcode.py:
(UdOpcodeTables.print_table):
* disassembler/udis86/ud_optable.py:
(UdOptableXmlParser.parseDef):
(UdOptableXmlParser.parse):
(printFn):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154521 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3be5219c
2013-08-23 Laszlo Papp <lpapp@kde.org>
Failure building with python3
https://bugs.webkit.org/show_bug.cgi?id=106645
Reviewed by Benjamin Poulain.
Use print functions instead of python statements to be compatible with python 3.X and 2.7 as well.
Archlinux has been using python3 and that is what causes issues while packaging QtWebKit along with Qt5.
* disassembler/udis86/itab.py:
(UdItabGenerator.genInsnTable):
* disassembler/udis86/ud_opcode.py:
(UdOpcodeTables.print_table):
* disassembler/udis86/ud_optable.py:
(UdOptableXmlParser.parseDef):
(UdOptableXmlParser.parse):
(printFn):
2013-08-23 Filip Pizlo <fpizlo@apple.com> 2013-08-23 Filip Pizlo <fpizlo@apple.com>
Incorrect TypedArray#set behavior Incorrect TypedArray#set behavior
......
...@@ -268,13 +268,13 @@ class UdItabGenerator( ud_opcode.UdOpcodeTables ): ...@@ -268,13 +268,13 @@ class UdItabGenerator( ud_opcode.UdOpcodeTables ):
opr = e[ 'operands' ] opr = e[ 'operands' ]
for i in range(len(opr)): for i in range(len(opr)):
if not (opr[i] in self.OperandDict.keys()): if not (opr[i] in self.OperandDict.keys()):
print "error: invalid operand declaration: %s\n" % opr[i] print("error: invalid operand declaration: %s\n" % opr[i])
opr_c[i] = "O_" + opr[i] opr_c[i] = "O_" + opr[i]
opr = "%s %s %s" % (opr_c[0] + ",", opr_c[1] + ",", opr_c[2]) opr = "%s %s %s" % (opr_c[0] + ",", opr_c[1] + ",", opr_c[2])
for p in e['prefixes']: for p in e['prefixes']:
if not ( p in self.PrefixDict.keys() ): if not ( p in self.PrefixDict.keys() ):
print "error: invalid prefix specification: %s \n" % pfx print("error: invalid prefix specification: %s \n" % pfx)
pfx_c.append( self.PrefixDict[p] ) pfx_c.append( self.PrefixDict[p] )
if len(e['prefixes']) == 0: if len(e['prefixes']) == 0:
pfx_c.append( "P_none" ) pfx_c.append( "P_none" )
......
...@@ -218,17 +218,17 @@ class UdOpcodeTables: ...@@ -218,17 +218,17 @@ class UdOpcodeTables:
self.parse(self.OpcodeTable0, insn) self.parse(self.OpcodeTable0, insn)
def print_table( self, table, pfxs ): def print_table( self, table, pfxs ):
print "%s |" % pfxs print("%s |" % pfxs)
keys = table[ 'entries' ].keys() keys = table[ 'entries' ].keys()
if ( len( keys ) ): if ( len( keys ) ):
keys.sort() keys.sort()
for idx in keys: for idx in keys:
e = table[ 'entries' ][ idx ] e = table[ 'entries' ][ idx ]
if e[ 'type' ] == 'insn': if e[ 'type' ] == 'insn':
print "%s |-<%s>" % ( pfxs, idx ), print("%s |-<%s>" % ( pfxs, idx )),
print "%s %s" % ( e[ 'mnemonic' ], ' '.join( e[ 'operands'] ) ) print("%s %s" % ( e[ 'mnemonic' ], ' '.join( e[ 'operands'] )))
else: else:
print "%s |-<%s> %s" % ( pfxs, idx, e['type'] ) print("%s |-<%s> %s" % ( pfxs, idx, e['type'] ))
self.print_table( e, pfxs + ' |' ) self.print_table( e, pfxs + ' |' )
def print_tree( self ): def print_tree( self ):
......
...@@ -50,7 +50,7 @@ class UdOptableXmlParser: ...@@ -50,7 +50,7 @@ class UdOptableXmlParser:
elif def_node.localName == 'vendor': elif def_node.localName == 'vendor':
ven = ( def_node.firstChild.data ); ven = ( def_node.firstChild.data );
else: else:
print "warning: invalid node - %s" % def_node.localName print("warning: invalid node - %s" % def_node.localName)
continue continue
return ( pfx, opc, opr, ven ) return ( pfx, opc, opr, ven )
...@@ -65,7 +65,7 @@ class UdOptableXmlParser: ...@@ -65,7 +65,7 @@ class UdOptableXmlParser:
if not insnNode.localName: if not insnNode.localName:
continue continue
if insnNode.localName != "instruction": if insnNode.localName != "instruction":
print "warning: invalid insn node - %s" % insnNode.localName print("warning: invalid insn node - %s" % insnNode.localName)
continue continue
mnemonic = insnNode.getElementsByTagName( 'mnemonic' )[ 0 ].firstChild.data mnemonic = insnNode.getElementsByTagName( 'mnemonic' )[ 0 ].firstChild.data
...@@ -84,11 +84,11 @@ class UdOptableXmlParser: ...@@ -84,11 +84,11 @@ class UdOptableXmlParser:
def printFn( pfx, mnm, opc, opr, ven ): def printFn( pfx, mnm, opc, opr, ven ):
print 'def: ', print('def: '),
if len( pfx ): if len( pfx ):
print ' '.join( pfx ), print(' '.join( pfx )),
print "%s %s %s %s" % \ print("%s %s %s %s" % \
( mnm, ' '.join( opc ), ' '.join( opr ), ven ) ( mnm, ' '.join( opc ), ' '.join( opr ), ven ))
def parse( xml, callback ): def parse( xml, callback ):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment