-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathINSTALL.bat
119 lines (94 loc) · 2.81 KB
/
INSTALL.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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
@echo off
set CWD=%~dp0
set NODE_PATH=node
set NPM_PATH=npm
set PIP_PATH=pip
set PYTHON_PATH=python
echo Installing w-AI-fu v2
::INSTALL NPM PACKAGES
echo Installing nodejs dependencies ...
::Check if node is installed
where %NODE_PATH% >nul 2>&1 || goto RetryNode
:AfterNode
::Check if npm is installed
where %NPM_PATH% >nul 2>&1 || goto RetryNpm
:AfterNpm
call %NPM_PATH% install
cd install
::INSTALL PIP PACKAGES
echo Installing python dependencies ...
::Check if python is installed
%PYTHON_PATH% --version 2>NUL
if errorlevel 1 goto RetryPython
:AfterPython
::Check if pip is installed
%PIP_PATH% --version 2>NUL
if errorlevel 1 goto RetryPip
:AfterPip
call %PIP_PATH% install -r requirements.txt
::CREATE SHORTCUT
echo.
echo Creating shortcut ...
call cscript /b create_shortcut.vbs
::END OF NORMAL EXECUTION
echo Done.
pause
goto:eof
::RETRY DIRECT IF ERROR
:RetryNode
echo Could not find node env variable, trying with direct path...
if exist "%PROGRAMFILES%\nodejs\node.exe" (
echo Found node path.
set NODE_PATH="%PROGRAMFILES%\nodejs\node.exe"
goto AfterNode
) else (
goto ErrNode
)
:RetryNpm
echo Could not find npm env variable, trying with direct path...
if exist "%PROGRAMFILES%\nodejs\npm" (
echo Found npm path.
set NPM_PATH="%PROGRAMFILES%\nodejs\npm"
goto AfterNpm
) else (
goto ErrNpm
)
:RetryPython
echo Could not find python env variable, trying with direct path...
if exist "%LOCALAPPDATA%\Programs\Python\Python310\python.exe" (
echo Found python path.
set PYTHON_PATH="%LOCALAPPDATA%\Programs\Python\Python310\python.exe"
goto AfterPython
) else (
goto ErrPython
)
:RetryPip
echo Could not find pip env variable, trying with direct path...
if exist "%LOCALAPPDATA%\Programs\Python\Python310\Scripts\pip.exe" (
echo Found pip path.
set PIP_PATH="%LOCALAPPDATA%\Programs\Python\Python310\Scripts\pip.exe"
goto AfterPip
) else (
goto ErrPip
)
::ERROR HANDLING
:ErrPython
echo Failed to find an installed Python environment. Please install Python (prefer v3.10.1X) from the official website: https://www.python.org/downloads/windows/
echo Make sure to tick "Add python to PATH" during installation.
pause
goto:eof
:ErrPip
echo Failed to find pip executable. Please install Python (prefer v3.10.1X) from the official website: https://www.python.org/downloads/windows/
echo Make sure to tick "Add python to PATH" during installation.
pause
goto:eof
:ErrNode
echo Could not find an installed NodeJS environment. Please install NodeJS (prefer v19.8.1) from the official website: https://nodejs.org/en/download/releases
echo Make sure to install Node using the .msi installer.
pause
goto:eof
:ErrNpm
echo Could not find npm. Please install NodeJS (prefer v19.8.1) from the official website: https://nodejs.org/en/download/releases
echo Make sure to install Node using the .msi installer.
pause
goto:eof