| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,3 +53,4 @@ scripts/pylintrc_reduced | |||
| 53 | 53 | # Directories used for creating generated PB2 files | |
| 54 | 54 | generated_python/ | |
| 55 | 55 | cloud-bigtable-client/ | |
| 56 | + googleapis-pb/ | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,10 @@ | |||
| 1 | 1 | GENERATED_DIR=$(shell pwd)/generated_python | |
| 2 | - FINAL_DIR=$(shell pwd)/gcloud/bigtable/_generated | ||
| 2 | + BIGTABLE_DIR=$(shell pwd)/gcloud/bigtable/_generated | ||
| 3 | + DATASTORE_DIR=$(shell pwd)/gcloud/datastore/_generated | ||
| 3 | 4 | GRPC_PLUGIN=grpc_python_plugin | |
| 4 | 5 | PROTOC_CMD=protoc | |
| 5 | - PROTOS_DIR=$(shell pwd)/cloud-bigtable-client/bigtable-protos/src/main/proto | ||
| 6 | + BIGTABLE_PROTOS_DIR=$(shell pwd)/cloud-bigtable-client/bigtable-protos/src/main/proto | ||
| 7 | + GOOGLEAPIS_PROTOS_DIR=$(shell pwd)/googleapis-pb | ||
| 6 | 8 | ||
| 7 | 9 | help: | |
| 8 | 10 | @echo 'Makefile for gcloud-python Bigtable protos ' | |
@@ -12,42 +14,58 @@ help: | |||
| 12 | 14 | @echo ' make clean Clean generated files ' | |
| 13 | 15 | ||
| 14 | 16 | generate: | |
| 15 | - [ -d cloud-bigtable-client ] || git clone https://github.com/GoogleCloudPlatform/cloud-bigtable-client | ||
| 17 | + # Retrieve git repos that have our *.proto files. | ||
| 18 | + [ -d cloud-bigtable-client ] || git clone https://github.com/GoogleCloudPlatform/cloud-bigtable-client --depth=1 | ||
| 16 | 19 | cd cloud-bigtable-client && git pull origin master | |
| 20 | + [ -d googleapis-pb ] || git clone https://github.com/google/googleapis googleapis-pb --depth=1 | ||
| 21 | + cd googleapis-pb && git pull origin master | ||
| 22 | + # Make the directory where our *_pb2.py files will go. | ||
| 17 | 23 | mkdir -p $(GENERATED_DIR) | |
| 18 | 24 | # Generate all *_pb2.py files that require gRPC. | |
| 19 | 25 | $(PROTOC_CMD) \ | |
| 20 | - --proto_path=$(PROTOS_DIR) \ | ||
| 26 | + --proto_path=$(BIGTABLE_PROTOS_DIR) \ | ||
| 21 | 27 | --python_out=$(GENERATED_DIR) \ | |
| 22 | 28 | --plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \ | |
| 23 | 29 | --grpc_out=$(GENERATED_DIR) \ | |
| 24 | - $(PROTOS_DIR)/google/bigtable/v1/bigtable_service.proto \ | ||
| 25 | - $(PROTOS_DIR)/google/bigtable/admin/cluster/v1/bigtable_cluster_service.proto \ | ||
| 26 | - $(PROTOS_DIR)/google/bigtable/admin/table/v1/bigtable_table_service.proto | ||
| 30 | + $(BIGTABLE_PROTOS_DIR)/google/bigtable/v1/bigtable_service.proto \ | ||
| 31 | + $(BIGTABLE_PROTOS_DIR)/google/bigtable/admin/cluster/v1/bigtable_cluster_service.proto \ | ||
| 32 | + $(BIGTABLE_PROTOS_DIR)/google/bigtable/admin/table/v1/bigtable_table_service.proto | ||
| 27 | 33 | # Generate all *_pb2.py files that do not require gRPC. | |
| 28 | 34 | $(PROTOC_CMD) \ | |
| 29 | - --proto_path=$(PROTOS_DIR) \ | ||
| 35 | + --proto_path=$(BIGTABLE_PROTOS_DIR) \ | ||
| 36 | + --proto_path=$(GOOGLEAPIS_PROTOS_DIR) \ | ||
| 30 | 37 | --python_out=$(GENERATED_DIR) \ | |
| 31 | - $(PROTOS_DIR)/google/bigtable/v1/bigtable_data.proto \ | ||
| 32 | - $(PROTOS_DIR)/google/bigtable/v1/bigtable_service_messages.proto \ | ||
| 33 | - $(PROTOS_DIR)/google/bigtable/admin/cluster/v1/bigtable_cluster_data.proto \ | ||
| 34 | - $(PROTOS_DIR)/google/bigtable/admin/cluster/v1/bigtable_cluster_service_messages.proto \ | ||
| 35 | - $(PROTOS_DIR)/google/bigtable/admin/table/v1/bigtable_table_data.proto \ | ||
| 36 | - $(PROTOS_DIR)/google/bigtable/admin/table/v1/bigtable_table_service_messages.proto | ||
| 38 | + $(BIGTABLE_PROTOS_DIR)/google/bigtable/v1/bigtable_data.proto \ | ||
| 39 | + $(BIGTABLE_PROTOS_DIR)/google/bigtable/v1/bigtable_service_messages.proto \ | ||
| 40 | + $(BIGTABLE_PROTOS_DIR)/google/bigtable/admin/cluster/v1/bigtable_cluster_data.proto \ | ||
| 41 | + $(BIGTABLE_PROTOS_DIR)/google/bigtable/admin/cluster/v1/bigtable_cluster_service_messages.proto \ | ||
| 42 | + $(BIGTABLE_PROTOS_DIR)/google/bigtable/admin/table/v1/bigtable_table_data.proto \ | ||
| 43 | + $(BIGTABLE_PROTOS_DIR)/google/bigtable/admin/table/v1/bigtable_table_service_messages.proto \ | ||
| 44 | + $(GOOGLEAPIS_PROTOS_DIR)/google/datastore/v1beta3/datastore.proto \ | ||
| 45 | + $(GOOGLEAPIS_PROTOS_DIR)/google/datastore/v1beta3/entity.proto \ | ||
| 46 | + $(GOOGLEAPIS_PROTOS_DIR)/google/datastore/v1beta3/query.proto | ||
| 37 | 47 | # Move the newly generated *_pb2.py files into our library. | |
| 38 | - mv $(GENERATED_DIR)/google/bigtable/v1/* $(FINAL_DIR) | ||
| 39 | - mv $(GENERATED_DIR)/google/bigtable/admin/cluster/v1/* $(FINAL_DIR) | ||
| 40 | - mv $(GENERATED_DIR)/google/bigtable/admin/table/v1/* $(FINAL_DIR) | ||
| 48 | + mv $(GENERATED_DIR)/google/bigtable/v1/* $(BIGTABLE_DIR) | ||
| 49 | + mv $(GENERATED_DIR)/google/bigtable/admin/cluster/v1/* $(BIGTABLE_DIR) | ||
| 50 | + mv $(GENERATED_DIR)/google/bigtable/admin/table/v1/* $(BIGTABLE_DIR) | ||
| 51 | + mv $(GENERATED_DIR)/google/datastore/v1beta3/* $(DATASTORE_DIR) | ||
| 41 | 52 | # Remove all existing *.proto files before we replace | |
| 42 | - rm -f $(FINAL_DIR)/*.proto | ||
| 53 | + rm -f $(BIGTABLE_DIR)/*.proto | ||
| 54 | + rm -f $(DATASTORE_DIR)/*.proto | ||
| 43 | 55 | # Copy over the *.proto files into our library. | |
| 44 | - cp $(PROTOS_DIR)/google/bigtable/v1/*.proto $(FINAL_DIR) | ||
| 45 | - cp $(PROTOS_DIR)/google/bigtable/admin/cluster/v1/*.proto $(FINAL_DIR) | ||
| 46 | - cp $(PROTOS_DIR)/google/bigtable/admin/table/v1/*.proto $(FINAL_DIR) | ||
| 47 | - cp $(PROTOS_DIR)/google/longrunning/operations.proto $(FINAL_DIR) | ||
| 56 | + cp $(BIGTABLE_PROTOS_DIR)/google/bigtable/v1/*.proto $(BIGTABLE_DIR) | ||
| 57 | + cp $(BIGTABLE_PROTOS_DIR)/google/bigtable/admin/cluster/v1/*.proto $(BIGTABLE_DIR) | ||
| 58 | + cp $(BIGTABLE_PROTOS_DIR)/google/bigtable/admin/table/v1/*.proto $(BIGTABLE_DIR) | ||
| 59 | + cp $(BIGTABLE_PROTOS_DIR)/google/longrunning/operations.proto $(BIGTABLE_DIR) | ||
| 60 | + cp $(GOOGLEAPIS_PROTOS_DIR)/google/datastore/v1beta3/*.proto $(DATASTORE_DIR) | ||
| 48 | 61 | # Rename all *.proto files in our library with an | |
| 49 | 62 | # underscore and remove executable bit. | |
| 50 | - cd $(FINAL_DIR) && \ | ||
| 63 | + cd $(BIGTABLE_DIR) && \ | ||
| 64 | + for filename in *.proto; do \ | ||
| 65 | + chmod -x $$filename ; \ | ||
| 66 | + mv $$filename _$$filename ; \ | ||
| 67 | + done | ||
| 68 | + cd $(DATASTORE_DIR) && \ | ||
| 51 | 69 | for filename in *.proto; do \ | |
| 52 | 70 | chmod -x $$filename ; \ | |
| 53 | 71 | mv $$filename _$$filename ; \ | |
@@ -56,6 +74,9 @@ generate: | |||
| 56 | 74 | # non-gRPC parts so that the protos from `googleapis-common-protos` | |
| 57 | 75 | # can be used without gRPC. | |
| 58 | 76 | python scripts/make_operations_grpc.py | |
| 77 | + # Separate the gRPC parts of the datastore service from the | ||
| 78 | + # non-gRPC parts so that the protos can be used without gRPC. | ||
| 79 | + python scripts/make_datastore_grpc.py | ||
| 59 | 80 | # Rewrite the imports in the generated *_pb2.py files. | |
| 60 | 81 | python scripts/rewrite_imports.py | |
| 61 | 82 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments