bat check dependencies fix

This commit is contained in:
Manchik
2026-05-15 17:27:21 +03:00
parent 9cce9b5b36
commit 1da8581069
+7 -10
View File
@@ -27,25 +27,22 @@ if not exist "venv\Scripts\activate.bat" (
) )
rem === Dependencies === rem === Dependencies ===
venv\Scripts\pip.exe show fastapi >nul 2>&1 rem Install only when requirements.txt has changed (hash stored in data\.req_hash)
if errorlevel 1 ( venv\Scripts\python.exe -c "import hashlib,pathlib; r=pathlib.Path('requirements.txt'); h=hashlib.md5(r.read_bytes()).hexdigest(); hf=pathlib.Path('data/.req_hash'); ok=hf.exists() and hf.read_text().strip()==h; print('OK' if ok else 'CHANGED')" > %TEMP%\req_check.txt 2>nul
set /p REQ_STATUS=<%TEMP%\req_check.txt
if /i "%REQ_STATUS%"=="CHANGED" (
echo Installing dependencies... echo Installing dependencies...
venv\Scripts\pip.exe install -r requirements.txt venv\Scripts\pip.exe install -r requirements.txt -q --upgrade-strategy only-if-needed
if errorlevel 1 goto :err_deps if errorlevel 1 goto :err_deps
echo Dependencies installed. echo Dependencies installed.
rem Save new hash
venv\Scripts\python.exe -c "import hashlib,pathlib; r=pathlib.Path('requirements.txt'); h=hashlib.md5(r.read_bytes()).hexdigest(); pathlib.Path('data').mkdir(exist_ok=True); pathlib.Path('data/.req_hash').write_text(h)"
rem === Patch nodriver/cdp/network.py encoding bug (non-UTF-8 byte in comment) === rem === Patch nodriver/cdp/network.py encoding bug (non-UTF-8 byte in comment) ===
venv\Scripts\python.exe -c "import pathlib; p=pathlib.Path('venv/Lib/site-packages/nodriver/cdp/network.py'); d=p.read_bytes() if p.exists() else b''; p.write_bytes(d.replace(b'\xb1',b'+-')) if p.exists() and b'\xb1' in d else None" venv\Scripts\python.exe -c "import pathlib; p=pathlib.Path('venv/Lib/site-packages/nodriver/cdp/network.py'); d=p.read_bytes() if p.exists() else b''; p.write_bytes(d.replace(b'\xb1',b'+-')) if p.exists() and b'\xb1' in d else None"
) else ( ) else (
echo Dependencies OK. echo Dependencies OK.
) )
rem === Ensure psutil is installed (required for browser process monitoring) ===
venv\Scripts\pip.exe show psutil >nul 2>&1
if errorlevel 1 (
echo Installing psutil...
venv\Scripts\pip.exe install psutil>=6.0.0 -q
)
:launch :launch
cls cls