summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/path.py
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:06:50 +0100
commit2ac4f8b39711209ba9323fc221c1dcd185da57ea (patch)
treecbaa1e573abd13c7827a5b4a57724fd884df148b /meta/lib/oe/path.py
parent00052fe69582f238166511e733d3ba875cbe0ad2 (diff)
downloadpoky-2ac4f8b39711209ba9323fc221c1dcd185da57ea.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. (From OE-Core rev: b010501cd089e649a68f683be0cf4d0aac90fbe3) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/path.py')
-rw-r--r--meta/lib/oe/path.py6
1 files changed, 3 insertions, 3 deletions
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):
107 for name in glob.glob(path): 107 for name in glob.glob(path):
108 try: 108 try:
109 os.unlink(name) 109 os.unlink(name)
110 except OSError, exc: 110 except OSError as exc:
111 if recurse and exc.errno == errno.EISDIR: 111 if recurse and exc.errno == errno.EISDIR:
112 shutil.rmtree(name) 112 shutil.rmtree(name)
113 elif exc.errno != errno.ENOENT: 113 elif exc.errno != errno.ENOENT:
@@ -119,7 +119,7 @@ def symlink(source, destination, force=False):
119 if force: 119 if force:
120 remove(destination) 120 remove(destination)
121 os.symlink(source, destination) 121 os.symlink(source, destination)
122 except OSError, e: 122 except OSError as e:
123 if e.errno != errno.EEXIST or os.readlink(destination) != source: 123 if e.errno != errno.EEXIST or os.readlink(destination) != source:
124 raise 124 raise
125 125
@@ -247,7 +247,7 @@ def realpath(file, root, use_physdir = True, loop_cnt = 100, assume_dir = False)
247 file = __realpath_rel(root, file[(len(root) - 1):], root, loop_cnt, assume_dir) 247 file = __realpath_rel(root, file[(len(root) - 1):], root, loop_cnt, assume_dir)
248 else: 248 else:
249 file = __realpath(file, root, loop_cnt, assume_dir)[0] 249 file = __realpath(file, root, loop_cnt, assume_dir)[0]
250 except OSError, e: 250 except OSError as e:
251 if e.errno == errno.ELOOP: 251 if e.errno == errno.ELOOP:
252 # make ELOOP more readable; without catching it, there will 252 # make ELOOP more readable; without catching it, there will
253 # be printed a backtrace with 100s of OSError exceptions 253 # be printed a backtrace with 100s of OSError exceptions