Allow using oauth2client versions < 2
Be compatible with older oauth2client versions. This simplifies
the installation (also for downstream) when software needs an older
oauth2client version but also wants to use googleapiclient.
diff --git a/googleapiclient/discovery_cache/file_cache.py b/googleapiclient/discovery_cache/file_cache.py
index 8b0301d..7526ed9 100644
--- a/googleapiclient/discovery_cache/file_cache.py
+++ b/googleapiclient/discovery_cache/file_cache.py
@@ -29,7 +29,11 @@
import tempfile
import threading
-from oauth2client.contrib.locked_file import LockedFile
+try:
+ from oauth2client.contrib.locked_file import LockedFile
+except ImportError:
+ # oauth2client < 2.0.0
+ from oauth2client.locked_file import LockedFile
from . import base
from ..discovery_cache import DISCOVERY_DOC_MAX_AGE
diff --git a/setup.py b/setup.py
index d78f825..7dd6a0a 100644
--- a/setup.py
+++ b/setup.py
@@ -64,7 +64,7 @@
install_requires = [
'httplib2>=0.8,<1',
- 'oauth2client>=2.0.0,<3',
+ 'oauth2client',
'six>=1.6.1,<2',
'uritemplate>=0.6,<1',
]
diff --git a/tox.ini b/tox.ini
index 595a98a..44f21da 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,8 +1,11 @@
[tox]
-envlist = py26, py27, py33, py34
+envlist = py{26,27,33,34}-oauth2client{1,2}
[testenv]
-deps = keyring
+deps =
+ oauth2client1: oauth2client<2
+ oauth2client2: oauth2client>=2,<=3
+ keyring
mox
pyopenssl
pycrypto==2.6