-
-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathsetup.bat
More file actions
99 lines (85 loc) · 2.09 KB
/
Copy pathsetup.bat
File metadata and controls
99 lines (85 loc) · 2.09 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
89
90
91
92
93
94
95
96
97
98
99
:: Copyright (c) 2024-2026 Vili and contributors.
@echo off
setlocal
cls
echo.
echo H4X-Tools Setup Script
echo.
echo -- Made in Finland, by Vili.
echo.
if not exist h4xtools.py (
echo Error: Please run this script from the H4X-Tools project directory.
pause
exit /b 1
)
if not exist requirements.txt (
echo Error: requirements.txt was not found.
pause
exit /b 1
)
set "PYTHON_CMD="
where py >nul 2>nul
if not errorlevel 1 (
py -3 --version >nul 2>nul
if not errorlevel 1 set "PYTHON_CMD=py -3"
)
if not defined PYTHON_CMD (
where python >nul 2>nul
if not errorlevel 1 set "PYTHON_CMD=python"
)
if not defined PYTHON_CMD (
echo Error: Python 3 was not found.
echo Install Python 3.10+ from https://www.python.org/downloads/ and run setup again.
pause
exit /b 1
)
echo Using Python command: %PYTHON_CMD%
echo.
echo Creating virtual environment...
if not exist .venv (
%PYTHON_CMD% -m venv .venv
if errorlevel 1 (
echo Error: Failed to create virtual environment.
pause
exit /b 1
)
) else (
echo Existing .venv found, reusing it.
)
set "VENV_PYTHON=.venv\Scripts\python.exe"
if not exist "%VENV_PYTHON%" (
echo Error: Virtual environment Python was not found at %VENV_PYTHON%.
echo Delete .venv and run setup again.
pause
exit /b 1
)
echo.
echo Upgrading pip tooling...
"%VENV_PYTHON%" -m pip install --upgrade pip setuptools wheel
if errorlevel 1 (
echo Error: Failed to upgrade pip tooling.
pause
exit /b 1
)
echo.
echo Installing Python dependencies...
"%VENV_PYTHON%" -m pip install -r requirements.txt
if errorlevel 1 (
echo Error: Failed to install dependencies.
pause
exit /b 1
)
echo.
echo Setup complete!
echo Virtual environment: .venv
echo Run H4X-Tools with: .venv\Scripts\python.exe h4xtools.py
echo Or activate the environment with: .venv\Scripts\activate.bat
echo.
set /p "RUN_NOW=Do you want to run H4X-Tools with Python now? (y/N) "
if /i "%RUN_NOW%"=="y" (
"%VENV_PYTHON%" h4xtools.py
) else if /i "%RUN_NOW%"=="yes" (
"%VENV_PYTHON%" h4xtools.py
)
endlocal
exit /b 0