summaryrefslogtreecommitdiffstats
path: root/tools/grit
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-10 18:51:59 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-10 18:51:59 +0000
commitac4425387548c5ee59348760784959fa841ece76 (patch)
tree403b401bd484795528edca191804a70bffc24b1d /tools/grit
parent69bddd03590e72de85854512d605cbaae86ef585 (diff)
downloadchromium_src-ac4425387548c5ee59348760784959fa841ece76.zip
chromium_src-ac4425387548c5ee59348760784959fa841ece76.tar.gz
chromium_src-ac4425387548c5ee59348760784959fa841ece76.tar.bz2
Only run one grit builder at a time under scons.
GRIT is not thread safe, we shouldn't be running multiple copies at one time. This is causing the header files to have duplicates when it shouldn't. I also removed some code in build.py which tried to prevent an identical regenerated header file from being used (so stuff doesn't rebuild unnecessarily). This code isn't necessary for our build since VS/xcode/scons handles the dependency for us (i.e., this isn't a blanket prebuild step). Review URL: http://codereview.chromium.org/21191 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9488 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/grit')
-rw-r--r--tools/grit/grit/scons.py4
-rw-r--r--tools/grit/grit/tool/build.py14
2 files changed, 4 insertions, 14 deletions
diff --git a/tools/grit/grit/scons.py b/tools/grit/grit/scons.py
index 6410e26..89b8837 100644
--- a/tools/grit/grit/scons.py
+++ b/tools/grit/grit/scons.py
@@ -108,6 +108,10 @@ def _Emitter(target, source, env):
if _IsDebugEnabled():
print "GRIT: Added target %s" % path
+ # GRIT is not thread safe so we should only build one grit target at a time.
+ # We tell scons about this by making a fake side effect target.
+ env.SideEffect('grit_lock', target)
+
# return target and source lists
return (target, source)
diff --git a/tools/grit/grit/tool/build.py b/tools/grit/grit/tool/build.py
index 63ade73..ab89809 100644
--- a/tools/grit/grit/tool/build.py
+++ b/tools/grit/grit/tool/build.py
@@ -170,14 +170,6 @@ are exported to translation interchange files (e.g. XMB files), etc.
# character sets.
if output.GetType() in ['rc_header']:
encoding = 'cp1252'
- outname = output.GetOutputFilename()
- oldname = outname + '.tmp'
- if os.access(oldname, os.F_OK):
- os.remove(oldname)
- try:
- os.rename(outname, oldname)
- except OSError:
- oldname = None
else:
encoding = 'utf_16'
outfile = self.fo_create(output.GetOutputFilename(), 'wb')
@@ -197,12 +189,6 @@ are exported to translation interchange files (e.g. XMB files), etc.
self.ProcessNode(self.res, output, outfile)
outfile.close()
- if output.GetType() in ['rc_header'] and oldname:
- if open(oldname).read() != open(outname).read():
- os.remove(oldname)
- else:
- os.remove(outname)
- os.rename(oldname, outname)
self.VerboseOut(' done.\n')
# Print warnings if there are any duplicate shortcuts.