1+ @ echo off
2+
3+ REM Verifica la version de Python en python_embeded
4+ for /f " tokens=2 delims= " %%a in ('python_embeded\python.exe --version') do set PYTHON_VERSION = %%a
5+
6+ REM Extrae la version principal y secundaria
7+ for /f " tokens=1,2 delims=." %%b in (" %PYTHON_VERSION% " ) do (
8+ set PYTHON_MAJOR = %%b
9+ set PYTHON_MINOR = %%c
10+ )
11+
12+ REM Determina la URL a descargar segun la version de Python
13+ set WHL_URL =
14+ if %PYTHON_MAJOR% == 3 (
15+ if %PYTHON_MINOR% geq 9 if %PYTHON_MINOR% lss 10 set WHL_URL = https://github.com/woct0rdho/triton-windows/releases/download/v3.1.0-windows.post5/triton-3.1.0-cp39-cp39-win_amd64.whl
16+ if %PYTHON_MINOR% geq 10 if %PYTHON_MINOR% lss 11 set WHL_URL = https://github.com/woct0rdho/triton-windows/releases/download/v3.1.0-windows.post5/triton-3.1.0-cp310-cp310-win_amd64.whl
17+ if %PYTHON_MINOR% geq 11 if %PYTHON_MINOR% lss 12 set WHL_URL = https://github.com/woct0rdho/triton-windows/releases/download/v3.1.0-windows.post5/triton-3.1.0-cp311-cp311-win_amd64.whl
18+ if %PYTHON_MINOR% geq 12 if %PYTHON_MINOR% lss 13 set WHL_URL = https://github.com/woct0rdho/triton-windows/releases/download/v3.1.0-windows.post5/triton-3.1.0-cp312-cp312-win_amd64.whl
19+ )
20+
21+ REM Comprueba si se establecio una URL valida
22+ if " %WHL_URL% " == " " (
23+ echo No se encontro una version compatible de Python.
24+ pause
25+ exit /b
26+ )
27+
28+ REM Extrae el nombre del archivo de la URL
29+ for %%i in (%WHL_URL% ) do set WHL_FILE = %%~nxi
30+
31+ REM Descarga el archivo .whl correspondiente
32+ powershell -command " Invoke-WebRequest -Uri %WHL_URL% -OutFile %WHL_FILE% "
33+
34+ REM Verifica si la descarga fue exitosa
35+ if not exist " %WHL_FILE% " (
36+ echo Error al descargar %WHL_FILE% .
37+ pause
38+ exit /b
39+ )
40+
41+ REM Instala el archivo .whl descargado
42+ python_embeded\python.exe -m pip install --force-reinstall .\%WHL_FILE%
43+
44+ REM Verifica si la instalacion fue exitosa
45+ if %errorlevel% equ 0 (
46+ echo Installation successful
47+ ) else (
48+ echo Installation failed
49+ )
50+ pause
0 commit comments