Chromium Code Reviews| Index: tools/clang/scripts/update.py |
| diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py |
| index e4ae1cee1368269d592b4cf3568a4ae39ae4231e..0e1092604fa1b7499d21a0f4e14cd582200c2ee5 100755 |
| --- a/tools/clang/scripts/update.py |
| +++ b/tools/clang/scripts/update.py |
| @@ -99,6 +99,29 @@ def Checkout(name, url, dir): |
| url + '@' + LLVM_WIN_REVISION, dir], tries=2) |
| +def AddCmakeToPath(): |
|
Nico
2014/08/05 18:48:51
nit: CMake
hans
2014/08/05 18:52:40
Done.
|
| + """Look for CMake and add it to PATH if it's not there already.""" |
| + try: |
| + # First check if cmake is already on PATH. |
| + subprocess.call(['cmake', '--version']) |
| + print "Already on path." |
|
Nico
2014/08/05 18:48:51
remove
hans
2014/08/05 18:52:40
Gah! Well, at least now you know I tested it ;)
|
| + return |
| + except OSError as e: |
| + if e.errno != os.errno.ENOENT: |
| + raise |
| + |
| + cmake_locations = ['C:\\Program Files (x86)\\CMake\\bin', |
| + 'C:\\Program Files (x86)\\CMake 2.8\\bin'] |
| + for d in cmake_locations: |
| + print "Searching %s" % (d) |
|
Nico
2014/08/05 18:48:51
remove
hans
2014/08/05 18:52:40
Done.
|
| + if os.path.isdir(d): |
| + os.environ['PATH'] = os.environ.get('PATH', '') + os.pathsep + d |
| + print "PATH: %s" % (os.environ['PATH']) |
|
Nico
2014/08/05 18:48:51
remove (can be added back temporarily if we need t
hans
2014/08/05 18:52:40
Done.
|
| + return |
| + print 'Failed to find CMake!' |
| + sys.exit(1) |
| + |
| + |
| vs_version = None |
| def GetVSVersion(): |
| global vs_version |
| @@ -118,6 +141,7 @@ def UpdateClang(): |
| print 'Already up to date.' |
| return 0 |
| + AddCmakeToPath() |
| ClobberChromiumBuildFiles() |
| # Reset the stamp file in case the build is unsuccessful. |
| @@ -131,10 +155,6 @@ def UpdateClang(): |
| os.makedirs(LLVM_BUILD_DIR) |
| os.chdir(LLVM_BUILD_DIR) |
| - if not re.search(r'cmake', os.environ['PATH'], flags=re.IGNORECASE): |
| - # If CMake is not on the path, try looking in a standard location. |
| - os.environ['PATH'] += os.pathsep + 'C:\\Program Files (x86)\\CMake 2.8\\bin' |
| - |
| RunCommand(GetVSVersion().SetupScript('x64') + |
| ['&&', 'cmake', '-GNinja', '-DCMAKE_BUILD_TYPE=Release', |
| '-DLLVM_ENABLE_ASSERTIONS=ON', LLVM_DIR]) |