Skip to content

Commit 56cca5e

Browse files
authored
fix: add google-auth as a direct dependency (#1923)
1 parent 40be335 commit 56cca5e

File tree

34 files changed

+2452
-2368
lines changed

34 files changed

+2452
-2368
lines changed

packages/gapic-generator/gapic/ads-templates/setup.py.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ else:
3030

3131
dependencies = [
3232
"google-api-core[grpc] >= 2.10.0, < 3.0.0dev",
33+
"google-auth >= 2.14.1, <3.0.0dev",
3334
"googleapis-common-protos >= 1.53.0",
3435
"grpcio >= 1.10.0",
3536
"proto-plus >= 1.22.3, <2.0.0dev",

packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
304304
raise MutualTLSChannelError("Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`")
305305
return use_client_cert == "true", use_mtls_endpoint, universe_domain_env
306306

307+
@staticmethod
307308
def _get_client_cert_source(provided_cert_source, use_cert_flag):
308309
"""Return the client cert source to be used by the client.
309310

@@ -322,6 +323,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
322323
client_cert_source = mtls.default_client_cert_source()
323324
return client_cert_source
324325

326+
@staticmethod
325327
def _get_api_endpoint(api_override, client_cert_source, universe_domain, use_mtls_endpoint):
326328
"""Return the API endpoint used by the client.
327329

@@ -385,15 +387,16 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
385387
Raises:
386388
ValueError: when client_universe does not match the universe in credentials.
387389
"""
388-
if credentials:
389-
credentials_universe = credentials.universe_domain
390-
if client_universe != credentials_universe:
391-
default_universe = {{ service.client_name }}._DEFAULT_UNIVERSE
392-
raise ValueError("The configured universe domain "
393-
f"({client_universe}) does not match the universe domain "
394-
f"found in the credentials ({credentials_universe}). "
395-
"If you haven't configured the universe domain explicitly, "
396-
f"`{default_universe}` is the default.")
390+
391+
default_universe = {{ service.client_name }}._DEFAULT_UNIVERSE
392+
credentials_universe = getattr(credentials, "universe_domain", default_universe)
393+
394+
if client_universe != credentials_universe:
395+
raise ValueError("The configured universe domain "
396+
f"({client_universe}) does not match the universe domain "
397+
f"found in the credentials ({credentials_universe}). "
398+
"If you haven't configured the universe domain explicitly, "
399+
f"`{default_universe}` is the default.")
397400
return True
398401

399402
def _validate_universe_domain(self):

packages/gapic-generator/gapic/templates/setup.py.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ else:
3131

3232
dependencies = [
3333
"google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*",
34+
"google-auth >= 2.14.1, <3.0.0dev",
3435
"proto-plus >= 1.22.3, <2.0.0dev",
3536
{# Explicitly exclude protobuf versions mentioned in https://cloud.google.com/support/bulletins#GCP-2022-019 #}
3637
"protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",

packages/gapic-generator/gapic/templates/testing/constraints-3.7.txt.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev",
77
# Then this file should have google-cloud-foo==1.14.0
88
google-api-core==1.34.0
9+
google-auth==2.14.1
910
proto-plus==1.22.3
1011
protobuf==3.19.5
1112
{% for package_tuple, package_info in pypi_packages.items() %}

0 commit comments

Comments
 (0)