-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from GoogleCloudPlatform/master
Rebase after squash
- Loading branch information
Showing
108 changed files
with
13,282 additions
and
3,065 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,3 +57,4 @@ scripts/pylintrc_reduced | |
generated_python/ | ||
cloud-bigtable-client/ | ||
googleapis-pb/ | ||
grpc_python_venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
GRPCIO_VIRTUALENV=$(shell pwd)/grpc_python_venv | ||
GENERATED_DIR=$(shell pwd)/generated_python | ||
GENERATED_SUBDIR=_generated_v2 | ||
BIGTABLE_DIR=$(shell pwd)/gcloud/bigtable/$(GENERATED_SUBDIR) | ||
PROTOC_CMD=$(GRPCIO_VIRTUALENV)/bin/python -m grpc.tools.protoc | ||
GOOGLEAPIS_PROTOS_DIR=$(shell pwd)/googleapis-pb | ||
|
||
help: | ||
@echo 'Makefile for gcloud-python Bigtable protos ' | ||
@echo ' ' | ||
@echo ' make generate Generates the protobuf modules ' | ||
@echo ' make check_generate Checks that generate succeeded ' | ||
@echo ' make clean Clean generated files ' | ||
|
||
generate: | ||
# Ensure we have a virtualenv w/ up-to-date grpcio/grpcio-tools | ||
[ -d $(GRPCIO_VIRTUALENV) ] || python2.7 -m virtualenv $(GRPCIO_VIRTUALENV) | ||
$(GRPCIO_VIRTUALENV)/bin/pip install --upgrade grpcio grpcio-tools | ||
# Retrieve git repos that have our *.proto files. | ||
[ -d googleapis-pb ] || git clone https://github.com/google/googleapis googleapis-pb --depth=1 | ||
cd googleapis-pb && git pull origin master | ||
# Make the directory where our *_pb2.py files will go. | ||
mkdir -p $(GENERATED_DIR) | ||
# Generate all *_pb2.py files that require gRPC. | ||
$(PROTOC_CMD) \ | ||
--proto_path=$(GOOGLEAPIS_PROTOS_DIR) \ | ||
--python_out=$(GENERATED_DIR) \ | ||
--grpc_python_out=$(GENERATED_DIR) \ | ||
$(GOOGLEAPIS_PROTOS_DIR)/google/bigtable/v2/bigtable.proto \ | ||
$(GOOGLEAPIS_PROTOS_DIR)/google/bigtable/admin/v2/bigtable_instance_admin.proto \ | ||
$(GOOGLEAPIS_PROTOS_DIR)/google/bigtable/admin/v2/bigtable_table_admin.proto | ||
# Generate all *_pb2.py files that do not require gRPC. | ||
$(PROTOC_CMD) \ | ||
--proto_path=$(GOOGLEAPIS_PROTOS_DIR) \ | ||
--python_out=$(GENERATED_DIR) \ | ||
$(GOOGLEAPIS_PROTOS_DIR)/google/bigtable/v2/data.proto \ | ||
$(GOOGLEAPIS_PROTOS_DIR)/google/bigtable/admin/v2/common.proto \ | ||
$(GOOGLEAPIS_PROTOS_DIR)/google/bigtable/admin/v2/instance.proto \ | ||
$(GOOGLEAPIS_PROTOS_DIR)/google/bigtable/admin/v2/table.proto \ | ||
# Move the newly generated *_pb2.py files into our library. | ||
cp $(GENERATED_DIR)/google/bigtable/v2/* $(BIGTABLE_DIR) | ||
cp $(GENERATED_DIR)/google/bigtable/admin/v2/* $(BIGTABLE_DIR) | ||
# Remove all existing *.proto files before we replace | ||
rm -f $(BIGTABLE_DIR)/*.proto | ||
# Copy over the *.proto files into our library. | ||
cp $(GOOGLEAPIS_PROTOS_DIR)/google/bigtable/v2/*.proto $(BIGTABLE_DIR) | ||
cp $(GOOGLEAPIS_PROTOS_DIR)/google/bigtable/admin/v2/*.proto $(BIGTABLE_DIR) | ||
cp $(GOOGLEAPIS_PROTOS_DIR)/google/longrunning/operations.proto $(BIGTABLE_DIR) | ||
# Rename all *.proto files in our library with an | ||
# underscore and remove executable bit. | ||
cd $(BIGTABLE_DIR) && \ | ||
for filename in *.proto; do \ | ||
chmod -x $$filename ; \ | ||
mv $$filename _$$filename ; \ | ||
done | ||
# Separate the gRPC parts of the operations service from the | ||
# non-gRPC parts so that the protos from `googleapis-common-protos` | ||
# can be used without gRPC. | ||
GRPCIO_VIRTUALENV="$(GRPCIO_VIRTUALENV)" \ | ||
GENERATED_SUBDIR=$(GENERATED_SUBDIR) \ | ||
python scripts/make_operations_grpc.py | ||
# Rewrite the imports in the generated *_pb2.py files. | ||
python scripts/rewrite_imports.py $(BIGTABLE_DIR)/*pb2.py | ||
|
||
check_generate: | ||
python scripts/check_generate.py | ||
|
||
clean: | ||
rm -fr $(GRPCIO_VIRTUALENV) $(GOOGLEAPIS_PROTOS_DIR) $(GENERATED_DIR) | ||
|
||
.PHONY: generate check_generate clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
GRPCIO_VIRTUALENV=$(shell pwd)/grpc_python_venv | ||
GENERATED_DIR=$(shell pwd)/generated_python | ||
DATASTORE_DIR=$(shell pwd)/gcloud/datastore/_generated | ||
PROTOC_CMD=$(GRPCIO_VIRTUALENV)/bin/python -m grpc.tools.protoc | ||
GOOGLEAPIS_PROTOS_DIR=$(shell pwd)/googleapis-pb | ||
|
||
help: | ||
@echo 'Makefile for gcloud-python Bigtable protos ' | ||
@echo ' ' | ||
@echo ' make generate Generates the protobuf modules ' | ||
@echo ' make check_generate Checks that generate succeeded ' | ||
@echo ' make clean Clean generated files ' | ||
|
||
generate: | ||
# Ensure we have a virtualenv w/ up-to-date grpcio/grpcio-tools | ||
[ -d $(GRPCIO_VIRTUALENV) ] || python2.7 -m virtualenv $(GRPCIO_VIRTUALENV) | ||
$(GRPCIO_VIRTUALENV)/bin/pip install --upgrade grpcio grpcio-tools | ||
# Retrieve git repos that have our *.proto files. | ||
[ -d googleapis-pb ] || git clone https://github.com/google/googleapis googleapis-pb --depth=1 | ||
cd googleapis-pb && git pull origin master | ||
# Make the directory where our *_pb2.py files will go. | ||
mkdir -p $(GENERATED_DIR) | ||
# Generate all *_pb2.py files that do not require gRPC. | ||
$(PROTOC_CMD) \ | ||
--proto_path=$(GOOGLEAPIS_PROTOS_DIR) \ | ||
--python_out=$(GENERATED_DIR) \ | ||
$(GOOGLEAPIS_PROTOS_DIR)/google/datastore/v1beta3/datastore.proto \ | ||
$(GOOGLEAPIS_PROTOS_DIR)/google/datastore/v1beta3/entity.proto \ | ||
$(GOOGLEAPIS_PROTOS_DIR)/google/datastore/v1beta3/query.proto | ||
# Move the newly generated *_pb2.py files into our library. | ||
cp $(GENERATED_DIR)/google/datastore/v1beta3/* $(DATASTORE_DIR) | ||
# Remove all existing *.proto files before we replace | ||
rm -f $(DATASTORE_DIR)/*.proto | ||
# Copy over the *.proto files into our library. | ||
cp $(GOOGLEAPIS_PROTOS_DIR)/google/datastore/v1beta3/*.proto $(DATASTORE_DIR) | ||
# Rename all *.proto files in our library with an | ||
# underscore and remove executable bit. | ||
cd $(DATASTORE_DIR) && \ | ||
for filename in *.proto; do \ | ||
chmod -x $$filename ; \ | ||
mv $$filename _$$filename ; \ | ||
done | ||
# Separate the gRPC parts of the datastore service from the | ||
# non-gRPC parts so that the protos can be used without gRPC. | ||
GRPCIO_VIRTUALENV="$(GRPCIO_VIRTUALENV)" \ | ||
GENERATED_SUBDIR=$(GENERATED_SUBDIR) \ | ||
python scripts/make_datastore_grpc.py | ||
# Rewrite the imports in the generated *_pb2.py files. | ||
python scripts/rewrite_imports.py $(DATASTORE_DIR)/*pb2.py | ||
|
||
check_generate: | ||
python scripts/check_generate.py | ||
|
||
clean: | ||
rm -fr $(GENERATED_DIR) | ||
|
||
.PHONY: generate check_generate clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.