Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: tools/grit/grit/scons.py

Issue 140005: Instead of try:-except:-finally:, use nested try:-except: within... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/grit/grit/scons.py
===================================================================
--- tools/grit/grit/scons.py (revision 18817)
+++ tools/grit/grit/scons.py (working copy)
@@ -52,34 +52,35 @@
raise SCons.Errors.BuildError(errstr="see grit error")
return
try:
- child_exit_code = 0
- from grit import grit_runner
- from grit.tool import build
- options = grit_runner.Options()
- # This sets options to default values.
- options.ReadOptions(['-v'])
- options.input = _SourceToFile(source)
+ try:
+ child_exit_code = 0
+ from grit import grit_runner
+ from grit.tool import build
+ options = grit_runner.Options()
+ # This sets options to default values.
+ options.ReadOptions(['-v'])
+ options.input = _SourceToFile(source)
- # TODO(joi) Check if we can get the 'verbose' option from the environment.
+ # TODO(joi) Check if we can get the 'verbose' option from the environment.
- builder = build.RcBuilder()
+ builder = build.RcBuilder()
- # Get the CPP defines from the environment.
- for flag in env.get('RCFLAGS', []):
- if flag.startswith('/D'):
- flag = flag[2:]
- name, val = build.ParseDefine(flag)
- # Only apply to first instance of a given define
- if name not in builder.defines:
- builder.defines[name] = val
+ # Get the CPP defines from the environment.
+ for flag in env.get('RCFLAGS', []):
+ if flag.startswith('/D'):
+ flag = flag[2:]
+ name, val = build.ParseDefine(flag)
+ # Only apply to first instance of a given define
+ if name not in builder.defines:
+ builder.defines[name] = val
- # To ensure that our output files match what we promised SCons, we
- # use the list of targets provided by SCons and update the file paths in
- # our .grd input file with the targets.
- builder.scons_targets = [str(t) for t in target]
- builder.Run(options, [])
- except:
- child_exit_code = -1
+ # To ensure that our output files match what we promised SCons, we
+ # use the list of targets provided by SCons and update the file paths in
+ # our .grd input file with the targets.
+ builder.scons_targets = [str(t) for t in target]
+ builder.Run(options, [])
+ except:
+ child_exit_code = -1
finally:
# Exit the child process.
os._exit(child_exit_code)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698