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/interp.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/interp.py')
-rw-r--r-- | bitbake/lib/bb/pysh/interp.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/bitbake/lib/bb/pysh/interp.py b/bitbake/lib/bb/pysh/interp.py index efe5181e1e..25d8c92ec4 100644 --- a/bitbake/lib/bb/pysh/interp.py +++ b/bitbake/lib/bb/pysh/interp.py | |||
@@ -248,7 +248,7 @@ class Redirections: | |||
248 | raise NotImplementedError('cannot open absolute path %s' % repr(filename)) | 248 | raise NotImplementedError('cannot open absolute path %s' % repr(filename)) |
249 | else: | 249 | else: |
250 | f = file(filename, mode+'b') | 250 | f = file(filename, mode+'b') |
251 | except IOError, e: | 251 | except IOError as e: |
252 | raise RedirectionError(str(e)) | 252 | raise RedirectionError(str(e)) |
253 | 253 | ||
254 | wrapper = None | 254 | wrapper = None |
@@ -368,7 +368,7 @@ def resolve_shebang(path, ignoreshell=False): | |||
368 | if arg is None: | 368 | if arg is None: |
369 | return [cmd, win32_to_unix_path(path)] | 369 | return [cmd, win32_to_unix_path(path)] |
370 | return [cmd, arg, win32_to_unix_path(path)] | 370 | return [cmd, arg, win32_to_unix_path(path)] |
371 | except IOError, e: | 371 | except IOError as e: |
372 | if e.errno!=errno.ENOENT and \ | 372 | if e.errno!=errno.ENOENT and \ |
373 | (e.errno!=errno.EPERM and not os.path.isdir(path)): # Opening a directory raises EPERM | 373 | (e.errno!=errno.EPERM and not os.path.isdir(path)): # Opening a directory raises EPERM |
374 | raise | 374 | raise |
@@ -747,7 +747,7 @@ class Interpreter: | |||
747 | for cmd in cmds: | 747 | for cmd in cmds: |
748 | try: | 748 | try: |
749 | status = self.execute(cmd) | 749 | status = self.execute(cmd) |
750 | except ExitSignal, e: | 750 | except ExitSignal as e: |
751 | if sourced: | 751 | if sourced: |
752 | raise | 752 | raise |
753 | status = int(e.args[0]) | 753 | status = int(e.args[0]) |
@@ -758,13 +758,13 @@ class Interpreter: | |||
758 | if 'debug-utility' in self._debugflags or 'debug-cmd' in self._debugflags: | 758 | if 'debug-utility' in self._debugflags or 'debug-cmd' in self._debugflags: |
759 | self.log('returncode ' + str(status)+ '\n') | 759 | self.log('returncode ' + str(status)+ '\n') |
760 | return status | 760 | return status |
761 | except CommandNotFound, e: | 761 | except CommandNotFound as e: |
762 | print >>self._redirs.stderr, str(e) | 762 | print >>self._redirs.stderr, str(e) |
763 | self._redirs.stderr.flush() | 763 | self._redirs.stderr.flush() |
764 | # Command not found by non-interactive shell | 764 | # Command not found by non-interactive shell |
765 | # return 127 | 765 | # return 127 |
766 | raise | 766 | raise |
767 | except RedirectionError, e: | 767 | except RedirectionError as e: |
768 | # TODO: should be handled depending on the utility status | 768 | # TODO: should be handled depending on the utility status |
769 | print >>self._redirs.stderr, str(e) | 769 | print >>self._redirs.stderr, str(e) |
770 | self._redirs.stderr.flush() | 770 | self._redirs.stderr.flush() |
@@ -948,7 +948,7 @@ class Interpreter: | |||
948 | status = self.execute(func, redirs) | 948 | status = self.execute(func, redirs) |
949 | finally: | 949 | finally: |
950 | redirs.close() | 950 | redirs.close() |
951 | except ReturnSignal, e: | 951 | except ReturnSignal as e: |
952 | status = int(e.args[0]) | 952 | status = int(e.args[0]) |
953 | env['?'] = status | 953 | env['?'] = status |
954 | return status | 954 | return status |
@@ -1044,7 +1044,7 @@ class Interpreter: | |||
1044 | 1044 | ||
1045 | except ReturnSignal: | 1045 | except ReturnSignal: |
1046 | raise | 1046 | raise |
1047 | except ShellError, e: | 1047 | except ShellError as e: |
1048 | if is_special or isinstance(e, (ExitSignal, | 1048 | if is_special or isinstance(e, (ExitSignal, |
1049 | ShellSyntaxError, ExpansionError)): | 1049 | ShellSyntaxError, ExpansionError)): |
1050 | raise e | 1050 | raise e |