Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(466)

Side by Side Diff: gclient_utils.py

Issue 341533006: Make gn wrapper use the one in buildtools rather than tools/gn/bin. (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | gn.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 """Returns 'mac', 'win', or 'linux', matching the current platform.""" 643 """Returns 'mac', 'win', or 'linux', matching the current platform."""
644 if sys.platform.startswith(('cygwin', 'win')): 644 if sys.platform.startswith(('cygwin', 'win')):
645 return 'win' 645 return 'win'
646 elif sys.platform.startswith('linux'): 646 elif sys.platform.startswith('linux'):
647 return 'linux' 647 return 'linux'
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():
M-A Ruel 2014/06/18 00:55:36 Why put these functions here and not put it in gn.
brettw 2014/06/18 05:41:18 I think some more stuff will be added to buildtool
654 """Returns the full path to the buildtools directory.
655 This is based on the root of the checkout containing the current directory."""
656 gclient_root = FindGclientRoot(os.getcwd())
657 if not gclient_root:
658 return None
659 return os.path.join(gclient_root, 'src', 'buildtools')
660
661
662 def GetBuildtoolsPlatformBinaryPath():
663 """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
665 # it's 32 or 64 bits.
666 buildtools_path = GetBuildtoolsPath()
667 if not buildtools_path:
668 return None;
669
670 if sys.platform.startswith(('cygwin', 'win')):
671 subdir = 'win'
672 elif sys.platform == 'darwin':
673 subdir = 'mac'
iannucci 2014/06/20 22:24:22 Can we keep the naming scheme uniform across all p
brettw 2014/06/20 23:43:37 That doesn't really make sense. The idea here is t
674 elif sys.platform.startswith('linux'):
675 if sys.maxsize > 2**32:
676 subdir = 'linux64'
677 else:
678 subdir = 'linux32'
679 else:
680 raise Error('Unknown platform: ' + sys.platform)
681 return os.path.join(buildtools_path, subdir)
682
683
653 def GetExeSuffix(): 684 def GetExeSuffix():
654 """Returns '' or '.exe' depending on how executables work on this platform.""" 685 """Returns '' or '.exe' depending on how executables work on this platform."""
655 if sys.platform.startswith(('cygwin', 'win')): 686 if sys.platform.startswith(('cygwin', 'win')):
656 return '.exe' 687 return '.exe'
657 return '' 688 return ''
658 689
659 690
660 def GetGClientRootAndEntries(path=None): 691 def GetGClientRootAndEntries(path=None):
661 """Returns the gclient root and the dict of entries.""" 692 """Returns the gclient root and the dict of entries."""
662 config_file = '.gclient_entries' 693 config_file = '.gclient_entries'
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 def DefaultIndexPackConfig(url=''): 1114 def DefaultIndexPackConfig(url=''):
1084 """Return reasonable default values for configuring git-index-pack. 1115 """Return reasonable default values for configuring git-index-pack.
1085 1116
1086 Experiments suggest that higher values for pack.threads don't improve 1117 Experiments suggest that higher values for pack.threads don't improve
1087 performance.""" 1118 performance."""
1088 cache_limit = DefaultDeltaBaseCacheLimit() 1119 cache_limit = DefaultDeltaBaseCacheLimit()
1089 result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit] 1120 result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit]
1090 if url in THREADED_INDEX_PACK_BLACKLIST: 1121 if url in THREADED_INDEX_PACK_BLACKLIST:
1091 result.extend(['-c', 'pack.threads=1']) 1122 result.extend(['-c', 'pack.threads=1'])
1092 return result 1123 return result
OLDNEW
« no previous file with comments | « no previous file | gn.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698