@@ -330,6 +330,7 @@ def _copy_files_needed_for_post_processing(output: str, input: str, library_id:
330330 os .makedirs (
331331 f"{ output } /{ path_to_library } /scripts/client-post-processing" , exist_ok = True
332332 )
333+ # TODO(https://github.com/googleapis/synthtool/pull/2126): Remove once this PR is merged
333334 # This is needed to avoid the following error for proto-only libraries
334335 # Traceback (most recent call last):
335336 # File "/app/./cli.py", line 535, in handle_generate
@@ -691,7 +692,7 @@ def _run_protoc_command(generator_command: str, source: str):
691692 )
692693
693694
694- def _get_staging_child_directory (api_path : str ) -> str :
695+ def _get_staging_child_directory (api_path : str , is_proto_only_library : bool ) -> str :
695696 """
696697 Determines the correct sub-path within 'owl-bot-staging' for the generated code.
697698
@@ -701,13 +702,14 @@ def _get_staging_child_directory(api_path: str) -> str:
701702
702703 Args:
703704 api_path (str): The relative path to the API directory (e.g., 'google/cloud/language/v1').
705+ is_proto_only_library(bool): True, if this is a proto-only library.
704706
705707 Returns:
706708 str: The sub-directory name to use for staging.
707709 """
708710
709711 version_candidate = api_path .split ("/" )[- 1 ]
710- if version_candidate .startswith ("v" ):
712+ if version_candidate .startswith ("v" ) and not is_proto_only_library :
711713 return version_candidate
712714 else :
713715 # Fallback for non-'v' version segment
@@ -790,7 +792,7 @@ def _generate_api(
790792 _run_protoc_command (command , source )
791793
792794 # 3. Determine staging location
793- staging_child_directory = _get_staging_child_directory (api_path )
795+ staging_child_directory = _get_staging_child_directory (api_path , is_proto_only_library )
794796 staging_dir = os .path .join (
795797 output , "owl-bot-staging" , library_id , staging_child_directory
796798 )
0 commit comments