-
Notifications
You must be signed in to change notification settings - Fork 0
/
requirements.bat
63 lines (52 loc) · 1.52 KB
/
requirements.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
@echo off
setlocal
REM Function to check and handle errors
:check_error
if %errorlevel% neq 0 (
echo Error occurred: %1
call :cleanup
exit /b %errorlevel%
)
REM Function to clean up in case of failure
:cleanup
if exist venv (
echo Cleaning up...
rmdir /s /q venv
)
goto :EOF
REM Check if Python is installed
echo Checking for Python installation...
python --version >nul 2>&1
call :check_error "Python is not installed. Please install Python before running this script."
REM Check for pip installation
echo Checking for pip installation...
pip --version >nul 2>&1
if %errorlevel% neq 0 (
echo Pip is not installed. Installing pip...
python -m ensurepip --upgrade
call :check_error "Failed to install pip."
)
REM Create a virtual environment
echo Creating virtual environment...
python -m venv venv
call :check_error "Failed to create virtual environment."
REM Activate the virtual environment
echo Activating virtual environment...
call venv\Scripts\activate.bat
call :check_error "Failed to activate virtual environment."
REM Upgrade pip
echo Upgrading pip...
python -m pip install --upgrade pip
call :check_error "Failed to upgrade pip."
REM Install pygame and pyarmor
echo Installing pygame==2.6.0 and pyarmor...
pip install pygame==2.6.0 pyarmor
call :check_error "Failed to install one or more packages."
REM Deactivate the virtual environment
echo Deactivating virtual environment...
deactivate
call :check_error "Failed to deactivate virtual environment."
echo Installation complete.
pause
endlocal
exit /b 0