Files
mpm-documentation-kit/setup.sh
T

23 lines
1.3 KiB
Bash
Raw Permalink Normal View History

2026-11-09 11:51:56 -06:00
#!/usr/bin/env bash
# MPM Documentation Kit: one-time setup for building PDFs (macOS / Linux). Safe to run again.
set -e
cd "$(dirname "$0")"
PY=$(command -v python3 || true)
[ -z "$PY" ] && { echo "Python 3.10+ is required: https://www.python.org/downloads/"; exit 1; }
"$PY" -c 'import sys; sys.exit(0 if sys.version_info >= (3, 10) else 1)' || { echo "Python 3.10+ is required"; exit 1; }
echo "• Python packages"
"$PY" -m pip install --user -q -r requirements.txt 2>/dev/null || "$PY" -m pip install -q -r requirements.txt --break-system-packages
echo "• Chromium (renders the PDFs)"
"$PY" -m playwright install chromium
if ! command -v pdftotext >/dev/null; then
echo "• poppler (places the revision block)"
if command -v brew >/dev/null; then brew install poppler
elif command -v apt-get >/dev/null; then sudo apt-get install -y poppler-utils
else echo " Install poppler yourself (pdftotext); builds still work without it, but the revision block isn't anchored."; fi
fi
if [ -d "_EXAMPLES/COMMTRAN PINGO P2.5/source" ]; then
echo "• Test build"
( cd "_EXAMPLES/COMMTRAN PINGO P2.5/source" && "$PY" build.py >/dev/null ) && echo "Ready. See START_HERE.md."
else
"$PY" -c "import playwright, fontTools, brotli, PIL" && echo "Ready. See START_HERE.md."
fi