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/cooker.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/cooker.py')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index c81baf66b7..ebf963d5ba 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -100,7 +100,7 @@ class BBCooker: | |||
100 | name_array = (getattr(module, configuration.ui)).extraCaches | 100 | name_array = (getattr(module, configuration.ui)).extraCaches |
101 | for recipeInfoName in name_array: | 101 | for recipeInfoName in name_array: |
102 | caches_name_array.append(recipeInfoName) | 102 | caches_name_array.append(recipeInfoName) |
103 | except ImportError, exc: | 103 | except ImportError as exc: |
104 | # bb.ui.XXX is not defined and imported. It's an error! | 104 | # bb.ui.XXX is not defined and imported. It's an error! |
105 | logger.critical("Unable to import '%s' interface from bb.ui: %s" % (configuration.ui, exc)) | 105 | logger.critical("Unable to import '%s' interface from bb.ui: %s" % (configuration.ui, exc)) |
106 | sys.exit("FATAL: Failed to import '%s' interface." % configuration.ui) | 106 | sys.exit("FATAL: Failed to import '%s' interface." % configuration.ui) |
@@ -117,7 +117,7 @@ class BBCooker: | |||
117 | module_name, cache_name = var.split(':') | 117 | module_name, cache_name = var.split(':') |
118 | module = __import__(module_name, fromlist=(cache_name,)) | 118 | module = __import__(module_name, fromlist=(cache_name,)) |
119 | self.caches_array.append(getattr(module, cache_name)) | 119 | self.caches_array.append(getattr(module, cache_name)) |
120 | except ImportError, exc: | 120 | except ImportError as exc: |
121 | logger.critical("Unable to import extra RecipeInfo '%s' from '%s': %s" % (cache_name, module_name, exc)) | 121 | logger.critical("Unable to import extra RecipeInfo '%s' from '%s': %s" % (cache_name, module_name, exc)) |
122 | sys.exit("FATAL: Failed to import extra cache class '%s'." % cache_name) | 122 | sys.exit("FATAL: Failed to import extra cache class '%s'." % cache_name) |
123 | 123 | ||
@@ -280,7 +280,7 @@ class BBCooker: | |||
280 | if fn: | 280 | if fn: |
281 | try: | 281 | try: |
282 | envdata = bb.cache.Cache.loadDataFull(fn, self.get_file_appends(fn), self.configuration.data) | 282 | envdata = bb.cache.Cache.loadDataFull(fn, self.get_file_appends(fn), self.configuration.data) |
283 | except Exception, e: | 283 | except Exception as e: |
284 | parselog.exception("Unable to read %s", fn) | 284 | parselog.exception("Unable to read %s", fn) |
285 | raise | 285 | raise |
286 | 286 | ||
@@ -1159,7 +1159,7 @@ def parse_file(task): | |||
1159 | filename, appends, caches_array = task | 1159 | filename, appends, caches_array = task |
1160 | try: | 1160 | try: |
1161 | return True, bb.cache.Cache.parse(filename, appends, parse_file.cfg, caches_array) | 1161 | return True, bb.cache.Cache.parse(filename, appends, parse_file.cfg, caches_array) |
1162 | except Exception, exc: | 1162 | except Exception as exc: |
1163 | tb = sys.exc_info()[2] | 1163 | tb = sys.exc_info()[2] |
1164 | exc.recipe = filename | 1164 | exc.recipe = filename |
1165 | exc.traceback = list(bb.exceptions.extract_traceback(tb, context=3)) | 1165 | exc.traceback = list(bb.exceptions.extract_traceback(tb, context=3)) |
@@ -1167,7 +1167,7 @@ def parse_file(task): | |||
1167 | # Need to turn BaseExceptions into Exceptions here so we gracefully shutdown | 1167 | # Need to turn BaseExceptions into Exceptions here so we gracefully shutdown |
1168 | # and for example a worker thread doesn't just exit on its own in response to | 1168 | # and for example a worker thread doesn't just exit on its own in response to |
1169 | # a SystemExit event for example. | 1169 | # a SystemExit event for example. |
1170 | except BaseException, exc: | 1170 | except BaseException as exc: |
1171 | raise ParsingFailure(exc, filename) | 1171 | raise ParsingFailure(exc, filename) |
1172 | 1172 | ||
1173 | class CookerParser(object): | 1173 | class CookerParser(object): |