diff options
author | Scott Garman <scott.a.garman@intel.com> | 2011-06-14 16:44:58 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-06-15 11:13:13 +0100 |
commit | 62d538fbe65cf61ebc5996b0d6eb7e4ec47b6ead (patch) | |
tree | 685b0c48785db94f4fc26f727932f8779bc2fb5a /bitbake/lib/bb/pysh/builtin.py | |
parent | 039798a4d250665c66fd738dba4d07dc2ec70652 (diff) | |
download | poky-62d538fbe65cf61ebc5996b0d6eb7e4ec47b6ead.tar.gz |
make exception handling syntax consistent
Update exception handling syntax to use the modern style:
except ExcType as localvar
(Bitbake rev: dbf5f42b06bef81749b13aa99945cc1292a6676d)
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/pysh/builtin.py')
-rw-r--r-- | bitbake/lib/bb/pysh/builtin.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/bitbake/lib/bb/pysh/builtin.py b/bitbake/lib/bb/pysh/builtin.py index 25ad22eb74..b748e4a4f2 100644 --- a/bitbake/lib/bb/pysh/builtin.py +++ b/bitbake/lib/bb/pysh/builtin.py | |||
@@ -151,7 +151,7 @@ def builtin_trap(name, args, interp, env, stdin, stdout, stderr, debugflags): | |||
151 | for sig in args[1:]: | 151 | for sig in args[1:]: |
152 | try: | 152 | try: |
153 | env.traps[sig] = action | 153 | env.traps[sig] = action |
154 | except Exception, e: | 154 | except Exception as e: |
155 | stderr.write('trap: %s\n' % str(e)) | 155 | stderr.write('trap: %s\n' % str(e)) |
156 | return 0 | 156 | return 0 |
157 | 157 | ||
@@ -214,7 +214,7 @@ def utility_cat(name, args, interp, env, stdin, stdout, stderr, debugflags): | |||
214 | data = f.read() | 214 | data = f.read() |
215 | finally: | 215 | finally: |
216 | f.close() | 216 | f.close() |
217 | except IOError, e: | 217 | except IOError as e: |
218 | if e.errno != errno.ENOENT: | 218 | if e.errno != errno.ENOENT: |
219 | raise | 219 | raise |
220 | status = 1 | 220 | status = 1 |
@@ -433,7 +433,7 @@ def utility_mkdir(name, args, interp, env, stdin, stdout, stderr, debugflags): | |||
433 | if option.has_p: | 433 | if option.has_p: |
434 | try: | 434 | try: |
435 | os.makedirs(path) | 435 | os.makedirs(path) |
436 | except IOError, e: | 436 | except IOError as e: |
437 | if e.errno != errno.EEXIST: | 437 | if e.errno != errno.EEXIST: |
438 | raise | 438 | raise |
439 | else: | 439 | else: |
@@ -561,7 +561,7 @@ def utility_sort(name, args, interp, env, stdin, stdout, stderr, debugflags): | |||
561 | lines = f.readlines() | 561 | lines = f.readlines() |
562 | finally: | 562 | finally: |
563 | f.close() | 563 | f.close() |
564 | except IOError, e: | 564 | except IOError as e: |
565 | stderr.write(str(e) + '\n') | 565 | stderr.write(str(e) + '\n') |
566 | return 1 | 566 | return 1 |
567 | 567 | ||
@@ -679,7 +679,7 @@ def run_command(name, args, interp, env, stdin, stdout, | |||
679 | p = subprocess.Popen([name] + args, cwd=env['PWD'], env=exec_env, | 679 | p = subprocess.Popen([name] + args, cwd=env['PWD'], env=exec_env, |
680 | stdin=stdin, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | 680 | stdin=stdin, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
681 | out, err = p.communicate() | 681 | out, err = p.communicate() |
682 | except WindowsError, e: | 682 | except WindowsError as e: |
683 | raise UtilityError(str(e)) | 683 | raise UtilityError(str(e)) |
684 | 684 | ||
685 | if not unixoutput: | 685 | if not unixoutput: |