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 57 58 59 60 61 62
|
#! /bin/sh
set -e
case "$TOXENV" in
pypy*) exit 0 ;;
esac
umask 022
chmod -R a+rX .
py=$(python -c "import sys; print('.'.join(sys.version.split('.')[:2]))")
v=$(echo "$py" | sed 's/\.//')
pip install -U pip setuptools readme-renderer twine wheel
python setup.py sdist
if [ -f dist/CT3-*.tar.gz ]; then
# Rename sdist to lowercase; different build tools produce different case.
# This is important because stupid PyPI doesn't ignore sdists
# in different cases but also doesn't allow uploading.
# So we use single case, all lower. Also see PEP 625.
cd dist
mv CT3-*.tar.gz "`echo CT3-*.tar.gz | sed 's/^CT3-/ct3-/'`"
cd ..
fi
if [ -d build ]; then find build -name '*.py[co]' -delete; fi
python setup.py build_ext
python setup.py build --executable '/usr/bin/env python'
python -m compileall build
python -O -m compileall build
python setup.py bdist_wheel
if [ "$RUNNER_OS" = 'Linux' ]; then
# auditwheel 5.2+ require patchelf 0.14+
if [ "$py" = 2.7 ]; then
pip3.7 install -U "auditwheel<5.2"
elif [ "$py" = 3.4 ]; then
pip install -U typing "auditwheel==2.1.1"
else
pip install -U "auditwheel<5.2"
fi
for f in dist/CT3-*-cp"$v"-*-linux*.whl; do
if [ "$py" = 2.7 ]; then
python3.7 -m auditwheel repair -w dist/ "$f"
else
python -m auditwheel repair -w dist/ "$f"
fi
rm -f "$f"
done
elif [ "$RUNNER_OS" = 'macOS' ]; then
pip install -U delocate
for f in dist/CT3-*-cp"$v"-*-macosx*.whl; do
delocate-wheel -v "$f"
done
fi
# TWINE_USERNAME / TWINE_PASSWORD / TWINE_REPOSITORY_URL
# must be set in Github Actions settings.
exec twine upload --disable-progress-bar --skip-existing dist/*
|