mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-22 11:40:06 +02:00
udis86: use python3 for the build/tests. (#10122)
Patches for Python 3 compatibility, taken from: https://salsa.debian.org/debian/libudis86/-/tree/master/debian/patches
This commit is contained in:
127
dev-libs/udis86/patches/0001-fixes-for-python3.patch
Normal file
127
dev-libs/udis86/patches/0001-fixes-for-python3.patch
Normal file
@@ -0,0 +1,127 @@
|
||||
From: Robert Haist <rhaist@mailbox.org>
|
||||
Date: Mon, 14 May 2018 22:52:22 +0200
|
||||
Subject: fixes for python3
|
||||
|
||||
---
|
||||
scripts/ud_itab.py | 14 +++++++-------
|
||||
scripts/ud_opcode.py | 14 +++++++-------
|
||||
scripts/ud_optable.py | 10 +++++-----
|
||||
3 files changed, 19 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/scripts/ud_itab.py b/scripts/ud_itab.py
|
||||
index b17fe69..6d71f90 100644
|
||||
--- a/scripts/ud_itab.py
|
||||
+++ b/scripts/ud_itab.py
|
||||
@@ -214,7 +214,7 @@ class UdItabGenerator( ud_opcode.UdOpcodeTables ):
|
||||
e = self.InvalidEntry
|
||||
i = self.InvalidEntryIdx
|
||||
|
||||
- if idx in table[ 'entries' ].keys():
|
||||
+ if idx in list(table[ 'entries' ].keys()):
|
||||
e = table[ 'entries' ][ idx ]
|
||||
|
||||
# leaf node (insn)
|
||||
@@ -265,14 +265,14 @@ class UdItabGenerator( ud_opcode.UdOpcodeTables ):
|
||||
pfx_c = []
|
||||
opr = e[ 'operands' ]
|
||||
for i in range(len(opr)):
|
||||
- if not (opr[i] in self.OperandDict.keys()):
|
||||
- print("error: invalid operand declaration: %s\n" % opr[i])
|
||||
+ if not (opr[i] in list(self.OperandDict.keys())):
|
||||
+ print(("error: invalid operand declaration: %s\n" % opr[i]))
|
||||
opr_c[i] = "O_" + opr[i]
|
||||
opr = "%s %s %s" % (opr_c[0] + ",", opr_c[1] + ",", opr_c[2])
|
||||
|
||||
for p in e['prefixes']:
|
||||
- if not ( p in self.PrefixDict.keys() ):
|
||||
- print("error: invalid prefix specification: %s \n" % pfx)
|
||||
+ if not ( p in list(self.PrefixDict.keys()) ):
|
||||
+ print(("error: invalid prefix specification: %s \n" % pfx))
|
||||
pfx_c.append( self.PrefixDict[p] )
|
||||
if len(e['prefixes']) == 0:
|
||||
pfx_c.append( "P_none" )
|
||||
@@ -301,7 +301,7 @@ class UdItabGenerator( ud_opcode.UdOpcodeTables ):
|
||||
# table type enumeration
|
||||
self.ItabH.write( "/* ud_table_type -- lookup table types (see decode.c) */\n" )
|
||||
self.ItabH.write( "enum ud_table_type {\n " )
|
||||
- enum = [ self.TableInfo[ k ][ 'name' ] for k in self.TableInfo.keys() ]
|
||||
+ enum = [ self.TableInfo[ k ][ 'name' ] for k in list(self.TableInfo.keys()) ]
|
||||
self.ItabH.write( ",\n ".join( enum ) )
|
||||
self.ItabH.write( "\n};\n\n" );
|
||||
|
||||
@@ -336,7 +336,7 @@ class UdItabGenerator( ud_opcode.UdOpcodeTables ):
|
||||
# Macros defining short-names for operands
|
||||
#
|
||||
self.ItabC.write("\n\n/* itab entry operand definitions (for readability) */\n");
|
||||
- operands = self.OperandDict.keys()
|
||||
+ operands = list(self.OperandDict.keys())
|
||||
operands = sorted(operands)
|
||||
for o in operands:
|
||||
self.ItabC.write("#define O_%-7s { %-12s %-8s }\n" %
|
||||
diff --git a/scripts/ud_opcode.py b/scripts/ud_opcode.py
|
||||
index 70cd226..8cc1b3f 100644
|
||||
--- a/scripts/ud_opcode.py
|
||||
+++ b/scripts/ud_opcode.py
|
||||
@@ -130,8 +130,8 @@ class UdOpcodeTables:
|
||||
'/mod' : lambda v: '00' if v == '!11' else '01',
|
||||
# Mode extensions:
|
||||
# (16, 32, 64) => (00, 01, 02)
|
||||
- '/o' : lambda v: "%02x" % (int(v) / 32),
|
||||
- '/a' : lambda v: "%02x" % (int(v) / 32),
|
||||
+ '/o' : lambda v: "%02x" % int(int(v) / 32),
|
||||
+ '/a' : lambda v: "%02x" % int(int(v) / 32),
|
||||
'/m' : lambda v: '00' if v == '!64' else '01',
|
||||
# SSE
|
||||
'/sse' : lambda v: UdOpcodeTables.OpcExtIndex['sse'][v],
|
||||
@@ -226,17 +226,17 @@ class UdOpcodeTables:
|
||||
raise
|
||||
|
||||
def print_table( self, table, pfxs ):
|
||||
- print("%s |" % pfxs)
|
||||
- keys = table[ 'entries' ].keys()
|
||||
+ print(("%s |" % pfxs))
|
||||
+ keys = list(table[ 'entries' ].keys())
|
||||
if ( len( keys ) ):
|
||||
keys.sort()
|
||||
for idx in keys:
|
||||
e = table[ 'entries' ][ idx ]
|
||||
if e[ 'type' ] == 'insn':
|
||||
- print("%s |-<%s>" % ( pfxs, idx )),
|
||||
- print("%s %s" % ( e[ 'mnemonic' ], ' '.join( e[ 'operands'] ) ))
|
||||
+ print(("%s |-<%s>" % ( pfxs, idx )), end=' ')
|
||||
+ print(("%s %s" % ( e[ 'mnemonic' ], ' '.join( e[ 'operands'] ) )))
|
||||
else:
|
||||
- print("%s |-<%s> %s" % ( pfxs, idx, e['type'] ))
|
||||
+ print(("%s |-<%s> %s" % ( pfxs, idx, e['type'] )))
|
||||
self.print_table( e, pfxs + ' |' )
|
||||
|
||||
def print_tree( self ):
|
||||
diff --git a/scripts/ud_optable.py b/scripts/ud_optable.py
|
||||
index e9e0b53..0a51e97 100644
|
||||
--- a/scripts/ud_optable.py
|
||||
+++ b/scripts/ud_optable.py
|
||||
@@ -62,7 +62,7 @@ class UdOptableXmlParser:
|
||||
if not insnNode.localName:
|
||||
continue
|
||||
if insnNode.localName != "instruction":
|
||||
- print("warning: invalid insn node - %s" % insnNode.localName)
|
||||
+ print(("warning: invalid insn node - %s" % insnNode.localName))
|
||||
continue
|
||||
|
||||
mnemonic = insnNode.getElementsByTagName( 'mnemonic' )[ 0 ].firstChild.data
|
||||
@@ -81,11 +81,11 @@ class UdOptableXmlParser:
|
||||
|
||||
|
||||
def printFn( pfx, mnm, opc, opr, ven ):
|
||||
- print('def: ',)
|
||||
+ print(('def: ',))
|
||||
if len( pfx ):
|
||||
- print(' '.join( pfx ),)
|
||||
- print("%s %s %s %s" %
|
||||
- ( mnm, ' '.join( opc ), ' '.join( opr ), ven ))
|
||||
+ print((' '.join( pfx ),))
|
||||
+ print(("%s %s %s %s" %
|
||||
+ ( mnm, ' '.join( opc ), ' '.join( opr ), ven )))
|
||||
|
||||
|
||||
def parse( xml, callback ):
|
||||
Reference in New Issue
Block a user