-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile.bat
61 lines (56 loc) · 1.95 KB
/
compile.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
@echo off
setlocal enabledelayedexpansion
:: Debug Breakpoint: Start script
echo [DEBUG] Starting the script...
:: Check if Python is installed
where python >nul 2>nul
if %errorlevel%==0 (
echo [DEBUG] Python is installed.
python --version
if %errorlevel% neq 0 (
echo [DEBUG] Python command failed. Ensure Python is correctly installed and in PATH.
exit /b 1
)
echo [DEBUG] Proceeding to compilation...
goto :compile
)
:: Handle Python not installed
echo [DEBUG] Python is not installed. Prompting user...
echo Would you like to install Python now? (y/n)
set /p user_choice=
echo [DEBUG] User chose: !user_choice!
if /i "!user_choice!"=="y" (
echo [DEBUG] Downloading Python installer...
bitsadmin /transfer "PythonDownload" https://www.python.org/ftp/python/3.11.5/python-3.11.5-amd64.exe "%USERPROFILE%\Downloads\python-installer.exe"
if %errorlevel% neq 0 (
echo [DEBUG] Failed to download the Python installer.
echo Failed to download the Python installer. Please check your internet connection and try again.
exit /b 1
)
echo Launching the installer...
start /wait "%USERPROFILE%\Downloads\python-installer.exe"
if %errorlevel% neq 0 (
echo [DEBUG] Python installation failed.
echo Python installation failed. Please check the installer for errors.
exit /b 1
)
echo [DEBUG] Python installation complete.
goto :compile
) else (
echo [DEBUG] User chose not to install Python.
echo Python installation skipped. Exiting.
exit /b 1
)
:compile
:: Debug Breakpoint: Compile Python files
echo [DEBUG] Compiling Python files...
python -m compileall .\src >nul 2>nul
if %errorlevel% neq 0 (
echo [DEBUG] Compilation failed.
echo Compilation failed. Please check for errors in your Python scripts.
exit /b 1
)
echo [DEBUG] Compilation successful.
echo Compilation successful.
pause
/