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

Unified Diff: tools/pyutils/gs_utils.py

Issue 381933002: import google-api-python-client using DEPS (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: added httplib2 and uritemplate to DEPS Created 6 years, 5 months 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 | « DEPS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/pyutils/gs_utils.py
diff --git a/tools/pyutils/gs_utils.py b/tools/pyutils/gs_utils.py
index 2659c03e63198996d22a295fa008053173b59042..fdf16adb82bca0d4f1061d19d93438cc65d00549 100755
--- a/tools/pyutils/gs_utils.py
+++ b/tools/pyutils/gs_utils.py
@@ -7,20 +7,36 @@ Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
Utilities for accessing Google Cloud Storage.
-
-TODO(epoger): move this into tools/utils for broader use?
"""
# System-level imports
import os
import posixpath
import sys
+
+# Imports from third-party code
+TRUNK_DIRECTORY = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
+for import_subdir in ['google-api-python-client', 'httplib2', 'oauth2client',
+ 'uritemplate-py']:
+ import_dirpath = os.path.join(
+ TRUNK_DIRECTORY, 'third_party', 'externals', import_subdir)
+ if import_dirpath not in sys.path:
+ # We need to insert at the beginning of the path, to make sure that our
+ # imported versions are favored over others that might be in the path.
+ # Also, the google-api-python-client checkout contains an empty
+ # oauth2client directory, which will confuse things unless we insert
+ # our checked-out oauth2client in front of it in the path.
+ sys.path.insert(0, import_dirpath)
try:
- from apiclient.discovery import build as build_service
+ from googleapiclient.discovery import build as build_service
except ImportError:
- print ('Missing google-api-python-client. Please install it; directions '
+ # TODO(epoger): We are moving toward not needing any dependencies to be
+ # installed at a system level, but in the meanwhile, if developers run into
+ # trouble they can install those system-level dependencies to get unblocked.
+ print ('Missing dependencies of google-api-python-client. Please install '
+ 'google-api-python-client to get those dependencies; directions '
'can be found at https://developers.google.com/api-client-library/'
- 'python/start/installation')
+ 'python/start/installation . More details in http://skbug.com/2641 ')
raise
# Local imports
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698