build(google/maps): update python postprocessing

- modify python versions. see https://github.com/googleapis/gapic-generator/pull/3128
- use markdown readme instead of rst
- remove enum34
- fix namespace google.cloud -> google.maps. see https://github.com/googleapis/gapic-generator/issues/3166

PiperOrigin-RevId: 305773355
This commit is contained in:
Google APIs 2020-04-09 15:30:35 -07:00 committed by Copybara-Service
parent ac1f904979
commit fe8b17aff5
1 changed files with 16 additions and 12 deletions

View File

@ -4,21 +4,23 @@ set -eu
# Performs Maps specific post-processing on a .tar.gz archive
# Rename nox config file from nox.py to noxfile.py if it exists
#
# Arguments:
# postprocess_dir: The directory that contains the Java files to postprocess.
rename_nox_file() {
postprocess_dir="${1}"
if [ -f "$postprocess_dir/nox.py" ]; then
mv "$postprocess_dir/nox.py" "$postprocess_dir/noxfile.py"
fi
use_map_namespace() {
f="${1}/setup.py"
sed -e "s/google.cloud/google.maps/g" "${f}" > "${f}.new" && mv "${f}.new" "${f}"
}
use_markdown_readme() {
sed -e "s/= 'com\.google\.cloud'/= 'com\.google\.maps'/g" "${1}/${f}" > "${f}.new" && mv "${f}.new" "${f}"
f="${1}/setup.py"
sed -e "s/README.rst/README.md/g" "${f}" > "${f}.new" && mv "${f}.new" "${f}"
rm -f "${1}/README.rst"
}
update_python_versions() {
f="${1}/setup.py"
sed -e "/Python :: 2/d" "${f}" > "${f}.new" && mv "${f}.new" "${f}"
sed -e "/Python :: 3.4/d" "${f}" > "${f}.new" && mv "${f}.new" "${f}"
sed -e "/enum34/d" "${f}" > "${f}.new" && mv "${f}.new" "${f}"
sed -e "s/'Programming Language :: Python :: 3.6',/'Programming Language :: Python :: 3.6',\n 'Programming Language :: Python :: 3.7',/g" "${f}" > "${f}.new" && mv "${f}.new" "${f}"
}
# Main entry point
@ -33,7 +35,9 @@ main() {
exit 1
fi
rename_nox_file "${postprocess_dir}"
use_markdown_readme "${postprocess_dir}"
update_python_versions "${postprocess_dir}"
use_map_namespace "${postprocess_dir}"
}
main "$@"