mirror of
https://github.com/holub/mame
synced 2025-04-21 07:52:35 +03:00
Get rid of deprecated universal newlines open flag in Python scripts (io module is present as of Python 2.6) (nw)
This commit is contained in:
parent
3cf56535ef
commit
19c4325bd8
@ -5,6 +5,7 @@
|
||||
|
||||
from __future__ import with_statement
|
||||
|
||||
import io
|
||||
import re
|
||||
import sys
|
||||
|
||||
@ -63,7 +64,7 @@ def extract_version(input):
|
||||
build, outfmt, srcfile, dstfile = parse_args()
|
||||
|
||||
try:
|
||||
fp = open(srcfile, 'rU')
|
||||
fp = io.open(srcfile, 'r')
|
||||
except IOError:
|
||||
sys.stderr.write("Unable to open source file '%s'\n" % srcfile)
|
||||
sys.exit(1)
|
||||
|
@ -4,13 +4,14 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import io
|
||||
import logging
|
||||
import sys
|
||||
|
||||
USAGE = """
|
||||
Usage:
|
||||
%s prefix {opc.lst|-} disp.lst device.inc deviced.inc
|
||||
"""
|
||||
import sys
|
||||
import logging
|
||||
|
||||
MAX_STATES = 0
|
||||
|
||||
def load_opcodes(fname):
|
||||
@ -18,7 +19,7 @@ def load_opcodes(fname):
|
||||
opcodes = []
|
||||
logging.info("load_opcodes: %s", fname)
|
||||
try:
|
||||
f = open(fname, "rU")
|
||||
f = io.open(fname, "r")
|
||||
except Exception:
|
||||
err = sys.exc_info()[1]
|
||||
logging.error("cannot read opcodes file %s [%s]", fname, err)
|
||||
@ -41,7 +42,7 @@ def load_disp(fname):
|
||||
logging.info("load_disp: %s", fname)
|
||||
states = []
|
||||
try:
|
||||
f = open(fname, "rU")
|
||||
f = io.open(fname, "r")
|
||||
except Exception:
|
||||
err = sys.exc_info()[1]
|
||||
logging.error("cannot read display file %s [%s]", fname, err)
|
||||
|
@ -2,8 +2,9 @@
|
||||
# license:BSD-3-Clause
|
||||
# copyright-holders:Olivier Galibert
|
||||
|
||||
import sys
|
||||
import io
|
||||
import re
|
||||
import sys
|
||||
|
||||
# Initial state
|
||||
state = 1
|
||||
@ -16,7 +17,7 @@ def load_file(fname, lines):
|
||||
if path != "":
|
||||
path += '/'
|
||||
try:
|
||||
f = open(fname, "rU")
|
||||
f = io.open(fname, "r")
|
||||
except Exception:
|
||||
err = sys.exc_info()[1]
|
||||
sys.stderr.write("Cannot read opcodes file %s [%s]\n" % (fname, err))
|
||||
|
@ -4,12 +4,13 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import io
|
||||
import sys
|
||||
|
||||
USAGE = """
|
||||
Usage:
|
||||
%s mcs96ops.lst mcs96.inc
|
||||
"""
|
||||
import sys
|
||||
|
||||
def save_full_one(f, t, name, source):
|
||||
print("void %s_device::%s_full()" % (t, name), file=f)
|
||||
print("{", file=f)
|
||||
@ -73,7 +74,7 @@ class OpcodeList:
|
||||
self.ea = {}
|
||||
self.macros = {}
|
||||
try:
|
||||
f = open(fname, "rU")
|
||||
f = io.open(fname, "r")
|
||||
except Exception:
|
||||
err = sys.exc_info()[1]
|
||||
sys.stderr.write("Cannot read opcodes file %s [%s]\n" % (fname, err))
|
||||
|
@ -4,8 +4,9 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
import io
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
DASM_ARGS = {
|
||||
@ -323,7 +324,7 @@ class Instruction:
|
||||
def LoadLst(filename):
|
||||
instructions = []
|
||||
ins = None
|
||||
for n, line in enumerate(open(filename, "rU")):
|
||||
for n, line in enumerate(io.open(filename, "r")):
|
||||
line = line.rstrip()
|
||||
if not line and ins:
|
||||
# new lines separate intructions
|
||||
|
Loading…
Reference in New Issue
Block a user