diff --git a/pybuild.sh b/pybuild.sh new file mode 100755 index 0000000000000000000000000000000000000000..a19bb0f18969f903f9754ddf54dbfb8c7f666b4c --- /dev/null +++ b/pybuild.sh @@ -0,0 +1,89 @@ +#!/bin/bash + +# exit in case of any errors +set -e + +################################################################################ +# help # +################################################################################ +function print_help() { + # Display Help + echo "Build script for spams packages" + echo + echo "Usage: $0 [option...]" + echo + echo " -h Print the help" + echo " -v Verbose mode" + echo + exit 1 +} + +################################################################################ +# utils # +################################################################################ + +# log with verbosity management +function logging() { + if [[ ${PYBUILD_VERBOSE} == 1 ]]; then + echo -e $1 + fi +} + +################################################################################ +# process script options # +################################################################################ + +# default options +PYBUILD_VERBOSE=0 + +# Get the options +while getopts 'hv' option; do + case $option in + h) # display Help + print_help + ;; + v) # enable verbosity + PYBUILD_VERBOSE=1 + logging "## verbose mode" + ;; + \?) # Invalid option + echo "Error: Invalid option" + exit 1 + ;; + esac +done + +################################################################################ +# script setup # +################################################################################ + +# project root directory +PROJDIR=$(git rev-parse --show-toplevel) + +# python exec +PYTHON="python3" + +# python environment for build +BUILD_VENV=${PROJDIR}/.build_venv + +# python build requirements (names of packages to be installed with pip) +BUILD_REQ="pip build" + +################################################################################ +# prepare python environment # +################################################################################ + +logging "-- Preparing python environment for build..." + +${PYTHON} -m venv --clear ${BUILD_VENV} +source ${BUILD_VENV}/bin/activate + +pip install -U ${BUILD_REQ} + +################################################################################ +# build spams # +################################################################################ + +logging "-- Building spams..." + +python -m build --sdist . diff --git a/pytest.sh b/pytest.sh new file mode 100755 index 0000000000000000000000000000000000000000..f462bf0cbb67a87716f8f5a73b8c11f907fd59e2 --- /dev/null +++ b/pytest.sh @@ -0,0 +1,97 @@ +#!/bin/bash + +# exit in case of any errors +set -e + +################################################################################ +# help # +################################################################################ +function print_help() { + # Display Help + echo "Test run script for spams packages" + echo + echo "Usage: $0 [option...]" + echo + echo " -h Print the help" + echo " -v Verbose mode" + echo + exit 1 +} + +################################################################################ +# utils # +################################################################################ + +# log with verbosity management +function logging() { + if [[ ${PYTEST_VERBOSE} == 1 ]]; then + echo -e $1 + fi +} + +################################################################################ +# process script options # +################################################################################ + +# default options +PYTEST_VERBOSE=0 + +# Get the options +while getopts 'hv' option; do + case $option in + h) # display Help + print_help + ;; + v) # enable verbosity + PYTEST_VERBOSE=1 + logging "## verbose mode" + ;; + \?) # Invalid option + echo "Error: Invalid option" + exit 1 + ;; + esac +done + +################################################################################ +# script setup # +################################################################################ + +# project root directory +PROJDIR=$(git rev-parse --show-toplevel) + +# python exec +PYTHON="python3" + +# python environment for test +TEST_VENV=${PROJDIR}/.test_venv + +# python test requirements (names of packages to be installed with pip) +TEST_REQ="pip" + +################################################################################ +# prepare python environment # +################################################################################ + +logging "-- Preparing python environment for test..." + +${PYTHON} -m venv --clear ${TEST_VENV} +source ${TEST_VENV}/bin/activate + +pip install -U ${TEST_REQ} + +################################################################################ +# Installing spams # +################################################################################ + +logging "-- Installing spams..." + +pip install -e ${PROJDIR} + +################################################################################ +# Running pykeops tests # +################################################################################ + +logging "-- Running spams tests..." + +python tests/test_spams.py