Update python/release.sh to handle delay between twine upload and pip install (#10324)

pull/10326/head
zhangskz 2 years ago committed by GitHub
parent 11a21d7297
commit 1122a02024
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      python/release.sh

@ -19,11 +19,24 @@ function run_install_test() {
chmod +x test-venv/bin/protoc
source test-venv/bin/activate
pip install -i ${PYPI} protobuf==${VERSION} --no-cache-dir
(pip install -i ${PYPI} protobuf==${VERSION} --no-cache-dir) || (retry_pip_install ${PYPI} ${VERSION})
deactivate
rm -fr test-venv
}
function retry_pip_install() {
local PYPI=$1
local VERSION=$2
read -p "pip install failed, possibly due to delay between upload and availability on pip. Retry? [y/n]" -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
(pip install -i ${PYPI} protobuf==${VERSION} --no-cache-dir) || (retry_pip_install ${PYPI} ${VERSION})
}
[ $# -lt 1 ] && {
echo "Usage: $0 VERSION ["
@ -86,13 +99,16 @@ python3 setup.py test
python3 setup.py sdist
twine upload --skip-existing -r testpypi -u protobuf-wheel-test dist/*
# Test locally with different python versions.
# Sleep to allow time for distribution to be available on pip.
sleep 5m
# Test locally.
run_install_test ${TESTING_VERSION} python3 https://test.pypi.org/simple
# Deploy egg/wheel packages to testing PyPI and test again.
python3 setup.py clean build bdist_wheel
twine upload --skip-existing -r testpypi -u protobuf-wheel-test dist/*
sleep 5m
run_install_test ${TESTING_VERSION} python3 https://test.pypi.org/simple
echo "All install tests have passed using testing PyPI."

Loading…
Cancel
Save