aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oe
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-07 13:55:55 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-09 14:04:18 +0100
commitb010501cd089e649a68f683be0cf4d0aac90fbe3 (patch)
treece5c7cba76051675e4a765dd677ffed372d4e33a /meta/lib/oe
parent3c104443506cb89d72944e46096a94a80838a707 (diff)
downloadopenembedded-core-b010501cd089e649a68f683be0cf4d0aac90fbe3.tar.gz
clases/lib: Use modern exception syntax
Update older code to use modern exception handling syntax which is the form accepted by python 3. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r--meta/lib/oe/cachedpath.py4
-rw-r--r--meta/lib/oe/patch.py2
-rw-r--r--meta/lib/oe/path.py6
-rw-r--r--meta/lib/oe/qa.py2
-rw-r--r--meta/lib/oe/types.py2
-rw-r--r--meta/lib/oe/utils.py2
6 files changed, 9 insertions, 9 deletions
diff --git a/meta/lib/oe/cachedpath.py b/meta/lib/oe/cachedpath.py
index e350c8a70e..c7860ef4fb 100644
--- a/meta/lib/oe/cachedpath.py
+++ b/meta/lib/oe/cachedpath.py
@@ -125,7 +125,7 @@ class CachedPath(object):
# Note that listdir and error are globals in this module due
# to earlier import-*.
names = os.listdir(top)
- except error, err:
+ except error as err:
if onerror is not None:
onerror(err)
return
@@ -221,7 +221,7 @@ class CachedPath(object):
file = self.__realpath_rel(root, file[(len(root) - 1):], root, loop_cnt, assume_dir)
else:
file = self.__realpath(file, root, loop_cnt, assume_dir)[0]
- except OSError, e:
+ except OSError as e:
if e.errno == errno.ELOOP:
# make ELOOP more readable; without catching it, there will
# be printed a backtrace with 100s of OSError exceptions
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
index 7ab74fae8a..cbc5cd9755 100644
--- a/meta/lib/oe/patch.py
+++ b/meta/lib/oe/patch.py
@@ -392,7 +392,7 @@ class UserResolver(Resolver):
os.chdir(self.patchset.dir)
try:
self.patchset.Push(False)
- except CmdError, v:
+ except CmdError as v:
# Patch application failed
patchcmd = self.patchset.Push(True, False, False)
diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py
index 76a6ed8314..d8eb80225f 100644
--- a/meta/lib/oe/path.py
+++ b/meta/lib/oe/path.py
@@ -107,7 +107,7 @@ def remove(path, recurse=True):
for name in glob.glob(path):
try:
os.unlink(name)
- except OSError, exc:
+ except OSError as exc:
if recurse and exc.errno == errno.EISDIR:
shutil.rmtree(name)
elif exc.errno != errno.ENOENT:
@@ -119,7 +119,7 @@ def symlink(source, destination, force=False):
if force:
remove(destination)
os.symlink(source, destination)
- except OSError, e:
+ except OSError as e:
if e.errno != errno.EEXIST or os.readlink(destination) != source:
raise
@@ -247,7 +247,7 @@ def realpath(file, root, use_physdir = True, loop_cnt = 100, assume_dir = False)
file = __realpath_rel(root, file[(len(root) - 1):], root, loop_cnt, assume_dir)
else:
file = __realpath(file, root, loop_cnt, assume_dir)[0]
- except OSError, e:
+ except OSError as e:
if e.errno == errno.ELOOP:
# make ELOOP more readable; without catching it, there will
# be printed a backtrace with 100s of OSError exceptions
diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py
index d9848c8e4a..4777ddc06a 100644
--- a/meta/lib/oe/qa.py
+++ b/meta/lib/oe/qa.py
@@ -106,6 +106,6 @@ class ELFFile:
bb.note("%s %s %s" % (objdump, cmd, self.name))
self.objdump_output[cmd] = bb.process.run([objdump, cmd, self.name], env=env, shell=False)[0]
return self.objdump_output[cmd]
- except Exception, e:
+ except Exception as e:
bb.note("%s %s %s failed: %s" % (objdump, cmd, self.name, e))
return ""
diff --git a/meta/lib/oe/types.py b/meta/lib/oe/types.py
index ea53df9bf2..5dac9de239 100644
--- a/meta/lib/oe/types.py
+++ b/meta/lib/oe/types.py
@@ -92,7 +92,7 @@ def regex(value, regexflags=None):
try:
return re.compile(value, flagval)
- except re.error, exc:
+ except re.error as exc:
raise ValueError("Invalid regex value '%s': %s" %
(value, exc.args[0]))
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index acd39693b5..ed9409613a 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -1,7 +1,7 @@
def read_file(filename):
try:
f = file( filename, "r" )
- except IOError, reason:
+ except IOError as reason:
return "" # WARNING: can't raise an error now because of the new RDEPENDS handling. This is a bit ugly. :M:
else:
return f.read().strip()