[gsutil.py] Skip luci-auth wrapper on unsupported platforms

On unsupported platforms, luci-auth is not downloaded from CIPD and
hence the scripts relying on gsutil.py fail. Given we aren't using
luci-auth in unsupported platforms anyway, skip wrapping gsutil with
luci-auth on unsupported platforms.

Curently, only "aix" is added to the unsupported platforms list
eventhough we have other unsupported platforms too. This list will be
expanded if necessary.

R=yiwzhang

Change-Id: I70f6fceddc672c76bbea9a108a75b84662e26459
Fixed: 1467752
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4989412
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Auto-Submit: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
diff --git a/gsutil.py b/gsutil.py
index 4dcb2d6..3534760 100755
--- a/gsutil.py
+++ b/gsutil.py
@@ -36,6 +36,10 @@
 ]
 
 
+# Platforms unsupported by luci-auth.
+LUCI_AUTH_UNSUPPORTED_PLATFORMS = ['aix']
+
+
 class InvalidGsutilError(Exception):
     pass
 
@@ -154,6 +158,12 @@
         return False
 
 
+def _is_luci_auth_supported_platform():
+    """Returns True if luci-auth is supported in the current platform."""
+    return not any(map(sys.platform.startswith,
+                       LUCI_AUTH_UNSUPPORTED_PLATFORMS))
+
+
 def luci_context(cmd):
     """Helper to call`luci-auth context`."""
     p = _luci_auth_cmd('context', wrapped_cmds=cmd)
@@ -264,8 +274,9 @@
         _print_subprocess_result(p)
         return p.returncode
 
-    # Skip wrapping commands if luci-auth is already being
-    if _is_luci_context():
+    # Skip wrapping commands if luci-auth is already being used or if the
+    # platform is unsupported by luci-auth.
+    if _is_luci_context() or not _is_luci_auth_supported_platform():
         return _run_subprocess(cmd, interactive=True).returncode
 
     # Wrap gsutil with luci-auth context.