Skip to content

Commit 9849fd1

Browse files
committed
lr-mame2016: fix build with recent python3
Looks like some deprecation in python3.11 breaks building the Mame/Mess2016 cores due to some codegen including python scripts. Similar to the commit for `lr-mame2016`, allows us to build on the newer Bookworm.
1 parent 9d2d5ab commit 9849fd1

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

scriptmodules/libretrocores/lr-mame2016.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ function depends_lr-mame2016() {
2323

2424
function sources_lr-mame2016() {
2525
gitPullOrClone
26+
applyPatch "${md_path%/*}/lr-mame2016/01-python3-irgen.diff"
2627
}
2728

2829
function build_lr-mame2016() {
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
diff --git a/src/devices/cpu/m6502/m6502make.py b/src/devices/cpu/m6502/m6502make.py
2+
index 8bcd85f8..557b1759 100755
3+
--- a/src/devices/cpu/m6502/m6502make.py
4+
+++ b/src/devices/cpu/m6502/m6502make.py
5+
@@ -18,7 +18,7 @@ def load_opcodes(fname):
6+
opcodes = []
7+
logging.info("load_opcodes: %s", fname)
8+
try:
9+
- f = open(fname, "rU")
10+
+ f = open(fname, "r")
11+
except Exception:
12+
err = sys.exc_info()[1]
13+
logging.error("cannot read opcodes file %s [%s]", fname, err)
14+
@@ -41,7 +41,7 @@ def load_disp(fname):
15+
logging.info("load_disp: %s", fname)
16+
states = []
17+
try:
18+
- f = open(fname, "rU")
19+
+ f = open(fname, "r")
20+
except Exception:
21+
err = sys.exc_info()[1]
22+
logging.error("cannot read display file %s [%s]", fname, err)
23+
diff --git a/src/devices/cpu/m6809/m6809make.py b/src/devices/cpu/m6809/m6809make.py
24+
index 8838b960..e1ea25db 100644
25+
--- a/src/devices/cpu/m6809/m6809make.py
26+
+++ b/src/devices/cpu/m6809/m6809make.py
27+
@@ -16,7 +16,7 @@ def load_file(fname, lines):
28+
if path != "":
29+
path += '/'
30+
try:
31+
- f = open(fname, "rU")
32+
+ f = open(fname, "r")
33+
except Exception:
34+
err = sys.exc_info()[1]
35+
sys.stderr.write("Cannot read opcodes file %s [%s]\n" % (fname, err))
36+
diff --git a/src/devices/cpu/mcs96/mcs96make.py b/src/devices/cpu/mcs96/mcs96make.py
37+
index b4844942..207208d2 100644
38+
--- a/src/devices/cpu/mcs96/mcs96make.py
39+
+++ b/src/devices/cpu/mcs96/mcs96make.py
40+
@@ -73,7 +73,7 @@ class OpcodeList:
41+
self.ea = {}
42+
self.macros = {}
43+
try:
44+
- f = open(fname, "rU")
45+
+ f = open(fname, "r")
46+
except Exception:
47+
err = sys.exc_info()[1]
48+
sys.stderr.write("Cannot read opcodes file %s [%s]\n" % (fname, err))
49+
diff --git a/src/devices/cpu/tms57002/tmsmake.py b/src/devices/cpu/tms57002/tmsmake.py
50+
index e2e12b5a..942ec095 100755
51+
--- a/src/devices/cpu/tms57002/tmsmake.py
52+
+++ b/src/devices/cpu/tms57002/tmsmake.py
53+
@@ -323,7 +323,7 @@ class Instruction:
54+
def LoadLst(filename):
55+
instructions = []
56+
ins = None
57+
- for n, line in enumerate(open(filename, "rU")):
58+
+ for n, line in enumerate(open(filename, "r")):
59+
line = line.rstrip()
60+
if not line and ins:
61+
# new lines separate intructions

scriptmodules/libretrocores/lr-mess2016.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ function depends_lr-mess2016() {
2323

2424
function sources_lr-mess2016() {
2525
gitPullOrClone
26+
applyPatch "${md_path%/*}/lr-mame2016/01-python3-irgen.diff"
2627
}
2728

2829
function build_lr-mess2016() {

0 commit comments

Comments
 (0)