cosmetics

This commit is contained in:
2026-01-02 11:55:52 +01:00
parent 86377f7193
commit 1e319f91e8
2 changed files with 15 additions and 8 deletions

16
run.bat
View File

@@ -1,4 +1,4 @@
:: @echo off @echo off
SETLOCAL EnableExtensions SETLOCAL EnableExtensions
SET "BASE_DIR=%~dp0" SET "BASE_DIR=%~dp0"
@@ -35,6 +35,7 @@ exit /b
:PYTHON_FOUND :PYTHON_FOUND
set "IS_VENV=false"
:: --- VENV creation --- :: --- VENV creation ---
if not exist "%VENV_DIR%" ( if not exist "%VENV_DIR%" (
echo [2/4] Virtual environment creation... echo [2/4] Virtual environment creation...
@@ -45,6 +46,7 @@ if not exist "%VENV_DIR%" (
exit /b exit /b
) )
) else ( ) else (
set "IS_VENV=true"
echo [2/4] Virtual environment already here. echo [2/4] Virtual environment already here.
) )
@@ -52,11 +54,13 @@ if not exist "%VENV_DIR%" (
echo [3/4] Activation of the venv and installation of dependencies... echo [3/4] Activation of the venv and installation of dependencies...
call "%VENV_DIR%\Scripts\activate" call "%VENV_DIR%\Scripts\activate"
if exist "%BASE_DIR%%REQUIREMENTS%" ( if "%IS_VENV%"=="false" (
pip install --upgrade pip if exist "%BASE_DIR%%REQUIREMENTS%" (
pip install -r "%BASE_DIR%%REQUIREMENTS%" pip install --upgrade pip
) else ( pip install -r "%BASE_DIR%%REQUIREMENTS%"
echo Info : No '%REQUIREMENTS%' file found, dependencies ignored. ) else (
echo Info : No '%REQUIREMENTS%' file found, dependencies ignored.
)
) )
:: --- Application launching --- :: --- Application launching ---

View File

@@ -27,11 +27,14 @@ if (-not $PythonExe) {
Write-Host "[+] Python found: $($PythonExe.Source)" -ForegroundColor Green Write-Host "[+] Python found: $($PythonExe.Source)" -ForegroundColor Green
$is_venv = $false
# 3. Virtual Environment management # 3. Virtual Environment management
if (-not (Test-Path $VenvPath)) { if (-not (Test-Path $VenvPath)) {
Write-Host "[2/4] Creating virtual environment..." -ForegroundColor Cyan Write-Host "[2/4] Creating virtual environment..." -ForegroundColor Cyan
& $PythonExe.Source -m venv $VenvPath & $PythonExe.Source -m venv $VenvPath
} else { } else {
$is_venv = $true
Write-Host "[2/4] Virtual environment already exists." -ForegroundColor Green Write-Host "[2/4] Virtual environment already exists." -ForegroundColor Green
} }
@@ -52,7 +55,7 @@ if ($env:VIRTUAL_ENV -and (Test-Path $env:VIRTUAL_ENV)) {
# 5. Execution # 5. Execution
try { try {
if (Test-Path $Requirements) { if ((Test-Path $Requirements) -and -not $is_venv) {
Write-Host "[+] Installing requirements..." -ForegroundColor Yellow Write-Host "[+] Installing requirements..." -ForegroundColor Yellow
python -m pip install --upgrade pip --quiet python -m pip install --upgrade pip --quiet
pip install -r $Requirements pip install -r $Requirements
@@ -62,7 +65,7 @@ try {
} }
Write-Host "[4/4] Starting $AppName..." -ForegroundColor Cyan Write-Host "[4/4] Starting $AppName..." -ForegroundColor Cyan
Write-Host "-----------------------------------------------------------" -ForegroundColor Gray Write-Host "-----------------------------------------------------------" -ForegroundColor Gray
python $PythonScript python $PythonScript $args
} }
catch { catch {
Write-Host "An error occurred during execution." -ForegroundColor Red Write-Host "An error occurred during execution." -ForegroundColor Red