--- /dev/null
+https://github.com/GoogleCloudPlatform/gcs-oauth2-boto-plugin/pull/18
+
+--- a/gcs_oauth2_boto_plugin/oauth2_client.py
++++ b/gcs_oauth2_boto_plugin/oauth2_client.py
+@@ -122,7 +122,7 @@ except ImportError:
+ retval.token_expiry = datetime.datetime.strptime(
+ data['token_expiry'], EXPIRY_FORMAT)
+ return retval
+- except KeyError, e:
++ except KeyError as e:
+ raise Exception('Your JSON credentials are invalid; '
+ 'missing required entry %s.' % e[0])
+ # pylint: enable=protected-access
+@@ -274,7 +274,7 @@ class FileSystemTokenCache(TokenCache):
+ flags |= os.O_BINARY
+
+ try:
+- fd = os.open(cache_file, flags, 0600)
++ fd = os.open(cache_file, flags, 0o0600)
+ except (OSError, IOError) as e:
+ LOG.warning('FileSystemTokenCache.PutToken: '
+ 'Failed to create cache file %s: %s', cache_file, e)
+@@ -633,7 +633,7 @@ class OAuth2UserAccountClient(OAuth2Client):
+ return AccessToken(
+ credentials.access_token, credentials.token_expiry,
+ datetime_strategy=self.datetime_strategy)
+- except AccessTokenRefreshError, e:
++ except AccessTokenRefreshError as e:
+ if 'Invalid response 403' in e.message:
+ # This is the most we can do at the moment to accurately detect rate
+ # limiting errors since they come back as 403s with no further
+@@ -669,7 +669,7 @@ class OAuth2GCEClient(OAuth2Client):
+ http = httplib2.Http()
+ response, content = http.request(META_TOKEN_URI, method='GET',
+ body=None, headers=META_HEADERS)
+- except Exception, e:
++ except Exception as e:
+ raise GsAccessTokenRefreshError(e)
+
+ if response.status == 200:
+@@ -695,7 +695,7 @@ def _IsGCE():
+ # this approach, we'll avoid having to enumerate all possible non-transient
+ # socket errors.
+ return False
+- except Exception, e: # pylint: disable=broad-except
++ except Exception as e: # pylint: disable=broad-except
+ LOG.warning("Failed to determine whether we're running on GCE, so we'll"
+ "assume that we aren't: %s", e)
+ return False
+--- a/gcs_oauth2_boto_plugin/test_oauth2_client.py
++++ b/gcs_oauth2_boto_plugin/test_oauth2_client.py
+@@ -248,7 +248,7 @@ class FileSystemTokenCacheTest(unittest.TestCase):
+ # Assert that the cache file exists and has correct permissions.
+ if not IS_WINDOWS:
+ self.assertEquals(
+- 0600,
++ 0o0600,
+ stat.S_IMODE(os.stat(self.cache.CacheFileName(self.key)).st_mode))
+
+ def testPutGet(self):
--- /dev/null
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+PYTHON_COMPAT=( python{2_7,3_4,3_5} )
+
+inherit distutils-r1
+
+DESCRIPTION="OAuth 2.0 plugin for Google Cloud Storage credentials in the Boto library"
+HOMEPAGE="https://pypi.python.org/pypi/gcs-oauth2-boto-plugin"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="test"
+# The tests only work with py2 atm.
+RESTRICT="test"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-1.13-use-friendy-version-checks.patch"
+ "${FILESDIR}/${PN}-1.13-py3.patch"
+)
+
+# Keep versions in sync with setup.py.
+DEPEND="${PYTHON_DEPS}
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ test? (
+ dev-python/freezegun[${PYTHON_USEDEP}]
+ )"
+RDEPEND="${PYTHON_DEPS}
+ >=dev-python/boto-2.29.1[${PYTHON_USEDEP}]
+ >=dev-python/httplib2-0.8[${PYTHON_USEDEP}]
+ >=dev-python/oauth2client-1.5.2[${PYTHON_USEDEP}]
+ !=dev-python/oauth2client-2.0*
+ >=dev-python/pyopenssl-0.13[${PYTHON_USEDEP}]
+ >=dev-python/retry-decorator-1.0.0[${PYTHON_USEDEP}]
+ >=dev-python/PySocks-1.01[${PYTHON_USEDEP}]
+ >=dev-python/six-1.6.1[${PYTHON_USEDEP}]"
+
+python_prepare_all() {
+ distutils-r1_python_prepare_all
+ sed -i \
+ -e '/SocksiPy-branch/d' \
+ setup.py || die
+ # Make sure the unittests aren't installed.
+ mv gcs_oauth2_boto_plugin/test_oauth2_client.py ./ || die
+}
+
+python_test() {
+ ${EPYTHON} "${S}"/test_oauth2_client.py || die
+}