| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Functions for discovering the build directory.""" | 5 """Functions for discovering the build directory.""" |
| 6 | 6 |
| 7 import os | 7 import os |
| 8 import sys | 8 import sys |
| 9 | 9 |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 return ninja_stat > xcode_stat | 37 return ninja_stat > xcode_stat |
| 38 | 38 |
| 39 | 39 |
| 40 def ConvertBuildDirToLegacy(build_dir, use_out=False): | 40 def ConvertBuildDirToLegacy(build_dir, use_out=False): |
| 41 """Returns a tuple of (build_dir<str>, legacy<bool>). | 41 """Returns a tuple of (build_dir<str>, legacy<bool>). |
| 42 """ | 42 """ |
| 43 # TODO(thakis): Make this the canonical source of truth for build_dir for | 43 # TODO(thakis): Make this the canonical source of truth for build_dir for |
| 44 # slave scripts, remove all parameters. | 44 # slave scripts, remove all parameters. |
| 45 legacy_paths = { | 45 legacy_paths = { |
| 46 'darwin': 'xcodebuild', | 46 'darwin': 'xcodebuild', |
| 47 'linux': 'sconsbuild', | |
| 48 } | 47 } |
| 49 bad = False | 48 bad = False |
| 50 | 49 |
| 51 platform_key = None | 50 platform_key = None |
| 52 for key in legacy_paths: | 51 for key in legacy_paths: |
| 53 if sys.platform.startswith(key): | 52 if sys.platform.startswith(key): |
| 54 platform_key = key | 53 platform_key = key |
| 55 break | 54 break |
| 56 | 55 |
| 57 if (build_dir == 'src/build' and platform_key): | 56 if (build_dir == 'src/build' and platform_key): |
| 58 print >> sys.stderr, ( | 57 print >> sys.stderr, ( |
| 59 'WARNING: Passed "%s" as --build-dir option on %s. ' | 58 'WARNING: Passed "%s" as --build-dir option on %s. ' |
| 60 'This is almost certainly incorrect.' % (build_dir, platform_key)) | 59 'This is almost certainly incorrect.' % (build_dir, platform_key)) |
| 61 if use_out: | 60 if use_out: |
| 62 legacy_path = 'out' | 61 legacy_path = 'out' |
| 63 else: | 62 else: |
| 64 legacy_path = legacy_paths[platform_key] | 63 legacy_path = legacy_paths[platform_key] |
| 65 build_dir = os.path.join(os.path.dirname(build_dir), legacy_path) | 64 build_dir = os.path.join(os.path.dirname(build_dir), legacy_path) |
| 66 print >> sys.stderr, ('Assuming you meant "%s"' % build_dir) | 65 print >> sys.stderr, ('Assuming you meant "%s"' % build_dir) |
| 67 bad = True | 66 bad = True |
| 68 | 67 |
| 69 return (build_dir, bad) | 68 return (build_dir, bad) |
| OLD | NEW |