FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Merge pull request #1428 from dhermes/change-over-to-v1beta3-protos-2 · googleapis/google-cloud-python@cc08415 · GitHub

Commit cc08415

Browse files
committed
Merge pull request #1428 from dhermes/change-over-to-v1beta3-protos-2
Upgrading Makefile to generate datastore v1beta3.
2 parents 283efa6 + dbee5b2 commit cc08415

17 files changed

Lines changed: 3498 additions & 2678 deletions

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@ scripts/pylintrc_reduced
5353
# Directories used for creating generated PB2 files
5454
generated_python/
5555
cloud-bigtable-client/
56+
googleapis-pb/

‎Makefile‎

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
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
34
GRPC_PLUGIN=grpc_python_plugin
45
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
68

79
help:
810
@echo 'Makefile for gcloud-python Bigtable protos '
@@ -12,42 +14,58 @@ help:
1214
@echo ' make clean Clean generated files '
1315

1416
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
1619
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.
1723
mkdir -p $(GENERATED_DIR)
1824
# Generate all *_pb2.py files that require gRPC.
1925
$(PROTOC_CMD) \
20-
--proto_path=$(PROTOS_DIR) \
26+
--proto_path=$(BIGTABLE_PROTOS_DIR) \
2127
--python_out=$(GENERATED_DIR) \
2228
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
2329
--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
2733
# Generate all *_pb2.py files that do not require gRPC.
2834
$(PROTOC_CMD) \
29-
--proto_path=$(PROTOS_DIR) \
35+
--proto_path=$(BIGTABLE_PROTOS_DIR) \
36+
--proto_path=$(GOOGLEAPIS_PROTOS_DIR) \
3037
--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
3747
# 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)
4152
# 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
4355
# 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)
4861
# Rename all *.proto files in our library with an
4962
# 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) && \
5169
for filename in *.proto; do \
5270
chmod -x $$filename ; \
5371
mv $$filename _$$filename ; \
@@ -56,6 +74,9 @@ generate:
5674
# non-gRPC parts so that the protos from `googleapis-common-protos`
5775
# can be used without gRPC.
5876
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
5980
# Rewrite the imports in the generated *_pb2.py files.
6081
python scripts/rewrite_imports.py
6182

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL