diff --git a/tools/prepare_python.sh b/tools/prepare_python.sh index 0b22ae6..2151378 100755 --- a/tools/prepare_python.sh +++ b/tools/prepare_python.sh @@ -32,9 +32,14 @@ cp ${INCLUDIR}/trexio.h ${PYDIR}/src # fix needed to define HAVE_HDF5 symbol so that Python extension is always compiled with HDF5 (without including config.h) # add "#define HAVE_HDF5 1" line after "#include stdint.h" using awk and sed export LINE_NO=$(($(awk '/stdint.h/{print NR}' ${PYDIR}/src/trexio.h) + 1)) -sed -i'' -e "$LINE_NO"'i \ -#define HAVE_HDF5 1 -' -- ${PYDIR}/src/trexio.h +# sed on MacOS is different from GNU sed on Linux and requires special treatment +if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' -e "$LINE_NO"'i \ + #define HAVE_HDF5 1' "${PYDIR}/src/trexio.h" +else + sed -i -e "$LINE_NO"'i \ + #define HAVE_HDF5 1' "${PYDIR}/src/trexio.h" +fi # Copy additional info cp ${TREXIO_ROOT}/AUTHORS ${TREXIO_ROOT}/LICENSE ${PYDIR}