"""Build the development extension without installing into the interpreter."""
import os
from pathlib import Path
import shutil
import subprocess
import sys

root = Path(__file__).resolve().parents[1]
env = dict(os.environ, PYO3_PYTHON=sys.executable)
subprocess.run(['cargo', 'build', '--locked', '--release', '--features', 'extension-module'],
               cwd=root, env=env, check=True)
target = Path(env.get('CARGO_TARGET_DIR', root / 'target'))
shutil.copy2(target / 'release/lib_native.so', root / 'python/skirr/_native.so')