Skip to content

Commit

Permalink
Add special handling for Python to place protos next to protoc outputs (
Browse files Browse the repository at this point in the history
  • Loading branch information
crwilcox committed Jan 29, 2019
1 parent d1bc7a0 commit f893410
Showing 1 changed file with 11 additions and 3 deletions.
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

0 comments on commit f893410

Please sign in to comment.