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 override = os.environ.get('CHROMIUM_BUILDTOOLS_PATH') |
| 665 if override is not None: |
| 666 return override |
| 667 |
661 gclient_root = FindGclientRoot(os.getcwd()) | 668 gclient_root = FindGclientRoot(os.getcwd()) |
662 if not gclient_root: | 669 if not gclient_root: |
663 # Some projects might not use .gclient. Try to see whether we're in a git | 670 # Some projects might not use .gclient. Try to see whether we're in a git |
664 # checkout. | 671 # checkout. |
665 top_dir = [os.getcwd()] | 672 top_dir = [os.getcwd()] |
666 def filter_fn(line): | 673 def filter_fn(line): |
667 top_dir[0] = os.path.normpath(line.rstrip('\n')) | 674 top_dir[0] = os.path.normpath(line.rstrip('\n')) |
668 try: | 675 try: |
669 CheckCallAndFilter(["git", "rev-parse", "--show-toplevel"], | 676 CheckCallAndFilter(["git", "rev-parse", "--show-toplevel"], |
670 print_stdout=False, filter_fn=filter_fn) | 677 print_stdout=False, filter_fn=filter_fn) |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 def DefaultIndexPackConfig(url=''): | 1141 def DefaultIndexPackConfig(url=''): |
1135 """Return reasonable default values for configuring git-index-pack. | 1142 """Return reasonable default values for configuring git-index-pack. |
1136 | 1143 |
1137 Experiments suggest that higher values for pack.threads don't improve | 1144 Experiments suggest that higher values for pack.threads don't improve |
1138 performance.""" | 1145 performance.""" |
1139 cache_limit = DefaultDeltaBaseCacheLimit() | 1146 cache_limit = DefaultDeltaBaseCacheLimit() |
1140 result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit] | 1147 result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit] |
1141 if url in THREADED_INDEX_PACK_BLACKLIST: | 1148 if url in THREADED_INDEX_PACK_BLACKLIST: |
1142 result.extend(['-c', 'pack.threads=1']) | 1149 result.extend(['-c', 'pack.threads=1']) |
1143 return result | 1150 return result |
OLD | NEW |