Repository navigation
Expand file tree
/
Copy pathStart-Source.cmd
More file actions
88 lines (79 loc) · 2.4 KB
/
Copy pathStart-Source.cmd
File metadata and controls
88 lines (79 loc) · 2.4 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
@echo off
setlocal EnableExtensions
cd /d "%~dp0"
set "PYTHON_CMD="
py -3 -c "import sys; raise SystemExit(0 if sys.version_info >= (3, 10) else 1)" >nul 2>nul
if not errorlevel 1 set "PYTHON_CMD=py -3"
if not defined PYTHON_CMD (
python -c "import sys; raise SystemExit(0 if sys.version_info >= (3, 10) else 1)" >nul 2>nul
if not errorlevel 1 set "PYTHON_CMD=python"
)
if not defined PYTHON_CMD (
echo.
echo Python 3.10 or newer was not found.
echo Install Python from https://www.python.org/downloads/windows/
echo Then run this file again.
echo.
pause
exit /b 1
)
if not exist ".venv\Scripts\python.exe" (
echo Creating local Python environment...
call %PYTHON_CMD% -m venv .venv
if errorlevel 1 (
echo.
echo Failed to create the local Python environment.
echo.
pause
exit /b 1
)
)
".venv\Scripts\python.exe" -c "import sys; raise SystemExit(0 if sys.version_info >= (3, 10) else 1)" >nul 2>nul
if errorlevel 1 (
echo.
echo The existing .venv uses an unsupported Python version.
echo Delete the .venv folder, then run this file again.
echo.
pause
exit /b 1
)
echo Installing or updating dependencies...
".venv\Scripts\python.exe" -m pip install -r requirements.txt
if errorlevel 1 (
echo.
echo Failed to install the required dependencies.
echo Check your network connection, then run this file again.
echo.
pause
exit /b 1
)
".venv\Scripts\python.exe" -c "import mss, numpy, cv2, serial, bleak, PIL, sounddevice, soundcard, websockets, rtmlib, onnxruntime" >nul 2>nul
if errorlevel 1 (
echo Repairing local dependencies...
".venv\Scripts\python.exe" -m pip install --force-reinstall --no-cache-dir -r requirements.txt
if errorlevel 1 (
echo.
echo Failed to repair the required dependencies.
echo.
pause
exit /b 1
)
".venv\Scripts\python.exe" -c "import mss, numpy, cv2, serial, bleak, PIL, sounddevice, soundcard, websockets, rtmlib, onnxruntime" >nul 2>nul
if errorlevel 1 (
echo.
echo Failed to import the required dependencies.
echo.
pause
exit /b 1
)
)
set "PYTHONPATH=%CD%\src"
".venv\Scripts\python.exe" -m osr_screen_tcode %*
set "EXIT_CODE=%ERRORLEVEL%"
if not "%EXIT_CODE%"=="0" (
echo.
echo The app closed with error code %EXIT_CODE%.
echo.
pause
)
exit /b %EXIT_CODE%