forked from googleapis/google-cloud-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrading Makefile to generate datastore v1beta3.
Also - Removing `v1beta2` generated code and `.proto` file - Adding new `.proto` files and generated code - Adding `make_datastore_grpc.py` script to tear out the `protoc` inserted lines by the gRPC plugin - Updating `rewrite_imports.py` to rewrite the datastore imports
- Loading branch information
Showing
13 changed files
with
3,459 additions
and
2,646 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 |
---|---|---|
@@ -1,8 +1,10 @@ | ||
GENERATED_DIR=$(shell pwd)/generated_python | ||
BT_DIR=$(shell pwd)/gcloud/bigtable/_generated | ||
DS_DIR=$(shell pwd)/gcloud/datastore/_generated | ||
GRPC_PLUGIN=grpc_python_plugin | ||
PROTOC_CMD=protoc | ||
BT_PROTOS_DIR=$(shell pwd)/cloud-bigtable-client/bigtable-protos/src/main/proto | ||
DS_PROTOS_DIR=$(shell pwd)/googleapis-pb | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
dhermes
Author
Owner
|
||
|
||
help: | ||
@echo 'Makefile for gcloud-python Bigtable protos ' | ||
|
@@ -12,8 +14,12 @@ help: | |
@echo ' make clean Clean generated files ' | ||
|
||
generate: | ||
[ -d cloud-bigtable-client ] || git clone https://github.com/GoogleCloudPlatform/cloud-bigtable-client | ||
# Retrieve git repos that have our *.proto files. | ||
[ -d cloud-bigtable-client ] || git clone https://github.com/GoogleCloudPlatform/cloud-bigtable-client --depth=1 | ||
cd cloud-bigtable-client && git pull origin master | ||
[ -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) \ | ||
|
@@ -27,35 +33,50 @@ generate: | |
# Generate all *_pb2.py files that do not require gRPC. | ||
$(PROTOC_CMD) \ | ||
--proto_path=$(BT_PROTOS_DIR) \ | ||
--proto_path=$(DS_PROTOS_DIR) \ | ||
--python_out=$(GENERATED_DIR) \ | ||
$(BT_PROTOS_DIR)/google/bigtable/v1/bigtable_data.proto \ | ||
$(BT_PROTOS_DIR)/google/bigtable/v1/bigtable_service_messages.proto \ | ||
$(BT_PROTOS_DIR)/google/bigtable/admin/cluster/v1/bigtable_cluster_data.proto \ | ||
$(BT_PROTOS_DIR)/google/bigtable/admin/cluster/v1/bigtable_cluster_service_messages.proto \ | ||
$(BT_PROTOS_DIR)/google/bigtable/admin/table/v1/bigtable_table_data.proto \ | ||
$(BT_PROTOS_DIR)/google/bigtable/admin/table/v1/bigtable_table_service_messages.proto | ||
$(BT_PROTOS_DIR)/google/bigtable/admin/table/v1/bigtable_table_service_messages.proto \ | ||
$(DS_PROTOS_DIR)/google/datastore/v1beta3/datastore.proto \ | ||
$(DS_PROTOS_DIR)/google/datastore/v1beta3/entity.proto \ | ||
$(DS_PROTOS_DIR)/google/datastore/v1beta3/query.proto | ||
# Move the newly generated *_pb2.py files into our library. | ||
mv $(GENERATED_DIR)/google/bigtable/v1/* $(BT_DIR) | ||
mv $(GENERATED_DIR)/google/bigtable/admin/cluster/v1/* $(BT_DIR) | ||
mv $(GENERATED_DIR)/google/bigtable/admin/table/v1/* $(BT_DIR) | ||
mv $(GENERATED_DIR)/google/datastore/v1beta3/* $(DS_DIR) | ||
# Remove all existing *.proto files before we replace | ||
rm -f $(BT_DIR)/*.proto | ||
rm -f $(DS_DIR)/*.proto | ||
# Copy over the *.proto files into our library. | ||
cp $(BT_PROTOS_DIR)/google/bigtable/v1/*.proto $(BT_DIR) | ||
cp $(BT_PROTOS_DIR)/google/bigtable/admin/cluster/v1/*.proto $(BT_DIR) | ||
cp $(BT_PROTOS_DIR)/google/bigtable/admin/table/v1/*.proto $(BT_DIR) | ||
cp $(BT_PROTOS_DIR)/google/longrunning/operations.proto $(BT_DIR) | ||
cp $(DS_PROTOS_DIR)/google/datastore/v1beta3/*.proto $(DS_DIR) | ||
# Rename all *.proto files in our library with an | ||
# underscore and remove executable bit. | ||
cd $(BT_DIR) && \ | ||
for filename in *.proto; do \ | ||
chmod -x $$filename ; \ | ||
mv $$filename _$$filename ; \ | ||
done | ||
cd $(DS_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. | ||
python scripts/make_operations_grpc.py | ||
# Separate the gRPC parts of the datastore service from the | ||
# non-gRPC parts so that the protos can be used without gRPC. | ||
python scripts/make_datastore_grpc.py | ||
# Rewrite the imports in the generated *_pb2.py files. | ||
python scripts/rewrite_imports.py | ||
|
||
|
Oops, something went wrong.
1 comment
on commit bba14db
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I would prefer more verbose bash variables. BIGTABLE_PROTOS_DIR
vs BT_PROTOS_DIR
, etc. It makes it a bit easier to read for new/old eyes.
Is this a misnomer? Should be
GOOGLEAPIS_PROTOS_DIR
?