development/python3-numpy: Enable choice of python3 version

Signed-off-by: Christoph Willing <chris.willing@linux.com>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Christoph Willing 2024-08-19 16:14:26 +10:00 committed by Willy Sudiarto Raharjo
parent ff98654191
commit 7b6e771109
2 changed files with 18 additions and 6 deletions

View file

@ -34,3 +34,8 @@ IMPORTANT: The version installed by this SlackBuild does NOT include the
is available for python2 only and does not conflict with this
installation of numpy.
If a particular python3 version is to be used, it may be set using the
PYVER environment variable e.g.
PYVER=3.11 bash python3-numpy.SlackBuild
Otherwise it will use the version linked to by the system python3.

View file

@ -30,7 +30,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=python3-numpy
SRCNAM=numpy
VERSION=${VERSION:-1.26.3}
BUILD=${BUILD:-2}
BUILD=${BUILD:-3}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@ -56,6 +56,13 @@ TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
PYVER=${PYVER:-$(python3 -c 'import sys; print("%d.%d" % sys.version_info[:2])')}
which python$PYVER 2>/dev/null 1>/dev/null
[ "$?" = "0" ] || {
echo "Can't find python$PYVER. Exiting now ..."
exit 1
}
set -e
rm -rf $PKG
@ -114,20 +121,20 @@ case "$DEBUG" in
esac
if [ ! "$DEBUG" ]; then
NPY_RELAXED_STRIDES_CHECKING=${NPY_RSC:-1} python3 -m build --wheel --no-isolation -Csetup-args="-Dallow-noblas=true"
python3 -m installer -d "$PKG" dist/*.whl
NPY_RELAXED_STRIDES_CHECKING=${NPY_RSC:-1} python$PYVER -m build --wheel --no-isolation -Csetup-args="-Dallow-noblas=true"
python$PYVER -m installer -d "$PKG" dist/*.whl
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
else
#NPY_RELAXED_STRIDES_CHECKING=${NPY_RSC:-1} python3 setup.py build --debug
#python3 setup.py install --root $PKG
#NPY_RELAXED_STRIDES_CHECKING=${NPY_RSC:-1} python$PYVER setup.py build --debug
#python$PYVER setup.py install --root $PKG
echo "debug here"
fi
mkdir -p $PKG/usr/include
cd $PKG/usr/include
ln -s $(ls -d /usr/lib${LIBDIRSUFFIX}/python3.*/site-packages)/numpy/core/include/numpy
ln -s $(ls -d /usr/lib${LIBDIRSUFFIX}/python$PYVER/site-packages)/numpy/core/include/numpy
cd -
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION