#!/bin/bash

if [ -z "${MESON_SOURCE_ROOT}" ]; then
  echo "[ERROR] This script can only be ran with meson!"
  exit 1
fi

set -euo pipefail

rm -rf "${MESON_BUILD_ROOT}/wrappers/btllib"
cp -r "${MESON_BUILD_ROOT}/wrappers/python" "${MESON_BUILD_ROOT}/wrappers/btllib"
cp "${MESON_SOURCE_ROOT}/wrappers/python/btllib.py" "${MESON_BUILD_ROOT}/wrappers/btllib/__init__.py"
export PYTHONPATH="${MESON_BUILD_ROOT}/wrappers/"
cd "${MESON_SOURCE_ROOT}/tests/python"
python -m unittest
