File size: 6,425 Bytes
d328630 | 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 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | @set @x=0 /*
@echo off
cd /d "%~dp0.."
setlocal enabledelayedexpansion
title WanGP Installer
python -c "import sys; sys.exit(0 if sys.version_info >= (3,10) else 1)" >nul 2>&1
if !errorlevel! equ 0 goto :MENU
echo [*] Python 3.10+ not found. Running automated installer...
call :INSTALL_PYTHON
python -c "import sys; sys.exit(0 if sys.version_info >= (3,10) else 1)" >nul 2>&1
if !errorlevel! neq 0 (
echo [-] Automated installation failed or Python is still not recognized.
echo [*] Please install Python 3.10+ manually.
pause
exit /b 1
)
goto :MENU
:MENU
set "choice="
set "AUTO_FLAG="
cls
echo ======================================================
echo WAN2GP INSTALLER MENU
echo ======================================================
echo 1. Automatic Install (1-Click)
echo 2. Manual Install (Select env type, python/torch/kernel versions)
echo 3. Exit
echo ------------------------------------------------------
set /p main_choice="Select an option (1-3): "
if "!main_choice!"=="1" (
set "ENV_TYPE=venv"
set "AUTO_FLAG=--auto"
goto START_INSTALL
)
if "!main_choice!"=="3" exit
if not "!main_choice!"=="2" goto MENU
:ENV_MENU
cls
echo ======================================================
echo SELECT ENVIRONMENT TYPE
echo ======================================================
echo 1. Use 'venv' (Easiest - Comes prepackaged with python)
echo 2. Use 'uv' (Recommended - Handles Python 3.11 better)
echo 3. Use 'Conda'
echo 4. No Environment (Not Recommended)
echo 5. Exit
echo ------------------------------------------------------
set /p choice="Select an option (1-5): "
if "!choice!"=="" goto ENV_MENU
set "choice=!choice:"=!"
set "choice=!choice: =!"
if "!choice!"=="1" (
set "ENV_TYPE=venv"
goto START_INSTALL
)
if "!choice!"=="2" (
set "ENV_TYPE=uv"
where uv >nul 2>nul
if !errorlevel! neq 0 (
echo [-] 'uv' not found.
echo 1. Install 'uv' via PowerShell ^(Recommended^)
echo 2. Install 'uv' via Pip
set /p uv_choice="Select method: "
if "!uv_choice!"=="1" powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
if "!uv_choice!"=="2" python -m pip install uv
)
goto START_INSTALL
)
if "!choice!"=="3" (
set "ENV_TYPE=conda"
set "CONDA_FOUND=0"
where conda >nul 2>nul
if !errorlevel! equ 0 set "CONDA_FOUND=1"
if exist "!USERPROFILE!\Miniconda3\condabin\conda.bat" set "CONDA_FOUND=1"
if exist "!USERPROFILE!\Anaconda3\condabin\conda.bat" set "CONDA_FOUND=1"
if exist "C:\ProgramData\Miniconda3\condabin\conda.bat" set "CONDA_FOUND=1"
if "!CONDA_FOUND!"=="0" (
call :INSTALL_CONDA
if !errorlevel! neq 0 (
echo [-] Miniconda installation failed or was aborted.
pause
goto MENU
)
)
goto START_INSTALL
)
if "!choice!"=="4" (
set "ENV_TYPE=none"
goto START_INSTALL
)
if "!choice!"=="5" exit
goto ENV_MENU
:START_INSTALL
if "!ENV_TYPE!"=="" set "ENV_TYPE=venv"
python setup.py install --env !ENV_TYPE! !AUTO_FLAG!
pause
goto MENU
:INSTALL_PYTHON
if exist "C:\Program Files\PyManager\pymanager.exe" goto :INSTALL_PY311
set "PY_URL=https://www.python.org/ftp/python/pymanager/python-manager-26.0.msi"
echo [*] Downloading PyManager installer...
call :DOWNLOAD "%PY_URL%" || exit /b 1
echo [*] Installing PyManager...
for %%F in ("%PY_URL%") do set "PY_FILE=%%~nxF"
start /wait msiexec /i "%PY_FILE%" /passive /norestart
del "%PY_FILE%"
if not exist "C:\Program Files\PyManager\pymanager.exe" (
echo [-] Installation failed.
exit /b 1
)
echo [*] PyManager installed successfully.
:INSTALL_PY311
echo [*] Configuring Python 3.11...
set "PATH=C:\Program Files\PyManager;%PATH%"
call pymanager install --configure >nul 2>&1
call pymanager install 3.11 >nul 2>&1
call pymanager install --aliases >nul 2>&1
set "PATH=%LOCALAPPDATA%\Programs\Python\Python311;%LOCALAPPDATA%\Programs\Python\Python311\Scripts;%PATH%"
exit /b 0
:INSTALL_CONDA
echo [-] 'conda' not found.
set "CONDA_URL=https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe"
echo [*] Downloading Miniconda3...
call :DOWNLOAD "%CONDA_URL%" || (
echo [-] Download failed. Please install Miniconda manually.
exit /b 1
)
for %%F in ("%CONDA_URL%") do set "CONDA_FILE=%%~nxF"
echo [*] Installing Miniconda silently ^(this may take a minute^)...
start /wait "" "%CONDA_FILE%" /InstallationType=JustMe /RegisterPython=0 /S /D="%USERPROFILE%\Miniconda3"
del "%CONDA_FILE%"
echo [*] Auto-accepting Conda Terms of Service...
call "%USERPROFILE%\Miniconda3\condabin\conda.bat" tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main >nul 2>&1
call "%USERPROFILE%\Miniconda3\condabin\conda.bat" tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r >nul 2>&1
call "%USERPROFILE%\Miniconda3\condabin\conda.bat" tos accept --override-channels --channel https://repo.anaconda.com/pkgs/msys2 >nul 2>&1
exit /b 0
:DOWNLOAD
set "DL_URL=%~1"
where curl >nul 2>nul
if %ERRORLEVEL% EQU 0 (
curl -L -O "%DL_URL%"
exit /b %ERRORLEVEL%
)
for %%F in ("%DL_URL%") do set "TMP_FILE=%%~nxF"
where certutil >nul 2>nul
if %ERRORLEVEL% EQU 0 (
certutil -urlcache -split -f "%DL_URL%" "%TMP_FILE%"
if exist "%TMP_FILE%" exit /b 0
)
where bitsadmin >nul 2>nul
if %ERRORLEVEL% EQU 0 (
bitsadmin /transfer "WanGPDownload" /download /priority normal "%DL_URL%" "%CD%\%TMP_FILE%"
if exist "%TMP_FILE%" exit /b 0
)
cscript //nologo //E:JScript "%~f0" "%DL_URL%" "%TMP_FILE%"
if exist "%TMP_FILE%" exit /b 0
echo [-] All native download methods failed.
exit /b 1
*/
var args = WScript.Arguments;
if (args.Length >= 2) {
try {
var http = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
http.Open("GET", args(0), false);
http.Send();
if (http.Status == 200) {
var stream = new ActiveXObject("ADODB.Stream");
stream.Open();
stream.Type = 1;
stream.Write(http.ResponseBody);
stream.SaveToFile(args(1), 2);
stream.Close();
}
} catch (e) {
}
} |