Chromium Code Reviews| Index: gclient_utils.py |
| diff --git a/gclient_utils.py b/gclient_utils.py |
| index e8d916e78d5d2a8aeba4cbf61bebf7b64ad79084..7cc42a6a3ebcfd19ca16e57bb0cabe5afa27cd52 100644 |
| --- a/gclient_utils.py |
| +++ b/gclient_utils.py |
| @@ -681,7 +681,10 @@ def GetBuildtoolsPath(): |
| if os.path.exists(os.path.join(top_dir, 'buildtools')): |
| return os.path.join(top_dir, 'buildtools') |
| return None |
| - return os.path.join(gclient_root, 'src', 'buildtools') |
| + |
| + # Some projects' top directory is not named 'src'. |
| + source_dir_name = GetGClientPrimarySolutionName(gclient_root) or 'src' |
| + return os.path.join(gclient_root, source_dir_name, 'buildtools') |
| def GetBuildtoolsPlatformBinaryPath(): |
| @@ -713,6 +716,18 @@ def GetExeSuffix(): |
| return '' |
| +def GetGClientPrimarySolutionName(gclient_root_dir_path): |
| + """Returns the name of the primary solution in the .gclient file specified.""" |
| + gclient_config_file = os.path.join(gclient_root_dir_path, '.gclient') |
| + env = {} |
| + execfile(gclient_config_file, env) |
| + if (env.has_key('solutions') and |
|
agable
2014/09/05 11:31:53
I would rewrite this clause as:
solutions = env.ge
kjellander_chromium
2014/09/05 12:24:31
You're right. Covering the case with zero solution
|
| + len(env['solutions']) > 0 and |
| + env['solutions'][0].has_key('name')): |
| + return env['solutions'][0]['name'] |
| + return None |
| + |
| + |
| def GetGClientRootAndEntries(path=None): |
| """Returns the gclient root and the dict of entries.""" |
| config_file = '.gclient_entries' |