libretro.mame2016: fix build on Python 3.11+

Since Python 3.11, `open()` etc. no longer accept `U` flag.

+75
+1
pkgs/applications/emulators/retroarch/cores.nix
··· 582 582 583 583 mame2016 = mkLibretroCore { 584 584 core = "mame2016"; 585 + patches = [ ./patches/mame2016-python311.patch ]; 585 586 extraNativeBuildInputs = [ python3 ]; 586 587 extraBuildInputs = [ alsa-lib ]; 587 588 makeFlags = [ "PYTHON_EXECUTABLE=python3" ];
+74
pkgs/applications/emulators/retroarch/patches/mame2016-python311.patch
··· 1 + diff --git a/scripts/build/verinfo.py b/scripts/build/verinfo.py 2 + index a73d8ad268..82a80c0984 100644 3 + --- a/scripts/build/verinfo.py 4 + +++ b/scripts/build/verinfo.py 5 + @@ -63,7 +63,7 @@ def extract_version(input): 6 + build, outfmt, srcfile, dstfile = parse_args() 7 + 8 + try: 9 + - fp = open(srcfile, 'rU') 10 + + fp = open(srcfile, 'r') 11 + except IOError: 12 + sys.stderr.write("Unable to open source file '%s'\n" % srcfile) 13 + sys.exit(1) 14 + diff --git a/src/devices/cpu/m6502/m6502make.py b/src/devices/cpu/m6502/m6502make.py 15 + index 8bcd85f8e2..557b175966 100755 16 + --- a/src/devices/cpu/m6502/m6502make.py 17 + +++ b/src/devices/cpu/m6502/m6502make.py 18 + @@ -18,7 +18,7 @@ def load_opcodes(fname): 19 + opcodes = [] 20 + logging.info("load_opcodes: %s", fname) 21 + try: 22 + - f = open(fname, "rU") 23 + + f = open(fname, "r") 24 + except Exception: 25 + err = sys.exc_info()[1] 26 + logging.error("cannot read opcodes file %s [%s]", fname, err) 27 + @@ -41,7 +41,7 @@ def load_disp(fname): 28 + logging.info("load_disp: %s", fname) 29 + states = [] 30 + try: 31 + - f = open(fname, "rU") 32 + + f = open(fname, "r") 33 + except Exception: 34 + err = sys.exc_info()[1] 35 + logging.error("cannot read display file %s [%s]", fname, err) 36 + diff --git a/src/devices/cpu/m6809/m6809make.py b/src/devices/cpu/m6809/m6809make.py 37 + index 8838b96019..e1ea25db06 100644 38 + --- a/src/devices/cpu/m6809/m6809make.py 39 + +++ b/src/devices/cpu/m6809/m6809make.py 40 + @@ -16,7 +16,7 @@ def load_file(fname, lines): 41 + if path != "": 42 + path += '/' 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/mcs96/mcs96make.py b/src/devices/cpu/mcs96/mcs96make.py 50 + index b4844942e3..207208d2b6 100644 51 + --- a/src/devices/cpu/mcs96/mcs96make.py 52 + +++ b/src/devices/cpu/mcs96/mcs96make.py 53 + @@ -73,7 +73,7 @@ def __init__(self, fname, is_196): 54 + self.ea = {} 55 + self.macros = {} 56 + try: 57 + - f = open(fname, "rU") 58 + + f = open(fname, "r") 59 + except Exception: 60 + err = sys.exc_info()[1] 61 + sys.stderr.write("Cannot read opcodes file %s [%s]\n" % (fname, err)) 62 + diff --git a/src/devices/cpu/tms57002/tmsmake.py b/src/devices/cpu/tms57002/tmsmake.py 63 + index e2e12b5a4b..942ec09537 100755 64 + --- a/src/devices/cpu/tms57002/tmsmake.py 65 + +++ b/src/devices/cpu/tms57002/tmsmake.py 66 + @@ -323,7 +323,7 @@ def AddInfo(self, line): 67 + def LoadLst(filename): 68 + instructions = [] 69 + ins = None 70 + - for n, line in enumerate(open(filename, "rU")): 71 + + for n, line in enumerate(open(filename, "r")): 72 + line = line.rstrip() 73 + if not line and ins: 74 + # new lines separate intructions