Skip to content
Merged
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
16 changes: 16 additions & 0 deletions containers/python-bootstrap-container/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ function save_to_temp_then_file() {
mv -f $TEMP_FILE "${1}"
}

# replace_prefix STR FROM_PREFIX TO_PREFIX
# Echoes STR with any leading prefix FROM_PREFIX replaced by TO_PREFIX.
function replace_prefix () {
local STR="$1"
local PREFIX_FROM="$2"
local PREFIX_TO="$3"
local STEM=${STR#${PREFIX_FROM}}
[[ "${STR}" == "${STEM}" ]] && echo "${STR}" || echo "${PREFIX_TO}${STEM}"
}


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

# Since we map protobuf packages google.protobuf.* to Python packages
Comment thread
parthea marked this conversation as resolved.
# google.cloud.* (see
# https://github.com/googleapis/gapic-generator-python/issues/1899), ensure that
# that the PyPI package name reflects the Python package structure.
FOLDER_NAME="$(replace_prefix "${FOLDER_NAME}" google-api- google-cloud- )"

# if API_VERSION does not contain numbers, set API_VERSION to empty string
if [[ ! $API_VERSION =~ [0-9] ]]; then
API_VERSION=""
Expand Down