-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.bat
47 lines (40 loc) · 1.38 KB
/
run.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
@echo off
:: @==========================Install required packages=============================@ ::
ECHO "Installing required packages..."
CALL pip install -r requirements.txt
IF errorlevel 1 GOTO ERROR
ECHO Successfully installed all packages located inside requirements.txt
GOTO PS
:: @==========================Run our python script=============================@ ::
:PS
set path=%~dp0
set absolute=%path%main.py
echo Found main.py path %absolute%
"C:\Python310\python.exe" %absolute%
:: @==========================Error Handling=============================@ ::
:ERROR
ECHO Locating the error...
for /F "" %%x in (requirements.txt) do (
echo %%x|find "#" >nul
if errorlevel 1 (
timeout /T 1 /NOBREAK
echo Package file %%x
SET str = pygame
if %%x == %str% (
:: Try to download the fixed version of pygame
ECHO pip install pygame
if errorlevel 1 (
ECHO Found an issue when trying to install pygame
ECHO Trying to fix the issue...
CALL pip install pygame --pre
if errorlevel 1 (
ECHO Cannot fix the issue.
timeout /T 1 /NOBREAK
) else (
ECHO Fixed the issue and successfully installed pygame
timeout /T 1 /NOBREAK
)
)
)
)
)