diff --git a/synth.py b/synth.py index 21100c749..07c293339 100644 --- a/synth.py +++ b/synth.py @@ -45,7 +45,12 @@ s.move(library / "google/cloud/bigtable_admin_v2") s.move(library / "tests") -# Work around non-standard installations +# ---------------------------------------------------------------------------- +# Work around non-standard installations (missing setuptools). +# +# These replacements can be removed after migrating to the microgenerator, +# which will generate them directly. +# ---------------------------------------------------------------------------- admin_clients = [ "google/cloud/bigtable_admin_v2/gapic/bigtable_instance_admin_client.py", @@ -69,6 +74,23 @@ """ ) +s.replace( + "google/cloud/bigtable_v2/gapic/bigtable_client.py", + """\ +_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution\( + 'google-cloud-bigtable', +\).version +""", + """\ +try: + _GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution( + "google-cloud-bigtable" + ).version +except pkg_resources.DistributionNotFound: # pragma: NO COVER + _GAPIC_LIBRARY_VERSION = None +""" +) + # ---------------------------------------------------------------------------- # Add templated files # ----------------------------------------------------------------------------