1 #! /usr/bin/env bash 2 set -e 3 4 [[ "$TOXENV" == *-flake8 || "$TOXENV" == pypy* ]] && exit 0 5 6 umask 022 && 7 chmod -R a+rX . && 8 9 py=$(python -c "import sys; print('.'.join(sys.version.split('.')[:2]))") 10 v=$(echo "$py" | sed 's/\.//') && 11 12 pip install -U "pip<19.2" "setuptools<44" "readme-renderer<25.0" "twine<2.0" && 13 if [ "$py" == 3.4 ]; then 14 pip install -U "wheel==0.31.1" 15 else 16 pip install -U "wheel==0.34.1" 17 fi && 18 python setup.py sdist && 19 20 if [ -d build ]; then find build -name '*.py[co]' -delete; fi && 21 python setup.py build_ext && 22 python setup.py build --executable '/usr/bin/env python' && 23 python -m compileall build && 24 python -O -m compileall build && 25 python setup.py bdist_wheel && 26 27 if [ "$TRAVIS_OS_NAME" == 'linux' ]; then 28 if [ "$py" == 2.7 ]; then 29 pyenv global system 3.6.7 2.7.15 30 pip3.6 install -U "auditwheel==3.1.0" 31 elif [ "$py" == 3.4 ]; then 32 pip install -U typing "auditwheel==2.1.1" 33 else 34 pip install -U "auditwheel==3.1.0" 35 fi && 36 37 for f in dist/Cheetah3-*-cp$v-*-linux*.whl; do 38 if [ "$py" == 2.7 ]; then 39 python3.6 -m auditwheel repair -w dist/ "$f" 40 else 41 python -m auditwheel repair -w dist/ "$f" 42 fi && 43 rm -f "$f" 44 done 45 46 elif [ "$TRAVIS_OS_NAME" == 'osx' ]; then 47 pip install -U delocate 48 for f in dist/Cheetah3-*-cp$v-*-macosx*.whl; do 49 delocate-wheel -v "$f" 50 done 51 fi && 52 53 # TWINE_USERNAME / TWINE_PASSWORD / TWINE_REPOSITORY_URL 54 # must be set in Travis settings. 55 exec twine upload --skip-existing dist/*