diff --git a/scripts/publish_to_pypi.sh b/scripts/publish_to_pypi.sh index d1c0f85..de15afb 100755 --- a/scripts/publish_to_pypi.sh +++ b/scripts/publish_to_pypi.sh @@ -1,5 +1,16 @@ #!/usr/bin/env bash # Use this script to manually publish to PyPI! -python3 setup.py sdist bdist_wheel -python3 -m twine upload dist/* + +python setup.py sdist bdist_wheel + +python -c 'import pkgutil; exit(0 if pkgutil.find_loader("twine") else 2)' || { echo 'Installing twine...'; pip install --quiet twine; } + +while true; do + read -p "Do you want to upload to PyPI (Y/N)? " yn + case $yn in + [Yy]* ) python -m twine upload dist/*; break;; + [Nn]* ) exit;; + * ) echo "Please answer yes or no.";; + esac +done