| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """This script is used to download prebuilt clang binaries. | 6 """This script is used to download prebuilt clang binaries. |
| 7 | 7 |
| 8 It is also used by package.py to build the prebuilt clang binaries.""" | 8 It is also used by package.py to build the prebuilt clang binaries.""" |
| 9 | 9 |
| 10 import argparse | 10 import argparse |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 # Subversion can leave read-only files around. | 166 # Subversion can leave read-only files around. |
| 167 if not os.access(path, os.W_OK): | 167 if not os.access(path, os.W_OK): |
| 168 os.chmod(path, stat.S_IWUSR) | 168 os.chmod(path, stat.S_IWUSR) |
| 169 return func(path) | 169 return func(path) |
| 170 raise | 170 raise |
| 171 | 171 |
| 172 shutil.rmtree(dir, onerror=ChmodAndRetry) | 172 shutil.rmtree(dir, onerror=ChmodAndRetry) |
| 173 | 173 |
| 174 | 174 |
| 175 def RmCmakeCache(dir): | 175 def RmCmakeCache(dir): |
| 176 """Delete CMakeCache.txt files under dir recursively.""" | 176 """Delete CMake cache related files from dir.""" |
| 177 for dirpath, _, files in os.walk(dir): | 177 for dirpath, dirs, files in os.walk(dir): |
| 178 if 'CMakeCache.txt' in files: | 178 if 'CMakeCache.txt' in files: |
| 179 os.remove(os.path.join(dirpath, 'CMakeCache.txt')) | 179 os.remove(os.path.join(dirpath, 'CMakeCache.txt')) |
| 180 if 'CMakeFiles' in dirs: |
| 181 RmTree(os.path.join(dirpath, 'CMakeFiles')) |
| 180 | 182 |
| 181 | 183 |
| 182 def RunCommand(command, msvc_arch=None, env=None, fail_hard=True): | 184 def RunCommand(command, msvc_arch=None, env=None, fail_hard=True): |
| 183 """Run command and return success (True) or failure; or if fail_hard is | 185 """Run command and return success (True) or failure; or if fail_hard is |
| 184 True, exit on failure. If msvc_arch is set, runs the command in a | 186 True, exit on failure. If msvc_arch is set, runs the command in a |
| 185 shell with the msvc tools for that architecture.""" | 187 shell with the msvc tools for that architecture.""" |
| 186 | 188 |
| 187 if msvc_arch and sys.platform == 'win32': | 189 if msvc_arch and sys.platform == 'win32': |
| 188 command = GetVSVersion().SetupScript(msvc_arch) + ['&&'] + command | 190 command = GetVSVersion().SetupScript(msvc_arch) + ['&&'] + command |
| 189 | 191 |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 args.force_local_build = True | 787 args.force_local_build = True |
| 786 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): | 788 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): |
| 787 # Only build the Android ASan rt on ToT bots when targetting Android. | 789 # Only build the Android ASan rt on ToT bots when targetting Android. |
| 788 args.with_android = False | 790 args.with_android = False |
| 789 | 791 |
| 790 return UpdateClang(args) | 792 return UpdateClang(args) |
| 791 | 793 |
| 792 | 794 |
| 793 if __name__ == '__main__': | 795 if __name__ == '__main__': |
| 794 sys.exit(main()) | 796 sys.exit(main()) |
| OLD | NEW |