Skip to content

Commit

Permalink
Using __version__ in datastore and storage.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhermes committed Feb 22, 2017
1 parent bf2867c commit 5a9f079
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
3 changes: 3 additions & 0 deletions datastore/google/cloud/datastore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
"""


from pkg_resources import get_distribution
__version__ = get_distribution('google-cloud-datastore').version

from google.cloud.datastore.batch import Batch
from google.cloud.datastore.client import Client
from google.cloud.datastore.entity import Entity
Expand Down
7 changes: 3 additions & 4 deletions datastore/google/cloud/datastore/_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"""Connections to Google Cloud Datastore API servers."""

import os
from pkg_resources import get_distribution

from google.rpc import status_pb2

Expand All @@ -24,6 +23,8 @@
from google.cloud.environment_vars import GCD_HOST
from google.cloud import exceptions
from google.cloud.grpc.datastore.v1 import datastore_pb2 as _datastore_pb2

from google.cloud.datastore import __version__
try:
from google.cloud.datastore._gax import _DatastoreAPIOverGRPC
_HAVE_GRPC = True
Expand All @@ -37,9 +38,7 @@

_DISABLE_GRPC = os.getenv(DISABLE_GRPC, False)
_USE_GRPC = _HAVE_GRPC and not _DISABLE_GRPC
_DATASTORE_DIST = get_distribution('google-cloud-datastore')
_CLIENT_INFO = connection_module.CLIENT_INFO_TEMPLATE.format(
_DATASTORE_DIST.version)
_CLIENT_INFO = connection_module.CLIENT_INFO_TEMPLATE.format(__version__)


class _DatastoreAPIOverHttp(object):
Expand Down
4 changes: 4 additions & 0 deletions storage/google/cloud/storage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
machine).
"""


from pkg_resources import get_distribution
__version__ = get_distribution('google-cloud-storage').version

from google.cloud.storage.batch import Batch
from google.cloud.storage.blob import Blob
from google.cloud.storage.bucket import Bucket
Expand Down
7 changes: 3 additions & 4 deletions storage/google/cloud/storage/_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@

"""Create / interact with Google Cloud Storage connections."""

from pkg_resources import get_distribution

from google.cloud import _http

from google.cloud.storage import __version__


_STORAGE_DIST = get_distribution('google-cloud-storage')
_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(_STORAGE_DIST.version)
_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)


class Connection(_http.JSONConnection):
Expand Down

0 comments on commit 5a9f079

Please sign in to comment.