File tree Expand file tree Collapse file tree
containers/python-bootstrap-container Expand file tree Collapse file tree Original file line number Diff line number Diff 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
2636MONO_REPO_NAME=" google-cloud-python"
2737WORKSPACE_DIR=" /workspace"
@@ -39,6 +49,12 @@ API_VERSION="$(echo $API_ID | sed 's/.*\.//')"
3949# Replace `.`` with `-`
4050FOLDER_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
4359if [[ ! $API_VERSION =~ [0-9] ]]; then
4460 API_VERSION=" "
You can’t perform that action at this time.
0 commit comments