# SPDX-License-Identifier: MIT # Sourced by the rung scripts: the reference, its interpreter and the toolchain. ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) REF=${YM2612_PYTHON:-"$ROOT/external/ym2612-python"} PIN=44d504e8fad57a387c108f2538a6350e654dc2f2 [ -f "$REF/src/ym2612_python/chip.py" ] || { echo "no reference at $REF: run scripts/fetch_ym2612python.sh" >&2; exit 2; } [ "$(git -C "$REF" rev-parse HEAD)" = "$PIN" ] || { echo "the reference at $REF is not at the pin $PIN" >&2; exit 2; } if [ -z "${PYTHON:-}" ]; then for candidate in "$ROOT/../ym2612-python/.venv-pypy/bin/python" "$(command -v pypy3 || true)" python3; do if [ -n "$candidate" ] && [ -x "$(command -v "$candidate" || true)" ]; then PYTHON=$candidate; break; fi done fi # The reference imports nothing; PYTHONPATH puts the pinned copy first, ahead of any install. export PYTHONPATH="$REF/src${PYTHONPATH:+:$PYTHONPATH}" JOBS=${JOBS:-8} # A rustup toolchain when there is one (the system clippy may be older than the system rustc). if [ -d "$HOME/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin" ]; then export PATH="$HOME/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin:$PATH" fi