mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-05-04 22:02:16 +00:00
qapi: Use Python 2.6 "except E as ..." syntax
PEP 8 calls for it, because it's forward compatible with Python 3. Supported since Python 2.6, which we require (commit fec2103). Backports commit 291928a80f39670929fcce222acd5e21d1434692 from qemu
This commit is contained in:
parent
f7d5b1c833
commit
b2c9386111
|
@ -170,7 +170,7 @@ class QAPISchemaParser(object):
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
fobj = open(incl_abs_fname, 'r')
|
fobj = open(incl_abs_fname, 'r')
|
||||||
except IOError, e:
|
except IOError as e:
|
||||||
raise QAPIExprError(expr_info,
|
raise QAPIExprError(expr_info,
|
||||||
'%s: %s' % (e.strerror, include))
|
'%s: %s' % (e.strerror, include))
|
||||||
exprs_include = QAPISchemaParser(fobj, previously_included,
|
exprs_include = QAPISchemaParser(fobj, previously_included,
|
||||||
|
@ -1190,7 +1190,7 @@ class QAPISchema(object):
|
||||||
self._predefining = False
|
self._predefining = False
|
||||||
self._def_exprs()
|
self._def_exprs()
|
||||||
self.check()
|
self.check()
|
||||||
except (QAPISchemaError, QAPIExprError), err:
|
except (QAPISchemaError, QAPIExprError) as err:
|
||||||
print >>sys.stderr, err
|
print >>sys.stderr, err
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
@ -1685,7 +1685,7 @@ def parse_command_line(extra_options="", extra_long_options=[]):
|
||||||
"chp:o:" + extra_options,
|
"chp:o:" + extra_options,
|
||||||
["source", "header", "prefix=",
|
["source", "header", "prefix=",
|
||||||
"output-dir="] + extra_long_options)
|
"output-dir="] + extra_long_options)
|
||||||
except getopt.GetoptError, err:
|
except getopt.GetoptError as err:
|
||||||
print >>sys.stderr, "%s: %s" % (sys.argv[0], str(err))
|
print >>sys.stderr, "%s: %s" % (sys.argv[0], str(err))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
@ -1739,7 +1739,7 @@ def open_output(output_dir, do_c, do_h, prefix, c_file, h_file,
|
||||||
if output_dir:
|
if output_dir:
|
||||||
try:
|
try:
|
||||||
os.makedirs(output_dir)
|
os.makedirs(output_dir)
|
||||||
except os.error, e:
|
except os.error as e:
|
||||||
if e.errno != errno.EEXIST:
|
if e.errno != errno.EEXIST:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue