import google-api-python-client using DEPS
authorepoger <epoger@google.com>
Thu, 10 Jul 2014 16:03:23 +0000 (09:03 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 10 Jul 2014 16:03:26 +0000 (09:03 -0700)
BUG=skia:2641
R=jcgregorio@google.com

Author: epoger@google.com

Review URL: https://codereview.chromium.org/381933002

DEPS
tools/pyutils/gs_utils.py

diff --git a/DEPS b/DEPS
index 029a284..ddcb8e6 100644 (file)
--- a/DEPS
+++ b/DEPS
@@ -17,6 +17,14 @@ deps = {
   "third_party/externals/libwebp" : "https://chromium.googlesource.com/webm/libwebp.git@3fe91635df8734b23f3c1b9d1f0c4fa8cfaf4e39",
   # "third_party/externals/v8" : "git://github.com/v8/v8.git@d15b0f0f2099dbd72867f3df70e9aaf5b8afbd2c",
   "third_party/externals/nanomsg": "git://github.com/nanomsg/nanomsg.git@0.4-beta",
+
+  # TODO(epoger): These dependencies are needed specifically for google-api-python-client (see http://skbug.com/2641 ).
+  # Once we get them working, we will want to move them all into the "common" repo
+  # (see http://skbug.com/2682 and https://codereview.chromium.org/377323002/ )
+  "third_party/externals/google-api-python-client" : "https://github.com/google/google-api-python-client.git@ecc64a0a2baa4a77f35dec83ad05c6c9ba2d2841",
+  "third_party/externals/httplib2" : "https://github.com/jcgregorio/httplib2.git@7d1b88a3cf34774242bf4c0578c09c0092bb05d8",
+  "third_party/externals/oauth2client" : "https://github.com/google/oauth2client.git@d02b317af0313dcf66755844f5421651af5eb356",
+  "third_party/externals/uritemplate-py" : "https://github.com/uri-templates/uritemplate-py.git@1e780a49412cdbb273e9421974cb91845c124f3f",
 }
 
 deps_os = {
index 2659c03..fdf16ad 100755 (executable)
@@ -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