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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gn.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_utils.py
===================================================================
--- gclient_utils.py (revision 278929)
+++ gclient_utils.py (working copy)
@@ -650,6 +650,37 @@
raise Error('Unknown platform: ' + sys.platform)
+def GetBuildtoolsPath():
+ """Returns the full path to the buildtools directory.
+ This is based on the root of the checkout containing the current directory."""
+ gclient_root = FindGclientRoot(os.getcwd())
+ if not gclient_root:
+ return None
+ return os.path.join(gclient_root, 'src', 'buildtools')
+
+
+def GetBuildtoolsPlatformBinaryPath():
+ """Returns the full path to the binary directory for the current platform."""
+ # Mac and Windows just have one directory, Linux has two according to whether
+ # it's 32 or 64 bits.
+ buildtools_path = GetBuildtoolsPath()
+ if not buildtools_path:
+ return None
+
+ if sys.platform.startswith(('cygwin', 'win')):
+ subdir = 'win'
+ elif sys.platform == 'darwin':
+ subdir = 'mac'
+ elif sys.platform.startswith('linux'):
+ if sys.maxsize > 2**32:
+ subdir = 'linux64'
+ else:
+ subdir = 'linux32'
+ else:
+ raise Error('Unknown platform: ' + sys.platform)
+ return os.path.join(buildtools_path, subdir)
+
+
def GetExeSuffix():
"""Returns '' or '.exe' depending on how executables work on this platform."""
if sys.platform.startswith(('cygwin', 'win')):
« 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