Added virtual env. support

This commit is contained in:
Deniz Şafak
2024-03-10 03:42:21 +03:00
committed by GitHub
parent fc35b850f0
commit a835545c90
2 changed files with 21 additions and 11 deletions
+3 -3
View File
@@ -1,3 +1,3 @@
urllib3<2 urllib3==1.26.18
requests requests==2.31.0
pystray pystray==0.19.5
+18 -8
View File
@@ -1,15 +1,25 @@
@echo off @echo off
IF NOT EXIST .venv\Scripts\activate ( set NAME=HotspotAutoLogin
set "requirementsFile=requirements.txt"
set VENV_PATH=.venv
set ACTIVATE_PATH=%VENV_PATH%\Scripts\activate
IF NOT EXIST %ACTIVATE_PATH% (
echo Creating virtual environment... echo Creating virtual environment...
virtualenv .venv virtualenv %VENV_PATH%
echo Virtual environment created.
) )
echo Activating virtual environment... echo Activating virtual environment...
call .venv\Scripts\activate call %ACTIVATE_PATH%
echo Installing requirements... echo Checking the requirements...
pip install -r requirements.txt for /f "delims=" %%i in (%requirementsFile%) do (
pip freeze | findstr /c:%%i > nul
if errorlevel 1 (
echo Installing missing or outdated package: %%i
pip install %%i --upgrade --quiet
)
)
echo Starting HotspotAutoLogin... echo Starting %NAME%...
start /B "" ".venv/Scripts/pythonw.exe" HotspotAutoLogin.pyw start /B "" "%VENV_PATH%/Scripts/pythonw.exe" HotspotAutoLogin.pyw