summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--giscanner/cachestore.py16
-rw-r--r--giscanner/dumper.py8
-rw-r--r--giscanner/gdumpparser.py14
-rwxr-xr-xgiscanner/scannermain.py6
-rw-r--r--giscanner/transformer.py24
5 files changed, 34 insertions, 34 deletions
diff --git a/giscanner/cachestore.py b/giscanner/cachestore.py
index 44e3b04c..5f66b66a 100644
--- a/giscanner/cachestore.py
+++ b/giscanner/cachestore.py
@@ -73,7 +73,7 @@ class CacheStore(object):
def __init__(self):
try:
self._directory = _get_cachedir()
- except OSError, e:
+ except OSError as e:
if e.errno != errno.EPERM:
raise
self._directory = None
@@ -88,7 +88,7 @@ class CacheStore(object):
version = os.path.join(self._directory, _CACHE_VERSION_FILENAME)
try:
cache_hash = open(version).read()
- except IOError, e:
+ except IOError as e:
# File does not exist
if e.errno == errno.ENOENT:
cache_hash = 0
@@ -101,7 +101,7 @@ class CacheStore(object):
self._clean()
try:
fp = open(version, 'w')
- except IOError, e:
+ except IOError as e:
# Permission denied
if e.errno == errno.EACCES:
return
@@ -126,13 +126,13 @@ class CacheStore(object):
def _remove_filename(self, filename):
try:
os.unlink(filename)
- except IOError, e:
+ except IOError as e:
# Permission denied
if e.errno == errno.EACCES:
return
else:
raise
- except OSError, e:
+ except OSError as e:
# File does not exist
if e.errno == errno.ENOENT:
return
@@ -157,7 +157,7 @@ class CacheStore(object):
tmp_fd, tmp_filename = tempfile.mkstemp(prefix='g-ir-scanner-cache-')
try:
cPickle.dump(data, os.fdopen(tmp_fd, 'w'))
- except IOError, e:
+ except IOError as e:
# No space left on device
if e.errno == errno.ENOSPC:
self._remove_filename(tmp_filename)
@@ -167,7 +167,7 @@ class CacheStore(object):
try:
shutil.move(tmp_filename, store_filename)
- except IOError, e:
+ except IOError as e:
# Permission denied
if e.errno == errno.EACCES:
self._remove_filename(tmp_filename)
@@ -180,7 +180,7 @@ class CacheStore(object):
return
try:
fd = open(store_filename)
- except IOError, e:
+ except IOError as e:
if e.errno == errno.ENOENT:
return None
else:
diff --git a/giscanner/dumper.py b/giscanner/dumper.py
index d95ea6ba..f5346a40 100644
--- a/giscanner/dumper.py
+++ b/giscanner/dumper.py
@@ -166,14 +166,14 @@ class DumpCompiler(object):
try:
self._compile(o_path, c_path)
- except CompilerError, e:
+ except CompilerError as e:
if not utils.have_debug_flag('save-temps'):
shutil.rmtree(tmpdir)
raise SystemExit('compilation of temporary binary failed:' + str(e))
try:
self._link(bin_path, o_path)
- except LinkerError, e:
+ except LinkerError as e:
if not utils.have_debug_flag('save-temps'):
shutil.rmtree(tmpdir)
raise SystemExit('linking of temporary binary failed: ' + str(e))
@@ -236,7 +236,7 @@ class DumpCompiler(object):
sys.stdout.flush()
try:
subprocess.check_call(args)
- except subprocess.CalledProcessError, e:
+ except subprocess.CalledProcessError as e:
raise CompilerError(e)
def _link(self, output, *sources):
@@ -290,7 +290,7 @@ class DumpCompiler(object):
sys.stdout.flush()
try:
subprocess.check_call(args)
- except subprocess.CalledProcessError, e:
+ except subprocess.CalledProcessError as e:
raise LinkerError(e)
def _add_link_internal_args(self, args, libtool):
diff --git a/giscanner/gdumpparser.py b/giscanner/gdumpparser.py
index c0b13f4a..79525030 100644
--- a/giscanner/gdumpparser.py
+++ b/giscanner/gdumpparser.py
@@ -165,7 +165,7 @@ blob containing data gleaned from GObject's primitive introspection."""
try:
try:
subprocess.check_call(args, stdout=sys.stdout, stderr=sys.stderr)
- except subprocess.CalledProcessError, e:
+ except subprocess.CalledProcessError as e:
# Clean up temporaries
raise SystemExit(e)
return parse(out_path)
@@ -251,7 +251,7 @@ blob containing data gleaned from GObject's primitive introspection."""
(get_type, c_symbol_prefix) = self._split_type_and_symbol_prefix(xmlnode)
try:
enum_name = self._transformer.strip_identifier(type_name)
- except TransformerException, e:
+ except TransformerException as e:
message.fatal(e)
# The scanned member values are more accurate than the values that the
@@ -316,7 +316,7 @@ different --identifier-prefix.""" % (xmlnode.attrib['name'], self._namespace.ide
(get_type, c_symbol_prefix) = self._split_type_and_symbol_prefix(xmlnode)
try:
object_name = self._transformer.strip_identifier(type_name)
- except TransformerException, e:
+ except TransformerException as e:
message.fatal(e)
node = ast.Class(object_name, None,
gtype_name=type_name,
@@ -346,7 +346,7 @@ different --identifier-prefix.""" % (xmlnode.attrib['name'], self._namespace.ide
(get_type, c_symbol_prefix) = self._split_type_and_symbol_prefix(xmlnode)
try:
interface_name = self._transformer.strip_identifier(type_name)
- except TransformerException, e:
+ except TransformerException as e:
message.fatal(e)
node = ast.Interface(interface_name, None,
gtype_name=type_name,
@@ -391,7 +391,7 @@ different --identifier-prefix.""" % (xmlnode.attrib['name'], self._namespace.ide
try:
name = self._transformer.strip_identifier(type_name)
- except TransformerException, e:
+ except TransformerException as e:
message.fatal(e)
# This one doesn't go in the main namespace; we associate it with
# the struct or union
@@ -465,7 +465,7 @@ different --identifier-prefix.""" % (xmlnode.attrib['name'], self._namespace.ide
(get_type, c_symbol_prefix) = self._split_type_and_symbol_prefix(xmlnode)
try:
fundamental_name = self._transformer.strip_identifier(type_name)
- except TransformerException, e:
+ except TransformerException as e:
message.warn(e)
return
@@ -509,7 +509,7 @@ different --identifier-prefix.""" % (xmlnode.attrib['name'], self._namespace.ide
def _pair_boxed_type(self, boxed):
try:
name = self._transformer.strip_identifier(boxed.gtype_name)
- except TransformerException, e:
+ except TransformerException as e:
message.fatal(e)
pair_node = self._namespace.get(name)
if not pair_node:
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py
index 42867f08..b068f6fb 100755
--- a/giscanner/scannermain.py
+++ b/giscanner/scannermain.py
@@ -393,7 +393,7 @@ def write_output(data, options):
os.unlink(temp_f_name)
try:
shutil.move(main_f_name, options.output)
- except OSError, e:
+ except OSError as e:
if e.errno == errno.EPERM:
os.unlink(main_f_name)
return 0
@@ -402,12 +402,12 @@ def write_output(data, options):
else:
try:
output = open(options.output, "w")
- except IOError, e:
+ except IOError as e:
_error("opening output for writing: %s" % (e.strerror, ))
try:
output.write(data)
- except IOError, e:
+ except IOError as e:
_error("while writing output: %s" % (e.strerror, ))
def scanner_main(args):
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index 3513fc8c..2708f0a6 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -289,7 +289,7 @@ raise ValueError."""
ident = ident[1:]
try:
matches = self.split_ctype_namespaces(ident)
- except ValueError, e:
+ except ValueError as e:
raise TransformerException(str(e))
for ns, name in matches:
if ns is self._namespace:
@@ -309,7 +309,7 @@ raise ValueError."""
ident = ident[1:]
try:
(ns, name) = self.split_csymbol(ident)
- except ValueError, e:
+ except ValueError as e:
raise TransformerException(str(e))
if ns != self._namespace:
raise TransformerException(
@@ -383,7 +383,7 @@ raise ValueError."""
# prefix.
try:
name = self._strip_symbol(child)
- except TransformerException, e:
+ except TransformerException as e:
message.warn_symbol(symbol, e)
return None
members.append(ast.Member(name.lower(),
@@ -393,7 +393,7 @@ raise ValueError."""
try:
enum_name = self.strip_identifier(symbol.ident)
- except TransformerException, e:
+ except TransformerException as e:
message.warn_symbol(symbol, e)
return None
if symbol.base_type.is_bitfield:
@@ -412,7 +412,7 @@ raise ValueError."""
return_ = self._create_return(symbol.base_type.base_type)
try:
name = self._strip_symbol(symbol)
- except TransformerException, e:
+ except TransformerException as e:
message.warn_symbol(symbol, e)
return None
func = ast.Function(name, return_, parameters, False, symbol.ident)
@@ -580,7 +580,7 @@ raise ValueError."""
CTYPE_VOID):
try:
name = self.strip_identifier(symbol.ident)
- except TransformerException, e:
+ except TransformerException as e:
message.warn(e)
return None
if symbol.base_type.name:
@@ -723,7 +723,7 @@ raise ValueError."""
return None
try:
name = self._strip_symbol(symbol)
- except TransformerException, e:
+ except TransformerException as e:
message.warn_symbol(symbol, e)
return None
if symbol.const_string is not None:
@@ -765,7 +765,7 @@ raise ValueError."""
def _create_typedef_struct(self, symbol, disguised=False):
try:
name = self.strip_identifier(symbol.ident)
- except TransformerException, e:
+ except TransformerException as e:
message.warn_symbol(symbol, e)
return None
struct = ast.Record(name, symbol.ident, disguised=disguised)
@@ -777,7 +777,7 @@ raise ValueError."""
def _create_typedef_union(self, symbol):
try:
name = self.strip_identifier(symbol.ident)
- except TransformerException, e:
+ except TransformerException as e:
message.warn(e)
return None
union = ast.Union(name, symbol.ident)
@@ -825,7 +825,7 @@ raise ValueError."""
else:
try:
name = self.strip_identifier(symbol.ident)
- except TransformerException, e:
+ except TransformerException as e:
message.warn(e)
return None
compound = klass(name, symbol.ident)
@@ -855,13 +855,13 @@ raise ValueError."""
elif symbol.ident.find('_') > 0:
try:
name = self._strip_symbol(symbol)
- except TransformerException, e:
+ except TransformerException as e:
message.warn_symbol(symbol, e)
return None
else:
try:
name = self.strip_identifier(symbol.ident)
- except TransformerException, e:
+ except TransformerException as e:
message.warn(e)
return None
callback = ast.Callback(name, retval, parameters, False,