Skip to content

Commit 0ff6399

Browse files
authored
Fixed Python release script to upload using twine instead of distutils. (protocolbuffers#7571)
1 parent 678da4f commit 0ff6399

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

python/release.sh

+8-4
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,16 @@ python setup.py build
8080
python setup.py test
8181

8282
# Deploy source package to testing PyPI
83-
python setup.py sdist upload -r https://test.pypi.org/legacy/
83+
python setup.py sdist
84+
twine upload --skip-existing -r testpypi -u protobuf-wheel-test dist/*
8485

8586
# Test locally with different python versions.
8687
run_install_test ${TESTING_VERSION} python2.7 https://test.pypi.org/simple
8788
run_install_test ${TESTING_VERSION} python3 https://test.pypi.org/simple
8889

8990
# Deploy egg/wheel packages to testing PyPI and test again.
90-
python setup.py bdist_egg bdist_wheel upload -r https://test.pypi.org/legacy/
91+
python setup.py clean build bdist_wheel
92+
twine upload --skip-existing -r testpypi -u protobuf-wheel-test dist/*
9193

9294
run_install_test ${TESTING_VERSION} python2.7 https://test.pypi.org/simple
9395
run_install_test ${TESTING_VERSION} python3 https://test.pypi.org/simple
@@ -103,13 +105,15 @@ if [ $TESTING_ONLY -eq 0 ]; then
103105
echo "Publishing to PyPI..."
104106
# Be sure to run build before sdist, because otherwise sdist will not include
105107
# well-known types.
106-
python setup.py clean build sdist upload
108+
python setup.py clean build sdist
109+
twine upload --skip-existing -u protobuf-packages dist/*
107110
# Be sure to run clean before bdist_xxx, because otherwise bdist_xxx will
108111
# include files you may not want in the package. E.g., if you have built
109112
# and tested with --cpp_implemenation, bdist_xxx will include the _message.so
110113
# file even when you no longer pass the --cpp_implemenation flag. See:
111114
# https://github.com/protocolbuffers/protobuf/issues/3042
112-
python setup.py clean build bdist_egg bdist_wheel upload
115+
python setup.py clean build bdist_wheel
116+
twine upload --skip-existing -u protobuf-packages dist/*
113117
else
114118
# Set the version number back (i.e., remove dev suffix).
115119
sed -i -r "s/__version__ = '.*'/__version__ = '${VERSION}'/" google/protobuf/__init__.py

0 commit comments

Comments
 (0)