Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Generic utils.""" | 5 """Generic utils.""" |
| 6 | 6 |
| 7 import codecs | 7 import codecs |
| 8 import cStringIO | 8 import cStringIO |
| 9 import datetime | 9 import datetime |
| 10 import logging | 10 import logging |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 651 elif sys.platform.startswith('linux'): | 651 elif sys.platform.startswith('linux'): |
| 652 return 'linux' | 652 return 'linux' |
| 653 elif sys.platform == 'darwin': | 653 elif sys.platform == 'darwin': |
| 654 return 'mac' | 654 return 'mac' |
| 655 raise Error('Unknown platform: ' + sys.platform) | 655 raise Error('Unknown platform: ' + sys.platform) |
| 656 | 656 |
| 657 | 657 |
| 658 def GetBuildtoolsPath(): | 658 def GetBuildtoolsPath(): |
| 659 """Returns the full path to the buildtools directory. | 659 """Returns the full path to the buildtools directory. |
| 660 This is based on the root of the checkout containing the current directory.""" | 660 This is based on the root of the checkout containing the current directory.""" |
| 661 | |
| 662 # Overriding the build tools path by environment is highly unsupported and may | |
| 663 # break without warning. Do not rely on this for anything important. | |
| 664 if 'CHROMIUM_BUILDTOOLS_PATH' in os.environ: | |
| 665 override = os.environ['CHROMIUM_BUILDTOOLS_PATH'] | |
|
iannucci
2014/08/13 22:56:49
os.environ.get could also work
val = os.environ.
| |
| 666 if override != None: | |
| 667 return override | |
| 668 | |
| 661 gclient_root = FindGclientRoot(os.getcwd()) | 669 gclient_root = FindGclientRoot(os.getcwd()) |
| 662 if not gclient_root: | 670 if not gclient_root: |
| 663 # Some projects might not use .gclient. Try to see whether we're in a git | 671 # Some projects might not use .gclient. Try to see whether we're in a git |
| 664 # checkout. | 672 # checkout. |
| 665 top_dir = [os.getcwd()] | 673 top_dir = [os.getcwd()] |
| 666 def filter_fn(line): | 674 def filter_fn(line): |
| 667 top_dir[0] = os.path.normpath(line.rstrip('\n')) | 675 top_dir[0] = os.path.normpath(line.rstrip('\n')) |
| 668 try: | 676 try: |
| 669 CheckCallAndFilter(["git", "rev-parse", "--show-toplevel"], | 677 CheckCallAndFilter(["git", "rev-parse", "--show-toplevel"], |
| 670 print_stdout=False, filter_fn=filter_fn) | 678 print_stdout=False, filter_fn=filter_fn) |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1134 def DefaultIndexPackConfig(url=''): | 1142 def DefaultIndexPackConfig(url=''): |
| 1135 """Return reasonable default values for configuring git-index-pack. | 1143 """Return reasonable default values for configuring git-index-pack. |
| 1136 | 1144 |
| 1137 Experiments suggest that higher values for pack.threads don't improve | 1145 Experiments suggest that higher values for pack.threads don't improve |
| 1138 performance.""" | 1146 performance.""" |
| 1139 cache_limit = DefaultDeltaBaseCacheLimit() | 1147 cache_limit = DefaultDeltaBaseCacheLimit() |
| 1140 result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit] | 1148 result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit] |
| 1141 if url in THREADED_INDEX_PACK_BLACKLIST: | 1149 if url in THREADED_INDEX_PACK_BLACKLIST: |
| 1142 result.extend(['-c', 'pack.threads=1']) | 1150 result.extend(['-c', 'pack.threads=1']) |
| 1143 return result | 1151 return result |
| OLD | NEW |