Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jul 27, 2022
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
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