From f2564db6ee9c5c00690298fd3177dd0561c1da79 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Wed, 17 Jun 2026 13:40:14 -0500 Subject: [PATCH] Fix CRLF line endings for Windows batch files --- auto_run.bat | 58 +++++++++++++++--------------- auto_update.py | 46 ++++++++++++------------ run.bat | 96 +++++++++++++++++++++++++------------------------- 3 files changed, 100 insertions(+), 100 deletions(-) diff --git a/auto_run.bat b/auto_run.bat index 0114546..5756b09 100644 --- a/auto_run.bat +++ b/auto_run.bat @@ -1,29 +1,29 @@ -@echo off -chcp 65001 >nul -title RIPS Manager - Auto Update - -:: ---- 1. Verificar Python ---- -where python >nul 2>&1 -if %errorlevel% neq 0 ( - echo Descargando Python 3.12... - powershell -Command "& {Invoke-WebRequest -Uri 'https://www.python.org/ftp/python/3.12.9/python-3.12.9-amd64.exe' -OutFile '%TEMP%\python-installer.exe'}" - echo Instalando Python (esperar 1-2 min)... - start /wait "" "%TEMP%\python-installer.exe" /quiet InstallAllUsers=0 PrependPath=1 Include_test=0 - echo Python instalado. Cerra y abri PowerShell de nuevo. - pause - exit /b -) - -:: ---- 2. Actualizar e instalar deps ---- -echo Pull inicial... -git pull -python -m pip install -q -r requirements.txt - -:: ---- 3. Arrancar ---- -echo. -echo ========================================== -echo Servidor: http://localhost:8080 -echo Auto-update cada 60 segundos -echo Cerra esta ventana para detener -echo ========================================== -python auto_update.py +@echo off +chcp 65001 >nul +title RIPS Manager - Auto Update + +:: ---- 1. Verificar Python ---- +where python >nul 2>&1 +if %errorlevel% neq 0 ( + echo Descargando Python 3.12... + powershell -Command "& {Invoke-WebRequest -Uri 'https://www.python.org/ftp/python/3.12.9/python-3.12.9-amd64.exe' -OutFile '%TEMP%\python-installer.exe'}" + echo Instalando Python (esperar 1-2 min)... + start /wait "" "%TEMP%\python-installer.exe" /quiet InstallAllUsers=0 PrependPath=1 Include_test=0 + echo Python instalado. Cerra y abri PowerShell de nuevo. + pause + exit /b +) + +:: ---- 2. Actualizar e instalar deps ---- +echo Pull inicial... +git pull +python -m pip install -q -r requirements.txt + +:: ---- 3. Arrancar ---- +echo. +echo ========================================== +echo Servidor: http://localhost:8080 +echo Auto-update cada 60 segundos +echo Cerra esta ventana para detener +echo ========================================== +python auto_update.py diff --git a/auto_update.py b/auto_update.py index 158321e..d21ad37 100644 --- a/auto_update.py +++ b/auto_update.py @@ -1,23 +1,23 @@ -import subprocess, threading, time, sys, os -from pathlib import Path - -root = Path(__file__).parent.resolve() - -def pull_loop(): - while True: - time.sleep(60) - try: - r = subprocess.run(['git', 'pull'], cwd=root, capture_output=True, text=True, timeout=30) - if r.stdout.strip(): - print(f"[auto] git pull: {r.stdout.strip()}") - subprocess.run([sys.executable, '-m', 'pip', 'install', '-q', '-r', 'requirements.txt'], - cwd=root, capture_output=True, timeout=30) - except Exception as e: - print(f"[auto] pull error: {e}") - -threading.Thread(target=pull_loop, daemon=True).start() -os.chdir(root) -sys.path.insert(0, str(root)) - -import uvicorn, main -uvicorn.run('main:app', host='0.0.0.0', port=8080, reload=True) +import subprocess, threading, time, sys, os +from pathlib import Path + +root = Path(__file__).parent.resolve() + +def pull_loop(): + while True: + time.sleep(60) + try: + r = subprocess.run(['git', 'pull'], cwd=root, capture_output=True, text=True, timeout=30) + if r.stdout.strip(): + print(f"[auto] git pull: {r.stdout.strip()}") + subprocess.run([sys.executable, '-m', 'pip', 'install', '-q', '-r', 'requirements.txt'], + cwd=root, capture_output=True, timeout=30) + except Exception as e: + print(f"[auto] pull error: {e}") + +threading.Thread(target=pull_loop, daemon=True).start() +os.chdir(root) +sys.path.insert(0, str(root)) + +import uvicorn, main +uvicorn.run('main:app', host='0.0.0.0', port=8080, reload=True) diff --git a/run.bat b/run.bat index d78d503..e63349c 100644 --- a/run.bat +++ b/run.bat @@ -1,48 +1,48 @@ -@echo off -chcp 65001 >nul -title RIPS Manager - Iniciando... - -:: Verificar si ya existe Python portable -if exist python\python.exe goto :start - -echo ========================================== -echo Descargando Python portable... -echo ========================================== -echo. - -:: Descargar Python embeddable (64-bit) -powershell -Command "& {Invoke-WebRequest -Uri 'https://www.python.org/ftp/python/3.12.9/python-3.12.9-embed-amd64.zip' -OutFile 'python.zip'}" - -if not exist python.zip ( - echo ERROR: No se pudo descargar Python - pause - exit /b -) - -echo. -echo Extrayendo... -powershell -Command "& {Expand-Archive -Path 'python.zip' -DestinationPath 'python' -Force}" -del python.zip - -:: Habilitar pip (descomentar línea en el archivo de configuración) -set PYTHON_EXE=%~dp0python\python.exe -set PTH_FILE=%~dp0python\python312._pth -powershell -Command "& {(Get-Content '%PTH_FILE%') -replace '#import site','import site' | Set-Content '%PTH_FILE%'}" - -:: Instalar pip -echo. -echo Instalando pip... -%PYTHON_EXE% -c "import urllib.request; exec(urllib.request.urlopen('https://bootstrap.pypa.io/get-pip.py').read())" - -:start -echo. -echo Instalando dependencias... -python\python.exe -m pip install -q -r requirements.txt 2>nul - -echo. -echo ========================================== -echo Servidor iniciado en http://localhost:8080 -echo Presiona Ctrl+C para detener -echo ========================================== -python\python.exe main.py -pause +@echo off +chcp 65001 >nul +title RIPS Manager - Iniciando... + +:: Verificar si ya existe Python portable +if exist python\python.exe goto :start + +echo ========================================== +echo Descargando Python portable... +echo ========================================== +echo. + +:: Descargar Python embeddable (64-bit) +powershell -Command "& {Invoke-WebRequest -Uri 'https://www.python.org/ftp/python/3.12.9/python-3.12.9-embed-amd64.zip' -OutFile 'python.zip'}" + +if not exist python.zip ( + echo ERROR: No se pudo descargar Python + pause + exit /b +) + +echo. +echo Extrayendo... +powershell -Command "& {Expand-Archive -Path 'python.zip' -DestinationPath 'python' -Force}" +del python.zip + +:: Habilitar pip (descomentar línea en el archivo de configuración) +set PYTHON_EXE=%~dp0python\python.exe +set PTH_FILE=%~dp0python\python312._pth +powershell -Command "& {(Get-Content '%PTH_FILE%') -replace '#import site','import site' | Set-Content '%PTH_FILE%'}" + +:: Instalar pip +echo. +echo Instalando pip... +%PYTHON_EXE% -c "import urllib.request; exec(urllib.request.urlopen('https://bootstrap.pypa.io/get-pip.py').read())" + +:start +echo. +echo Instalando dependencias... +python\python.exe -m pip install -q -r requirements.txt 2>nul + +echo. +echo ========================================== +echo Servidor iniciado en http://localhost:8080 +echo Presiona Ctrl+C para detener +echo ========================================== +python\python.exe main.py +pause