libretro-mame2016: fix build with Python 3.9

This commit is contained in:
heitbaum 2022-02-14 11:13:00 +00:00
parent acc9f0567a
commit 6108b3e5f3

View File

@ -0,0 +1,27 @@
From d28c5e3ee58220ec6e17b92be5db0e62101d68b7 Mon Sep 17 00:00:00 2001
From: Thiago Kenji Okada <thiagokokada@gmail.com>
Date: Mon, 6 Dec 2021 11:20:25 -0300
Subject: [PATCH] Fix build on Python 3.9+
array.array.tostring was deprecated since Python 3.2, finally removed on
Python 3.9.
---
scripts/build/msgfmt.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/build/msgfmt.py b/scripts/build/msgfmt.py
index deb02ae32b..97d30f4c08 100644
--- a/scripts/build/msgfmt.py
+++ b/scripts/build/msgfmt.py
@@ -112,7 +112,10 @@ def generate():
7*4, # start of key index
7*4+len(keys)*8, # start of value index
0, 0) # size and offset of hash table
- output += array.array("i", offsets).tostring()
+ if sys.version_info[1] >= 2:
+ output += array.array("i", offsets).tobytes()
+ else:
+ output += array.array("i", offsets).tostring()
output += ids
output += strs
return output