when updating ML-IAP due to adding/removing PYTHON we need to delete and re-add cythonize support

This commit is contained in:
Axel Kohlmeyer
2022-02-24 20:40:55 -05:00
parent 58eb331b08
commit d0507559a4

View File

@ -29,7 +29,7 @@ action () {
# enforce package dependency
if (test $1 = 1 || test $1 = 2) then
if (test ! -e ../sna.h) then
echo "Must install SNAP package to use ML-IAP package"
echo "Must install ML-SNAP package to use ML-IAP package"
exit 1
fi
fi
@ -70,6 +70,21 @@ elif (test $1 = 0) then
elif (test $1 = 2) then
if (test "$(type cythonize 2> /dev/null)" != "" && test -e ../python_impl.cpp) then
if (test -e ../Makefile.package) then
sed -i -e 's/[^ \t]*-DMLIAP_PYTHON[^ \t]* //g' ../Makefile.package
fi
rm -f ../mliap_model_python_couple.cpp ../mliap_model_python_couple.h
sed -i -e '/^include.*python.*mliap_python.*$/d' ../Makefile.package.settings
if (test -e ../Makefile.package) then
sed -i -e 's|^PKG_INC =[ \t]*|&-DMLIAP_PYTHON |' ../Makefile.package
fi
if (test -e ../Makefile.package.settings) then
sed -i -e '/^include.*python.*mliap_python.*$/d' ../Makefile.package.settings
# multiline form needed for BSD sed on Macs
sed -i -e '4 i \
include ..\/..\/lib\/python\/Makefile.mliap_python
' ../Makefile.package.settings
fi
cythonize -3 ../mliap_model_python_couple.pyx
else
rm -f ../mliap_model_python_couple.cpp ../mliap_model_python_couple.h