From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jeremy Apthorp <nornagon@nornagon.net>
Date: Fri, 12 Apr 2019 12:47:57 -0700
Subject: patch_the_ensure_gn_version_py_script_to_work_on_mac_ci.patch

This patches the ensure_gn_version_py script to work on macOS CI.
This script is temporary until https://crbug.com/944667 is resolved. We need to
patch it because on mac CI, we check out the source code on Linux, which
confuses the script.

diff --git a/buildtools/ensure_gn_version.py b/buildtools/ensure_gn_version.py
index cfc75a37792a93f209a0e7543d577a18d004a615..dd8c3468a914f44050b19002cb2c2df312038398 100755
--- a/buildtools/ensure_gn_version.py
+++ b/buildtools/ensure_gn_version.py
@@ -45,6 +45,11 @@ def ChmodGnFile(path_to_exe):
            stat.S_IROTH | stat.S_IXOTH)
 
 def main():
+  # NB. on Electron's CI we check out the macOS source on Linux. Bypass this
+  # check as it's not relevant on Electron CI and it gets confused.
+  if os.environ.get('CI') is not None:
+    return 0
+
   parser = argparse.ArgumentParser()
   parser.add_argument('version',
           help='CIPD "git_revision:XYZ" label for GN to sync to')
