Fix unhelpful error when gn.py run in wrong directory.

Before this change, when running gn.py outside of
the checkout, the error was:
AttributeError: 'NoneType' object has no attribute 'endswith'

R=scottmg@chromium.org
Bug: gn:14

Change-Id: I4f2f83b2a861bd6f9436c16c2c422fe18fab8f2a
Reviewed-on: https://chromium-review.googlesource.com/c/1299023
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Lowell Manners <lowell@google.com>
changes/23/1299023/3
Lowell Manners 6 years ago committed by Commit Bot
parent 4b49707cb5
commit 4d2d5b4bbe

10
gn.py

@ -45,10 +45,12 @@ def main(args):
# Try in primary solution location first, with the gn binary having been
# downloaded by cipd in the projects DEPS.
gn_path = os.path.join(gclient_utils.GetPrimarySolutionPath(), 'third_party',
'gn', 'gn' + gclient_utils.GetExeSuffix())
if os.path.exists(gn_path):
return subprocess.call([gn_path] + args[1:])
primary_solution_path = gclient_utils.GetPrimarySolutionPath()
if primary_solution_path:
gn_path = os.path.join(primary_solution_path, 'third_party',
'gn', 'gn' + gclient_utils.GetExeSuffix())
if os.path.exists(gn_path):
return subprocess.call([gn_path] + args[1:])
# Otherwise try the old .sha1 and download_from_google_storage locations
# inside of buildtools.

Loading…
Cancel
Save