Skip to content

Commit

Permalink
Update python/release.sh to handle delay between twine upload and pip…
Browse files Browse the repository at this point in the history
… install (protocolbuffers#10324)
  • Loading branch information
zhangskz authored and deannagarcia committed Sep 14, 2022
1 parent 8f67853 commit 98e528d
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions python/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ["
Expand Down Expand Up @@ -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."
Expand Down

0 comments on commit 98e528d

Please sign in to comment.