Skip to content

Commit 614f9fd

Browse files
authored
fix(container): fix apiPath when it differs from apiDashes (googleapis#12181)
1 parent d592be7 commit 614f9fd

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

containers/python-bootstrap-container/entrypoint.sh

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,8 @@ cd "$WORKSPACE_DIR/$MONO_REPO_NAME/containers/python-bootstrap-container"
4646
API_VERSION="$(echo $API_ID | sed 's/.*\.//')"
4747

4848
# API_ID has the form google.cloud.*.vX or `google.*.*.vX`
49-
# Replace `.`` with `-`
50-
FOLDER_NAME="$(echo $API_ID | sed -E 's/\./-/g')"
51-
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- )"
49+
# It forms the basis for FOLDER_NAME, which will be further modified in what follows.
50+
FOLDER_NAME="${API_ID}"
5751

5852
# if API_VERSION does not contain numbers, set API_VERSION to empty string
5953
if [[ ! $API_VERSION =~ [0-9] ]]; then
@@ -62,9 +56,22 @@ else
6256
# Remove the trailing version from the FOLDER_NAME`
6357
# for `google.cloud.workflows.v1`
6458
# the folder should be `google-cloud-workflows`
65-
FOLDER_NAME="$(echo $FOLDER_NAME | sed 's/-[^-]*$//')"
59+
FOLDER_NAME="$(echo $FOLDER_NAME | sed 's@\.[^.]*$@@')"
6660
fi
6761

62+
# The directory in googleapis/googleapis-gen to configure in .OwlBot.yaml.
63+
# Replace '.' with '/'
64+
API_PATH="$(echo ${FOLDER_NAME} | sed -E 's@\.@/@g')"
65+
66+
# Replace `.`` with `-`
67+
FOLDER_NAME="$(echo ${FOLDER_NAME} | sed -E 's/\./-/g')"
68+
69+
# Since we map protobuf packages google.protobuf.* to Python packages
70+
# google.cloud.* (see
71+
# https://github.com/googleapis/gapic-generator-python/issues/1899), ensure that
72+
# that the PyPI package name reflects the Python package structure.
73+
FOLDER_NAME="$(replace_prefix "${FOLDER_NAME}" google-api- google-cloud- )"
74+
6875
# Create the folder
6976
mkdir -p "$WORKSPACE_DIR/$MONO_REPO_NAME/packages/$FOLDER_NAME"
7077

@@ -84,8 +91,6 @@ else
8491
cp ".OwlBot.yaml" "${WORKSPACE_DIR}/${MONO_REPO_NAME}/packages/${FOLDER_NAME}/.OwlBot.yaml"
8592
fi
8693

87-
API_PATH="$(echo $FOLDER_NAME | sed -E 's/\-/\//g')"
88-
8994
# Update apiPath in .OwlBot.yaml
9095
sed -i -e "s|apiPath|$API_PATH|" "${WORKSPACE_DIR}/${MONO_REPO_NAME}/packages/${FOLDER_NAME}/.OwlBot.yaml"
9196

0 commit comments

Comments
 (0)