11#! /bin/bash
2- PACKAGE=trepan3k
2+ PACKAGE_MODULE=" trepan"
3+
4+ # The name that PyPi sees this as.
5+ # It is set in setup.py's name.
6+ PACKAGE_NAME=" trepan3"
7+
8+ # Both the name an module name agree
9+ PACKAGE=$PACKAGE_NAME
310
411# FIXME put some of the below in a common routine
512function finish {
@@ -20,11 +27,54 @@ if ! source ./setup-master.sh ; then
2027fi
2128
2229cd ..
23- source trepan/version.py
24- echo $__version__
25- pyenv local 3.13
30+ source $PACKAGE_MODULE /version.py
31+ if [[ ! $__version__ ]] ; then
32+ echo " Something is wrong: __version__ should have been set."
33+ exit 1
34+ fi
35+
36+ for pyversion in $PYVERSIONS ; do
37+ case ${pyversion: 0: 4} in
38+ " graal" )
39+ echo " $pyversion - Graal does not get special packaging"
40+ continue
41+ ;;
42+ " jyth" )
43+ echo " $pyversion - Jython does not get special packaging"
44+ continue
45+ ;;
46+ " pypy" )
47+ echo " $pyversion - PyPy does not get special packaging"
48+ continue
49+ ;;
50+ " pyst" )
51+ echo " $pyversion - Pyston does not get special packaging"
52+ continue
53+ ;;
54+ esac
55+ echo " *** Packaging ${PACKAGE_NAME} for version ${__version__} on Python ${pyversion} ***"
56+ if ! pyenv local $pyversion ; then
57+ exit $?
58+ fi
59+ # pip bdist_egg create too-general wheels. So
60+ # we narrow that by moving the generated wheel.
61+
62+ # Pick out first two number of version, e.g. 3.5.1 -> 35
63+ first_two=$( echo $pyversion | cut -d' .' -f 1-2 | sed -e ' s/\.//' )
64+ rm -fr build
65+ pip wheel --wheel-dir=dist .
66+ mv -v dist/${PACKAGE_NAME} -$__version__ -{py2.py3,py$first_two }-none-any.whl
67+ done
2668
27- rm -fr build
28- pip wheel --wheel-dir=dist .
2969python -m build --sdist
70+ tarball=dist/${PACKAGE_NAME} -${__version__} .tar.gz
71+ if [[ -f $tarball ]]; then
72+ twine check $tarball
73+ fi
74+
75+ if [[ ! -d dist/uploaded/${__version__} ]] ; then
76+ mkdir -v dist/uploaded/${__version__}
77+ fi
78+
79+ twine check dist/${PACKAGE} -${__version__} -py3* .whl
3080finish
0 commit comments