Chaque lanceur trouve ou propose d'installer Python puis appelle l'assistant. .gitattributes impose LF pour .sh/.command et CRLF pour .bat ; bit exécutable posé dans git. Sous Windows, chcp et les tests Python lisent <nul pour ne pas vider l'entrée standard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
1.0 KiB
Batchfile
37 lines
1.0 KiB
Batchfile
@echo off
|
|
rem Assistant de generation des supports (Windows) : double-cliquer sur ce fichier.
|
|
setlocal
|
|
chcp 65001 >nul <nul
|
|
cd /d "%~dp0"
|
|
|
|
call :trouver_python
|
|
if defined PY goto lancer
|
|
|
|
echo Python est nécessaire mais n'a pas été trouvé sur cet ordinateur.
|
|
choice /c ON /m "Installer Python automatiquement (via winget)"
|
|
if errorlevel 2 goto manuel
|
|
winget install -e --id Python.Python.3.12 --accept-source-agreements --accept-package-agreements
|
|
call :trouver_python
|
|
if not defined PY goto manuel
|
|
|
|
:lancer
|
|
%PY% scripts\assistant.py
|
|
echo.
|
|
pause
|
|
exit /b
|
|
|
|
:manuel
|
|
echo.
|
|
echo Installez Python depuis la page qui va s'ouvrir,
|
|
echo en cochant la case "Add python.exe to PATH", puis relancez ce fichier.
|
|
start "" https://www.python.org/downloads/
|
|
pause
|
|
exit /b 1
|
|
|
|
:trouver_python
|
|
set "PY="
|
|
py -3 -c "import venv" <nul >nul 2>nul && set "PY=py -3" && exit /b
|
|
python -c "import venv" <nul >nul 2>nul && set "PY=python" && exit /b
|
|
for /d %%D in ("%LOCALAPPDATA%\Programs\Python\Python3*") do if exist "%%~D\python.exe" set PY="%%~D\python.exe"
|
|
exit /b
|