OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 import glob | 6 import glob |
7 import json | 7 import json |
8 import os | 8 import os |
9 import pipes | 9 import pipes |
10 import shutil | 10 import shutil |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 'get_toolchain_if_necessary.py'), | 324 'get_toolchain_if_necessary.py'), |
325 '--output-json', json_data_file, | 325 '--output-json', json_data_file, |
326 ] + _GetDesiredVsToolchainHashes() | 326 ] + _GetDesiredVsToolchainHashes() |
327 if force: | 327 if force: |
328 get_toolchain_args.append('--force') | 328 get_toolchain_args.append('--force') |
329 subprocess.check_call(get_toolchain_args) | 329 subprocess.check_call(get_toolchain_args) |
330 | 330 |
331 return 0 | 331 return 0 |
332 | 332 |
333 | 333 |
| 334 def NormalizePath(path): |
| 335 while path.endswith("\\"): |
| 336 path = path[:-1] |
| 337 return path |
| 338 |
| 339 |
334 def GetToolchainDir(): | 340 def GetToolchainDir(): |
335 """Gets location information about the current toolchain (must have been | 341 """Gets location information about the current toolchain (must have been |
336 previously updated by 'update'). This is used for the GN build.""" | 342 previously updated by 'update'). This is used for the GN build.""" |
337 runtime_dll_dirs = SetEnvironmentAndGetRuntimeDllDirs() | 343 runtime_dll_dirs = SetEnvironmentAndGetRuntimeDllDirs() |
338 | 344 |
339 # If WINDOWSSDKDIR is not set, search the default SDK path and set it. | 345 # If WINDOWSSDKDIR is not set, search the default SDK path and set it. |
340 if not 'WINDOWSSDKDIR' in os.environ: | 346 if not 'WINDOWSSDKDIR' in os.environ: |
341 default_sdk_path = 'C:\\Program Files (x86)\\Windows Kits\\10' | 347 default_sdk_path = 'C:\\Program Files (x86)\\Windows Kits\\10' |
342 if os.path.isdir(default_sdk_path): | 348 if os.path.isdir(default_sdk_path): |
343 os.environ['WINDOWSSDKDIR'] = default_sdk_path | 349 os.environ['WINDOWSSDKDIR'] = default_sdk_path |
344 | 350 |
345 print '''vs_path = "%s" | 351 print '''vs_path = "%s" |
346 sdk_path = "%s" | 352 sdk_path = "%s" |
347 vs_version = "%s" | 353 vs_version = "%s" |
348 wdk_dir = "%s" | 354 wdk_dir = "%s" |
349 runtime_dirs = "%s" | 355 runtime_dirs = "%s" |
350 ''' % ( | 356 ''' % ( |
351 os.environ['GYP_MSVS_OVERRIDE_PATH'], | 357 NormalizePath(os.environ['GYP_MSVS_OVERRIDE_PATH']), |
352 os.environ['WINDOWSSDKDIR'], | 358 NormalizePath(os.environ['WINDOWSSDKDIR']), |
353 GetVisualStudioVersion(), | 359 GetVisualStudioVersion(), |
354 os.environ.get('WDK_DIR', ''), | 360 NormalizePath(os.environ.get('WDK_DIR', '')), |
355 os.path.pathsep.join(runtime_dll_dirs or ['None'])) | 361 os.path.pathsep.join(runtime_dll_dirs or ['None'])) |
356 | 362 |
357 | 363 |
358 def main(): | 364 def main(): |
359 commands = { | 365 commands = { |
360 'update': Update, | 366 'update': Update, |
361 'get_toolchain_dir': GetToolchainDir, | 367 'get_toolchain_dir': GetToolchainDir, |
362 'copy_dlls': CopyDlls, | 368 'copy_dlls': CopyDlls, |
363 } | 369 } |
364 if len(sys.argv) < 2 or sys.argv[1] not in commands: | 370 if len(sys.argv) < 2 or sys.argv[1] not in commands: |
365 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) | 371 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) |
366 return 1 | 372 return 1 |
367 return commands[sys.argv[1]](*sys.argv[2:]) | 373 return commands[sys.argv[1]](*sys.argv[2:]) |
368 | 374 |
369 | 375 |
370 if __name__ == '__main__': | 376 if __name__ == '__main__': |
371 sys.exit(main()) | 377 sys.exit(main()) |
OLD | NEW |