| 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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 elif sys.platform == 'darwin': | 648 elif sys.platform == 'darwin': |
| 649 return 'mac' | 649 return 'mac' |
| 650 raise Error('Unknown platform: ' + sys.platform) | 650 raise Error('Unknown platform: ' + sys.platform) |
| 651 | 651 |
| 652 | 652 |
| 653 def GetBuildtoolsPath(): | 653 def GetBuildtoolsPath(): |
| 654 """Returns the full path to the buildtools directory. | 654 """Returns the full path to the buildtools directory. |
| 655 This is based on the root of the checkout containing the current directory.""" | 655 This is based on the root of the checkout containing the current directory.""" |
| 656 gclient_root = FindGclientRoot(os.getcwd()) | 656 gclient_root = FindGclientRoot(os.getcwd()) |
| 657 if not gclient_root: | 657 if not gclient_root: |
| 658 # Some projects might not use .gclient. Try to see whether we're in a git |
| 659 # checkout. |
| 660 top_dir = [os.getcwd()] |
| 661 def filter_fn(line): |
| 662 top_dir[0] = os.path.normpath(line.rstrip('\n')) |
| 663 try: |
| 664 CheckCallAndFilter(["git", "rev-parse", "--show-toplevel"], |
| 665 print_stdout=False, filter_fn=filter_fn) |
| 666 except Exception: |
| 667 pass |
| 668 top_dir = top_dir[0] |
| 669 if os.path.exists(os.path.join(top_dir, 'buildtools')): |
| 670 return os.path.join(top_dir, 'buildtools') |
| 658 return None | 671 return None |
| 659 return os.path.join(gclient_root, 'src', 'buildtools') | 672 return os.path.join(gclient_root, 'src', 'buildtools') |
| 660 | 673 |
| 661 | 674 |
| 662 def GetBuildtoolsPlatformBinaryPath(): | 675 def GetBuildtoolsPlatformBinaryPath(): |
| 663 """Returns the full path to the binary directory for the current platform.""" | 676 """Returns the full path to the binary directory for the current platform.""" |
| 664 # Mac and Windows just have one directory, Linux has two according to whether | 677 # Mac and Windows just have one directory, Linux has two according to whether |
| 665 # it's 32 or 64 bits. | 678 # it's 32 or 64 bits. |
| 666 buildtools_path = GetBuildtoolsPath() | 679 buildtools_path = GetBuildtoolsPath() |
| 667 if not buildtools_path: | 680 if not buildtools_path: |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 def DefaultIndexPackConfig(url=''): | 1127 def DefaultIndexPackConfig(url=''): |
| 1115 """Return reasonable default values for configuring git-index-pack. | 1128 """Return reasonable default values for configuring git-index-pack. |
| 1116 | 1129 |
| 1117 Experiments suggest that higher values for pack.threads don't improve | 1130 Experiments suggest that higher values for pack.threads don't improve |
| 1118 performance.""" | 1131 performance.""" |
| 1119 cache_limit = DefaultDeltaBaseCacheLimit() | 1132 cache_limit = DefaultDeltaBaseCacheLimit() |
| 1120 result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit] | 1133 result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit] |
| 1121 if url in THREADED_INDEX_PACK_BLACKLIST: | 1134 if url in THREADED_INDEX_PACK_BLACKLIST: |
| 1122 result.extend(['-c', 'pack.threads=1']) | 1135 result.extend(['-c', 'pack.threads=1']) |
| 1123 return result | 1136 return result |
| OLD | NEW |