Add files via upload

This commit is contained in:
Deniz Şafak
2024-03-15 18:08:04 +03:00
committed by GitHub
parent 5b24bb2b0d
commit a35974a622
+25 -25
View File
@@ -9,44 +9,44 @@ set ACTIVATE_PATH=%VENV_PATH%\Scripts\activate
:: Check if Python is installed :: Check if Python is installed
pip --version >nul 2>&1 pip --version >nul 2>&1
if errorlevel 1 ( if errorlevel 1 (
echo Python is not installed. echo Python is not installed.
set /p "userinp=Do you want to install Python (y/n)? " set /p "userinp=Do you want to install Python (y/n)? "
if /i "!userinp!"=="y" ( if /i "!userinp!"=="y" (
echo Opening download link... echo Opening download link...
start https://www.python.org/downloads/ start https://www.python.org/downloads/
exit /b exit /b
) else ( ) else (
echo Please install Python and try again. echo Please install Python and try again.
pause pause
exit /b exit /b
) )
) )
:: Check if virtual environment exists :: Check if virtual environment exists
IF NOT EXIST %ACTIVATE_PATH% ( IF NOT EXIST %VENV_PATH% (
echo Creating virtual environment... echo Creating virtual environment...
python -m venv %VENV_PATH% python -m venv %VENV_PATH%
) ELSE ( ) ELSE (
goto check_python goto check_python
) )
:: Check if Python exists at the path stored in the virtual environment :: Check if Python exists at the path stored in the virtual environment
:check_python :check_python
%VENV_PATH%\Scripts\python.exe --version >nul 2>&1 %VENV_PATH%\Scripts\python.exe --version >nul 2>&1
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (
echo Python not found at the path stored in the virtual environment. echo Python not found at the path stored in the virtual environment.
echo Recreating virtual environment... echo Recreating virtual environment...
rmdir /s /q %VENV_PATH% rmdir /s /q %VENV_PATH%
python -m venv %VENV_PATH% python -m venv %VENV_PATH%
) )
echo Activating virtual environment... echo Activating virtual environment...
call %ACTIVATE_PATH%s call %ACTIVATE_PATH%s
if errorlevel 1 ( if errorlevel 1 (
echo Failed to activate virtual environment. echo Failed to activate virtual environment.
echo Recreating virtual environment... echo Recreating virtual environment...
rmdir /s /q %VENV_PATH% rmdir /s /q %VENV_PATH%
python -m venv %VENV_PATH% python -m venv %VENV_PATH%
echo Activating virtual environment... echo Activating virtual environment...
call %ACTIVATE_PATH% call %ACTIVATE_PATH%
) )
@@ -54,15 +54,15 @@ if errorlevel 1 (
echo Checking the requirements... echo Checking the requirements...
:: Get the list of installed packages using pip freeze :: Get the list of installed packages using pip freeze
for /f "tokens=1,* delims==" %%i in ('pip freeze') do ( for /f "tokens=1,* delims==" %%i in ('pip freeze') do (
set installed[%%i]=%%j set installed[%%i]=%%j
) )
:: Compare with the requirements from the requirements.txt file :: Compare with the requirements from the requirements.txt file
for /f "tokens=1,* delims==" %%i in (%requirementsFile%) do ( for /f "tokens=1,* delims==" %%i in (%requirementsFile%) do (
if not "!installed[%%i]!"=="%%j" ( if not "!installed[%%i]!"=="%%j" (
echo Installing package: %%i==%%j echo Installing package: %%i==%%j
pip install %%i==%%j --upgrade --quiet pip install %%i==%%j --upgrade --quiet
) )
) )
echo Starting %NAME%... echo Starting %NAME%...