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

Unified Diff: tools/clang/scripts/update.py

Issue 1127233002: Use Clang's update.py --print-revision everywhere. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set 'shell=True' when running 'svn info' Created 5 years, 7 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 | « tools/clang/scripts/posix-print-revision.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/clang/scripts/update.py
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py
index 06d241e80b8e77f01e33bffe034641304a7f348a..4415dea29143e90e22041c7006aec59c0d4e40c5 100755
--- a/tools/clang/scripts/update.py
+++ b/tools/clang/scripts/update.py
@@ -65,8 +65,14 @@ def WriteStampFile(s):
def PrintRevision():
"""Print the current Clang revision."""
+ # gyp runs update.py --print-revision even when clang=1 isn't set.
+ # It won't use the value, but we must not error.
+ if not re.search(r'\b(clang|asan)=1', os.environ.get('GYP_DEFINES', '')):
+ print "0"
+ return
+
# TODO(hans): This needs an update when we move to prebuilt Clang binaries.
- svn_info = subprocess.check_output(['svn', 'info', LLVM_DIR])
+ svn_info = subprocess.check_output(['svn', 'info', LLVM_DIR], shell=True)
m = re.search(r'Revision: (\d+)', svn_info)
assert m
print m.group(1)
@@ -84,15 +90,6 @@ def RmTree(dir):
shutil.rmtree(dir, onerror=ChmodAndRetry)
-def ClobberChromiumBuildFiles():
- """Clobber Chomium build files."""
- print 'Clobbering Chromium build files...'
- out_dir = os.path.join(CHROMIUM_DIR, 'out')
- if os.path.isdir(out_dir):
- RmTree(out_dir)
- print 'Removed Chromium out dir: %s.' % (out_dir)
-
-
def RunCommand(command, fail_hard=True):
"""Run command and return success (True) or failure; or if fail_hard is
True, exit on failure."""
@@ -225,9 +222,6 @@ def UpdateClang(args):
return 0
AddCMakeToPath()
- if args.clobber:
- ClobberChromiumBuildFiles()
-
# Reset the stamp file in case the build is unsuccessful.
WriteStampFile('')
@@ -308,12 +302,15 @@ def main():
# dup()ed sys.stdin is writable, try
# fd2 = os.dup(sys.stdin.fileno()); os.write(fd2, 'hi')
# TODO: Fix gclient instead, http://crbug.com/95350
+ try:
+ stderr = os.fdopen(os.dup(sys.stdin.fileno()))
+ except:
+ stderr = sys.stderr
return subprocess.call(
- [os.path.join(os.path.dirname(__file__), 'update.sh')] + sys.argv[1:],
- stderr=os.fdopen(os.dup(sys.stdin.fileno())))
+ [os.path.join(os.path.dirname(__file__), 'update.sh')] + sys.argv[1:],
+ stderr=stderr)
parser = argparse.ArgumentParser(description='Build Clang.')
- parser.add_argument('--no-clobber', dest='clobber', action='store_false')
parser.add_argument('--tools', nargs='*', default=['plugins'])
# For now, this flag is only used for the non-Windows flow, but argparser gets
# mad if it sees a flag it doesn't recognize.
« no previous file with comments | « tools/clang/scripts/posix-print-revision.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698