2016-10-16 16:46:46 +02:00
|
|
|
#
|
|
|
|
# This helper is for templates installing python3-only modules.
|
|
|
|
#
|
|
|
|
|
|
|
|
do_build() {
|
|
|
|
if [ -n "$CROSS_BUILD" ]; then
|
|
|
|
PYPREFIX="$XBPS_CROSS_BASE"
|
|
|
|
CFLAGS+=" -I${XBPS_CROSS_BASE}/${py3_inc} -I${XBPS_CROSS_BASE}/usr/include"
|
|
|
|
LDFLAGS+=" -L${XBPS_CROSS_BASE}/${py3_lib} -L${XBPS_CROSS_BASE}/usr/lib"
|
|
|
|
CC="${XBPS_CROSS_TRIPLET}-gcc -pthread $CFLAGS $LDFLAGS"
|
|
|
|
LDSHARED="${CC} -shared $LDFLAGS"
|
2019-12-23 17:14:02 +01:00
|
|
|
for f in ${XBPS_CROSS_BASE}/${py3_lib}/_sysconfigdata_*; do
|
|
|
|
f=${f##*/}
|
|
|
|
_PYTHON_SYSCONFIGDATA_NAME=${f%.py}
|
|
|
|
done
|
2016-10-16 16:46:46 +02:00
|
|
|
env CC="$CC" LDSHARED="$LDSHARED" \
|
|
|
|
PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \
|
2019-12-23 17:14:02 +01:00
|
|
|
PYTHONPATH=${XBPS_CROSS_BASE}/${py3_lib} \
|
|
|
|
_PYTHON_SYSCONFIGDATA_NAME="$_PYTHON_SYSCONFIGDATA_NAME" \
|
2017-08-25 15:15:15 +02:00
|
|
|
LDFLAGS="$LDFLAGS" python3 setup.py build ${make_build_args}
|
2016-10-16 16:46:46 +02:00
|
|
|
else
|
2017-08-25 15:15:15 +02:00
|
|
|
python3 setup.py build ${make_build_args}
|
2016-10-16 16:46:46 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-02-20 13:51:47 +01:00
|
|
|
do_check() {
|
2021-06-08 05:41:26 +02:00
|
|
|
if python3 -c 'import pytest' >/dev/null 2>&1; then
|
|
|
|
PYTHONPATH="$(cd build/lib* && pwd)" \
|
|
|
|
python3 -m pytest ${make_check_args} ${make_check_target}
|
2020-12-03 04:22:31 +01:00
|
|
|
else
|
|
|
|
# Fall back to deprecated setup.py test orchestration without pytest
|
|
|
|
if [ -z "$make_check_target" ]; then
|
|
|
|
if ! python3 setup.py --help test >/dev/null 2>&1; then
|
|
|
|
msg_warn "No command 'test' defined by setup.py.\n"
|
|
|
|
return 0
|
|
|
|
fi
|
2019-02-20 13:51:47 +01:00
|
|
|
fi
|
|
|
|
|
2020-12-03 04:22:31 +01:00
|
|
|
: ${make_check_target:=test}
|
|
|
|
python3 setup.py ${make_check_target} ${make_check_args}
|
|
|
|
fi
|
2019-02-20 13:51:47 +01:00
|
|
|
}
|
|
|
|
|
2016-10-16 16:46:46 +02:00
|
|
|
do_install() {
|
|
|
|
if [ -n "$CROSS_BUILD" ]; then
|
|
|
|
PYPREFIX="$XBPS_CROSS_BASE"
|
|
|
|
CFLAGS+=" -I${XBPS_CROSS_BASE}/${py3_inc} -I${XBPS_CROSS_BASE}/usr/include"
|
|
|
|
LDFLAGS+=" -L${XBPS_CROSS_BASE}/${py3_lib} -L${XBPS_CROSS_BASE}/usr/lib"
|
|
|
|
CC="${XBPS_CROSS_TRIPLET}-gcc -pthread $CFLAGS $LDFLAGS"
|
|
|
|
LDSHARED="${CC} -shared $LDFLAGS"
|
2019-12-23 17:14:02 +01:00
|
|
|
for f in ${XBPS_CROSS_BASE}/${py3_lib}/_sysconfigdata_*; do
|
|
|
|
f=${f##*/}
|
|
|
|
_PYTHON_SYSCONFIGDATA_NAME=${f%.py}
|
|
|
|
done
|
2016-10-16 16:46:46 +02:00
|
|
|
env CC="$CC" LDSHARED="$LDSHARED" \
|
|
|
|
PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \
|
2019-12-23 17:14:02 +01:00
|
|
|
PYTHONPATH=${XBPS_CROSS_BASE}/${py3_lib} \
|
|
|
|
_PYTHON_SYSCONFIGDATA_NAME="$_PYTHON_SYSCONFIGDATA_NAME" \
|
2016-10-16 16:46:46 +02:00
|
|
|
LDFLAGS="$LDFLAGS" python3 setup.py \
|
|
|
|
install --prefix=/usr --root=${DESTDIR} ${make_install_args}
|
|
|
|
else
|
2017-08-25 15:15:15 +02:00
|
|
|
python3 setup.py install --prefix=/usr --root=${DESTDIR} ${make_install_args}
|
2016-10-16 16:46:46 +02:00
|
|
|
fi
|
|
|
|
}
|