summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsgk@google.com <sgk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-19 20:44:08 +0000
committersgk@google.com <sgk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-19 20:44:08 +0000
commit34da373d3e61abac19c011d4526fb9b7041cfca1 (patch)
tree5798ef7f64639fece7afc6cb2f20c60138120e08
parentb3ac9cdc41e5e4ded1ac249f336e044523c00977 (diff)
downloadchromium_src-34da373d3e61abac19c011d4526fb9b7041cfca1.zip
chromium_src-34da373d3e61abac19c011d4526fb9b7041cfca1.tar.gz
chromium_src-34da373d3e61abac19c011d4526fb9b7041cfca1.tar.bz2
Instead of try:-except:-finally:, use nested try:-except: within
try:-finally: so builds will work without forced upgrades to Python 2.5. BUG=12818 TEST=successful build Review URL: http://codereview.chromium.org/140005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18848 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--tools/grit/grit/scons.py57
1 files changed, 29 insertions, 28 deletions
diff --git a/tools/grit/grit/scons.py b/tools/grit/grit/scons.py
index 733583e..4798242 100644
--- a/tools/grit/grit/scons.py
+++ b/tools/grit/grit/scons.py
@@ -52,34 +52,35 @@ def _Builder(target, source, env):
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)
-
- # TODO(joi) Check if we can get the 'verbose' option from the environment.
-
- 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
-
- # 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
+ 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.
+
+ 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
+
+ # 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)