|
| 1 | +#!/bin/bash |
| 2 | +# The name Python's import uses. |
| 3 | +# It is reflected in the directory structure. |
| 4 | +PACKAGE_MODULE="xasm" |
| 5 | + |
| 6 | +# The name that PyPi sees this as. |
| 7 | +# It is set in setup.py's name. |
| 8 | +PACKAGE_NAME="xasm" |
| 9 | + |
| 10 | +# FIXME put some of the below in a common routine |
| 11 | +function finish { |
| 12 | + if [[ -n "$make_dist_xasm_36_owd" ]] then |
| 13 | + cd $make_dist_xasm_36_owd |
| 14 | + fi |
| 15 | +} |
| 16 | + |
| 17 | +make_dist_xasm_36_owd=$(pwd) |
| 18 | +cd $(dirname ${BASH_SOURCE[0]}) |
| 19 | +trap finish EXIT |
| 20 | + |
| 21 | +if ! source ./pyenv-3.6-3.10-versions ; then |
| 22 | + exit $? |
| 23 | +fi |
| 24 | + |
| 25 | +if ! source ./setup-python-3.6.sh ; then |
| 26 | + exit $? |
| 27 | +fi |
| 28 | + |
| 29 | +cd .. |
| 30 | + |
| 31 | +source ${PACKAGE_MODULE}/version.py |
| 32 | +if [[ ! -n $__version__ ]]; then |
| 33 | + echo "Something is wrong: __version__ should have been set." |
| 34 | + exit 1 |
| 35 | +fi |
| 36 | + |
| 37 | +for pyversion in $PYVERSIONS; do |
| 38 | + case ${pyversion:0:4} in |
| 39 | + "graal" ) |
| 40 | + echo "$pyversion - Graal does not get special packaging" |
| 41 | + continue |
| 42 | + ;; |
| 43 | + "jyth" ) |
| 44 | + echo "$pyversion - Jython does not get special packaging" |
| 45 | + continue |
| 46 | + ;; |
| 47 | + "pypy" ) |
| 48 | + echo "$pyversion - PyPy does not get special packaging" |
| 49 | + continue |
| 50 | + ;; |
| 51 | + "pyst" ) |
| 52 | + echo "$pyversion - Pyston does not get special packaging" |
| 53 | + continue |
| 54 | + ;; |
| 55 | + esac |
| 56 | + echo "*** Packaging ${PACKAGE_NAME} for version ${__version__} on Python ${pyversion} ***" |
| 57 | + if ! pyenv local $pyversion ; then |
| 58 | + exit $? |
| 59 | + fi |
| 60 | + # pip bdist_egg create too-general wheels. So |
| 61 | + # we narrow that by moving the generated wheel. |
| 62 | + |
| 63 | + # Pick out first two number of version, e.g. 3.5.1 -> 35 |
| 64 | + first_two=$(echo $pyversion | cut -d'.' -f 1-2 | sed -e 's/\.//') |
| 65 | + rm -fr build |
| 66 | + python setup.py bdist_wheel |
| 67 | + mv -v dist/${PACKAGE_MODULE}-${__version__}-{py3,py$first_two}-none-any.whl |
| 68 | +done |
| 69 | + |
| 70 | +python ./setup.py sdist |
| 71 | +tarball=dist/${PACKAGE_NAME}-${__version__}.tar.gz |
| 72 | + |
| 73 | +if [[ -f $tarball ]]; then |
| 74 | + version_specific_tarball=dist/${PACKAGE_NAME}_36-${__version__}.tar.gz |
| 75 | + mv -v $tarball $version_specific_tarball |
| 76 | + twine check $version_specific_tarball |
| 77 | + |
| 78 | +fi |
| 79 | +twine check dist/${PACKAGE_MODULE}-${__version__}-py3*.whl |
| 80 | +finish |
0 commit comments