1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
#!/usr/bin/env bash
cd "$(dirname "$0")"
cd ..
# default usage: run script, hit enter
pypircfile=$HOME/.pypirc
touch "$pypircfile"
# if exists, ask to use + continue, or overwrite + continue
if [[ -e "$pypircfile" ]]; then
if whiptail --yesno "Use existing ${pypircfile}?" 10 60; then
echo "Using existing ${pypircfile}."
else
if whiptail --yesno "Overwrite existing ${pypircfile}?" 10 60; then
# delete old
rm -rf "$pypircfile";
printf "enter username "; read username
printf "enter password "; read password
# make new
cat > "$pypircfile" << EOF
[distutils]
index-servers =
pypi
[pypi]
username:$username
password:$password
EOF
else
exit 1
fi
fi
fi
read -p "Has FPDF_VERSION been updated in fpdf/fpdf.py? (y/n) " -n 1 -r
echo
if ! [[ $REPLY =~ ^[Yy]$ ]]; then echo 'Aborting'; exit 1; fi
read -p "Has the latest version been updated in docs/index.md? (y/n) " -n 1 -r
echo
if ! [[ $REPLY =~ ^[Yy]$ ]]; then echo 'Aborting'; exit 1; fi
# build
python setup.py bdist_wheel
python setup.py sdist
# update PyPI
twine upload dist/*.whl
twine upload dist/*.tar.gz
# remove old stuff
rm -rf build/ dist/
|