Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add special handling for Python to place protos next to protoc outputs #184

Merged
merged 2 commits into from
Jan 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions synthtool/gcp/gapic_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,18 @@ def _generate_code(

source_dir = googleapis / config_path.parent
proto_files = source_dir.glob("**/*.proto")
os.mkdir(genfiles / "protos")
# By default, put the protos at the root in a folder named 'protos'.
# Specific languages can be cased here to put them in a more language
# appropriate place.
proto_output_path = genfiles / "protos"
if language == "python":
# place protos alongsize the *_pb2.py files
proto_output_path = genfiles / f"google/cloud/{service}_{version}/proto"
os.makedirs(proto_output_path, exist_ok=True)

for i in proto_files:
shutil.copyfile(i, genfiles / "protos" / i.name)
log.success(f"Placed proto files into {genfiles}/protos.")
shutil.copyfile(i, proto_output_path / i.name)
log.success(f"Placed proto files into {proto_output_path}.")

metadata.add_client_destination(
source="googleapis" if not private else "googleapis-private",
Expand Down