Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions .generator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,9 +694,12 @@ def _get_staging_child_directory(api_path: str, is_proto_only_library: bool) ->
version_candidate = api_path.split("/")[-1]
if version_candidate.startswith("v") and not is_proto_only_library:
return version_candidate
else:
# Fallback for non-'v' version segment
elif is_proto_only_library:
# Fallback for non-'v' version segment for proto-only library
return f"{os.path.basename(api_path)}-py/{api_path}"
else:
# Fallback for non-'v' version segment for GAPIC
return f"{os.path.basename(api_path)}-py"


def _stage_proto_only_library(
Expand Down
11 changes: 10 additions & 1 deletion .generator/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,7 @@ def test_verify_library_namespace_error_no_gapic_file(mocker, mock_path_class):
mock_path_class.assert_called_once_with("repo/packages/my-lib")


def test_get_staging_child_directory_gapic():
def test_get_staging_child_directory_gapic_versioned():
"""
Tests the behavior for GAPIC clients with standard 'v' prefix versioning.
Should return only the version segment (e.g., 'v1').
Expand All @@ -1367,6 +1367,15 @@ def test_get_staging_child_directory_gapic():
expected = "v1"
assert _get_staging_child_directory(api_path, False) == expected

def test_get_staging_child_directory_gapic_non_versioned():
"""
Tests the behavior for GAPIC clients with no standard 'v' prefix versioning.
Should return library-py
"""
api_path = "google/cloud/language"
expected = "language-py"
assert _get_staging_child_directory(api_path, False) == expected


def test_get_staging_child_directory_proto_only():
"""
Expand Down
1 change: 1 addition & 0 deletions .librarian/state.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1569,6 +1569,7 @@ libraries:
- scripts/client-post-processing
- samples/snippets/README.rst
- tests/system
- tests/unit/gapic/common/test_common.py
remove_regex:
- packages/google-cloud-common
tag_format: '{id}-v{version}'
Expand Down
Loading