Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(788)

Unified Diff: third_party/gsutil/gslib/util.py

Issue 86123002: Adds SSO auth to gsutil (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Bug fix or -> and Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/gsutil/gslib/command.py ('k') | third_party/gsutil/gsutil » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/gsutil/gslib/util.py
diff --git a/third_party/gsutil/gslib/util.py b/third_party/gsutil/gslib/util.py
index 75daba8abf47c0592fd6a8f51151120113aa3a78..c8057885522e2ea4ba98c2a51611df3bb39698e5 100644
--- a/third_party/gsutil/gslib/util.py
+++ b/third_party/gsutil/gslib/util.py
@@ -16,6 +16,7 @@
import math
import re
+import os
import sys
import time
@@ -61,7 +62,7 @@ class ListingStyle(object):
LONG_LONG = 'LONG_LONG'
-def HasConfiguredCredentials():
+def HasConfiguredCredentials(bypass_prodaccess):
"""Determines if boto credential/config file exists."""
config = boto.config
has_goog_creds = (config.has_option('Credentials', 'gs_access_key_id') and
@@ -71,8 +72,10 @@ def HasConfiguredCredentials():
has_oauth_creds = (HAVE_OAUTH2 and
config.has_option('Credentials', 'gs_oauth2_refresh_token'))
has_auth_plugins = config.has_option('Plugin', 'plugin_directory')
+ # Pretend prodaccess doesn't exist if --bypass_prodaccess is passed in.
+ has_prodaccess = HasExecutable('prodaccess') and not bypass_prodaccess
return (has_goog_creds or has_amzn_creds or has_oauth_creds
- or has_auth_plugins)
+ or has_auth_plugins or has_prodaccess)
def _RoundToNearestExponent(num):
@@ -153,3 +156,12 @@ def ExtractErrorDetail(e):
if detail_start != -1 and detail_end != -1:
return (exc_name, e.body[detail_start+9:detail_end])
return (exc_name, None)
+
+
+def HasExecutable(filename):
+ """Determines if an executable is available on the system."""
+ for path in os.environ['PATH'].split(os.pathsep):
+ exe_file = os.path.join(path, filename)
+ if os.path.exists(exe_file) and os.access(exe_file, os.X_OK):
+ return True
+ return False
« no previous file with comments | « third_party/gsutil/gslib/command.py ('k') | third_party/gsutil/gsutil » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698