#!/bin/bash # Assistant de génération des supports (macOS) : double-cliquer sur ce fichier dans le Finder. cd "$(dirname "$0")" || exit 1 trouver_python() { for c in python3 /opt/homebrew/bin/python3 /usr/local/bin/python3; do if command -v "$c" >/dev/null 2>&1 && "$c" -c "import venv" >/dev/null 2>&1; then PY="$c" return 0 fi done return 1 } if ! trouver_python; then echo "Python 3 est nécessaire mais n'a pas été trouvé." read -r -p "L'installer automatiquement (outils de développement Apple) ? [O/n] " rep if [[ ! "$rep" =~ ^[nN] ]]; then xcode-select --install 2>/dev/null read -r -p "Suivez la fenêtre d'installation, puis appuyez sur Entrée une fois terminé... " fi if ! trouver_python; then echo "Installez Python depuis la page qui va s'ouvrir, puis relancez ce fichier." open "https://www.python.org/downloads/" read -r -p "Appuyez sur Entrée pour fermer... " exit 1 fi fi "$PY" scripts/assistant.py echo read -r -p "Appuyez sur Entrée pour fermer... "