mirror of
https://github.com/TREX-CoE/trexio.git
synced 2024-12-22 12:23:54 +01:00
Optional check and update of numpy.i file if outdated
This commit is contained in:
parent
ec7a39f6c2
commit
66a790717a
@ -213,6 +213,8 @@ $(pytrexio_c): $(ORG_FILES) $(trexio_h) $(pytrexio_i) $(numpy_i)
|
|||||||
$(numpy_i):
|
$(numpy_i):
|
||||||
wget https://raw.githubusercontent.com/numpy/numpy/main/tools/swig/numpy.i -O $(numpy_i)
|
wget https://raw.githubusercontent.com/numpy/numpy/main/tools/swig/numpy.i -O $(numpy_i)
|
||||||
|
|
||||||
|
check-numpy:
|
||||||
|
cd tools && ./check_numpy_i.sh
|
||||||
|
|
||||||
CLEANFILES += src/pytrexio_wrap.c \
|
CLEANFILES += src/pytrexio_wrap.c \
|
||||||
src/pytrexio.py \
|
src/pytrexio.py \
|
||||||
@ -220,7 +222,7 @@ CLEANFILES += src/pytrexio_wrap.c \
|
|||||||
python/src/*.c \
|
python/src/*.c \
|
||||||
python/src/*.h
|
python/src/*.h
|
||||||
|
|
||||||
.PHONY: cppcheck python-test python-install
|
.PHONY: cppcheck python-test python-install check-numpy
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
32
tools/check_numpy_i.sh
Executable file
32
tools/check_numpy_i.sh
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Check that script is executed from tools directory
|
||||||
|
if [[ $(basename $PWD) != "tools" ]] ; then
|
||||||
|
echo "This script should run in the tools directory"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
TREXIO_ROOT=$(dirname "${PWD}../")
|
||||||
|
|
||||||
|
# First define readonly global variables.
|
||||||
|
readonly SRC=${TREXIO_ROOT}/src
|
||||||
|
readonly TOOLS=${TREXIO_ROOT}/tools
|
||||||
|
|
||||||
|
# We want the script to crash on the 1st error:
|
||||||
|
set -e
|
||||||
|
|
||||||
|
NUMPY_SRC=${SRC}/numpy.i
|
||||||
|
NUMPY_LATEST=${TOOLS}/numpy.i
|
||||||
|
|
||||||
|
# Download the latest numpy.i file from NumPy GitHub
|
||||||
|
wget https://raw.githubusercontent.com/numpy/numpy/main/tools/swig/numpy.i -O ${NUMPY_LATEST}
|
||||||
|
|
||||||
|
# Execute diff to check if the numpy.i file in the src/ directory is updated
|
||||||
|
if ! diff -q ${NUMPY_LATEST} ${NUMPY_SRC} &>/dev/null; then
|
||||||
|
>&2 echo "numpy.i SWIG interface file in the source tree is outdated; replacing ..."
|
||||||
|
mv ${NUMPY_LATEST} ${NUMPY_SRC}
|
||||||
|
else
|
||||||
|
>&2 echo "numpy.i SWIG interface file in the source tree is up-to-date."
|
||||||
|
rm ${NUMPY_LATEST}
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user