Skip to content

Commit d592be7

Browse files
authored
chore: map google.api.* to google.cloud.* in bootstrap directory (googleapis#12178)
1 parent a43fa12 commit d592be7

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

containers/python-bootstrap-container/entrypoint.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ function save_to_temp_then_file() {
2222
mv -f $TEMP_FILE "${1}"
2323
}
2424

25+
# replace_prefix STR FROM_PREFIX TO_PREFIX
26+
# Echoes STR with any leading prefix FROM_PREFIX replaced by TO_PREFIX.
27+
function replace_prefix () {
28+
local STR="$1"
29+
local PREFIX_FROM="$2"
30+
local PREFIX_TO="$3"
31+
local STEM=${STR#${PREFIX_FROM}}
32+
[[ "${STR}" == "${STEM}" ]] && echo "${STR}" || echo "${PREFIX_TO}${STEM}"
33+
}
34+
2535

2636
MONO_REPO_NAME="google-cloud-python"
2737
WORKSPACE_DIR="/workspace"
@@ -39,6 +49,12 @@ API_VERSION="$(echo $API_ID | sed 's/.*\.//')"
3949
# Replace `.`` with `-`
4050
FOLDER_NAME="$(echo $API_ID | sed -E 's/\./-/g')"
4151

52+
# Since we map protobuf packages google.protobuf.* to Python packages
53+
# google.cloud.* (see
54+
# https://github.com/googleapis/gapic-generator-python/issues/1899), ensure that
55+
# that the PyPI package name reflects the Python package structure.
56+
FOLDER_NAME="$(replace_prefix "${FOLDER_NAME}" google-api- google-cloud- )"
57+
4258
# if API_VERSION does not contain numbers, set API_VERSION to empty string
4359
if [[ ! $API_VERSION =~ [0-9] ]]; then
4460
API_VERSION=""

0 commit comments

Comments
 (0)