Skip to content

Commit 929e13d

Browse files
authored
Merge pull request #10572 from deannagarcia/21.x
Backport python release improvement
2 parents 480bd3b + de7597e commit 929e13d

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

python/release.sh

+19-3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,24 @@ function run_install_test() {
1919
chmod +x test-venv/bin/protoc
2020

2121
source test-venv/bin/activate
22-
pip install -i ${PYPI} protobuf==${VERSION} --no-cache-dir
22+
(pip install -i ${PYPI} protobuf==${VERSION} --no-cache-dir) || (retry_pip_install ${PYPI} ${VERSION})
2323
deactivate
2424
rm -fr test-venv
2525
}
2626

27+
function retry_pip_install() {
28+
local PYPI=$1
29+
local VERSION=$2
30+
31+
read -p "pip install failed, possibly due to delay between upload and availability on pip. Retry? [y/n]" -r
32+
echo
33+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
34+
exit 1
35+
fi
36+
37+
(pip install -i ${PYPI} protobuf==${VERSION} --no-cache-dir) || (retry_pip_install ${PYPI} ${VERSION})
38+
}
39+
2740

2841
[ $# -lt 1 ] && {
2942
echo "Usage: $0 VERSION ["
@@ -86,13 +99,16 @@ python3 setup.py test
8699
python3 setup.py sdist
87100
twine upload --skip-existing -r testpypi -u protobuf-wheel-test dist/*
88101

89-
# Test locally with different python versions.
102+
# Sleep to allow time for distribution to be available on pip.
103+
sleep 5m
104+
105+
# Test locally.
90106
run_install_test ${TESTING_VERSION} python3 https://test.pypi.org/simple
91107

92108
# Deploy egg/wheel packages to testing PyPI and test again.
93109
python3 setup.py clean build bdist_wheel
94110
twine upload --skip-existing -r testpypi -u protobuf-wheel-test dist/*
95-
111+
sleep 5m
96112
run_install_test ${TESTING_VERSION} python3 https://test.pypi.org/simple
97113

98114
echo "All install tests have passed using testing PyPI."

0 commit comments

Comments
 (0)