-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.bat
More file actions
80 lines (71 loc) · 2.39 KB
/
install.bat
File metadata and controls
80 lines (71 loc) · 2.39 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
@echo off
setlocal
cd /d "%~dp0"
set "PY_CMD="
where python.exe >nul 2>nul && set "PY_CMD=python.exe"
if not defined PY_CMD (
where python >nul 2>nul && set "PY_CMD=python"
)
if not defined PY_CMD (
where py >nul 2>nul && set "PY_CMD=py -3"
)
if not defined PY_CMD (
echo Python was not found. Install Python 3.10+ first.
exit /b 1
)
set "INSTALL_PY="
set "USE_VENV="
if not exist ".venv\Scripts\python.exe" (
echo Creating virtual environment...
call %PY_CMD% -m venv .venv >nul 2>nul
if errorlevel 1 (
echo Virtual environment creation failed. Falling back to user installation...
if exist ".venv" (
powershell -NoProfile -ExecutionPolicy Bypass -Command "Remove-Item -LiteralPath '.venv' -Recurse -Force" >nul 2>nul
)
)
)
if exist ".venv\Scripts\python.exe" (
call ".venv\Scripts\python.exe" -m pip --version >nul 2>nul
if not errorlevel 1 (
set "INSTALL_PY=.venv\Scripts\python.exe"
set "USE_VENV=1"
) else (
echo Virtual environment exists but pip is not available there. Falling back to user installation...
)
)
if not defined INSTALL_PY set "INSTALL_PY=%PY_CMD%"
echo Upgrading pip/setuptools when internet is available...
call %INSTALL_PY% -m pip --disable-pip-version-check install --retries 0 --timeout 5 --upgrade pip setuptools >nul 2>nul
if errorlevel 1 (
echo Upgrade step skipped or failed. Continuing with local packages...
)
echo Installing requirements...
call %INSTALL_PY% -m pip --disable-pip-version-check install -r requirements.txt
if errorlevel 1 exit /b 1
echo Configuring Windows integration...
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0tools\register_file_assoc.ps1" >nul 2>nul
if errorlevel 1 (
echo File association step skipped or failed.
)
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0tools\create_shortcuts.ps1" >nul 2>nul
if errorlevel 1 (
echo Desktop shortcut step skipped or failed.
)
> ".gdpy-installed-marker" echo installed
> ".gdpy-install-root.txt" echo %CD%
echo.
echo Installation complete.
if defined USE_VENV (
echo Mode: local virtual environment
echo Run scripts with:
echo run_gdpy.bat example.gdpy
) else (
echo Mode: user Python installation
echo Run scripts with:
echo run_gdpy.bat example.gdpy
)
echo The interpreter runs from the source folder.
echo Open the source with:
echo open_source.bat
exit /b 0