Переглянути джерело

Remove CPATH,LIBRARY_PATH,SDKROOT env vars set by macOS python3

macOS python3 sets those env vars implicitly. https://openradar.appspot.com/radar?id=5608755232243712

Removing them to avoid changing clang's behaviors.

Fixed: 1403485
Change-Id: I2ecf0cad8a1f69f5d7d180d2a2a003ce97365f3f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4149962
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Auto-Submit: Junji Watanabe <jwata@google.com>
Junji Watanabe 2 роки тому
батько
коміт
3e7206ff0a
1 змінених файлів з 9 додано та 0 видалено
  1. 9 0
      ninja.py

+ 9 - 0
ninja.py

@@ -75,6 +75,15 @@ def main(args):
   if (sys.platform.startswith('win') and len(args) == 2):
   if (sys.platform.startswith('win') and len(args) == 2):
     args = args[:1] + args[1].split(' ')
     args = args[:1] + args[1].split(' ')
 
 
+  # macOS's python sets CPATH, LIBRARY_PATH, SDKROOT implicitly.
+  # https://openradar.appspot.com/radar?id=5608755232243712
+  #
+  # Removing thoese environment variables to avoid affecting clang's behaviors.
+  if sys.platform == 'darwin':
+    os.environ.pop("CPATH", None)
+    os.environ.pop("LIBRARY_PATH", None)
+    os.environ.pop("SDKROOT", None)
+
   # Get gclient root + src.
   # Get gclient root + src.
   primary_solution_path = gclient_paths.GetPrimarySolutionPath()
   primary_solution_path = gclient_paths.GetPrimarySolutionPath()
   gclient_root_path = gclient_paths.FindGclientRoot(os.getcwd())
   gclient_root_path = gclient_paths.FindGclientRoot(os.getcwd())