Fix: eneabledelayedexpansion for error code

This commit is contained in:
litagin02
2024-03-16 16:49:22 +09:00
parent 5eef8843cc
commit f2cc879603
4 changed files with 62 additions and 36 deletions

View File

@@ -1,6 +1,8 @@
chcp 65001 > NUL chcp 65001 > NUL
@echo off @echo off
setlocal
@REM エラーコードを遅延評価するために設定
setlocal enabledelayedexpansion
@REM PowerShellのコマンド @REM PowerShellのコマンド
set PS_CMD=PowerShell -NoProfile -NoLogo -ExecutionPolicy Bypass set PS_CMD=PowerShell -NoProfile -NoLogo -ExecutionPolicy Bypass
@@ -31,7 +33,7 @@ echo --------------------------------------------------
echo Executing: git --version echo Executing: git --version
pause pause
git --version git --version
if %errorlevel% neq 0 ( if !errorlevel! neq 0 (
echo -------------------------------------------------- echo --------------------------------------------------
echo Git is not installed, so download and use PortableGit. echo Git is not installed, so download and use PortableGit.
echo Downloading PortableGit... echo Downloading PortableGit...
@@ -39,7 +41,7 @@ if %errorlevel% neq 0 (
echo Executing: curl -L %DL_URL% -o "%DL_DST%" echo Executing: curl -L %DL_URL% -o "%DL_DST%"
pause pause
curl -L %DL_URL% -o "%DL_DST%" curl -L %DL_URL% -o "%DL_DST%"
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & popd & exit /b !errorlevel! )
echo -------------------------------------------------- echo --------------------------------------------------
echo Extracting PortableGit... echo Extracting PortableGit...
@@ -47,7 +49,7 @@ if %errorlevel% neq 0 (
echo Executing: "%DL_DST%" -y echo Executing: "%DL_DST%" -y
pause pause
"%DL_DST%" -y "%DL_DST%" -y
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & popd & exit /b !errorlevel! )
echo -------------------------------------------------- echo --------------------------------------------------
echo Removing %DL_DST%... echo Removing %DL_DST%...
@@ -55,7 +57,7 @@ if %errorlevel% neq 0 (
echo Executing: del "%DL_DST%" echo Executing: del "%DL_DST%"
pause pause
del "%DL_DST%" del "%DL_DST%"
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & popd & exit /b !errorlevel! )
@REM Gitコマンドのパスを設定 @REM Gitコマンドのパスを設定
echo -------------------------------------------------- echo --------------------------------------------------
@@ -64,7 +66,7 @@ if %errorlevel% neq 0 (
echo Executing: set "PATH=%~dp0lib\PortableGit\bin;%PATH%" echo Executing: set "PATH=%~dp0lib\PortableGit\bin;%PATH%"
pause pause
set "PATH=%~dp0lib\PortableGit\bin;%PATH%" set "PATH=%~dp0lib\PortableGit\bin;%PATH%"
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & popd & exit /b !errorlevel! )
echo -------------------------------------------------- echo --------------------------------------------------
echo Checking Git Installation... echo Checking Git Installation...
@@ -72,7 +74,7 @@ if %errorlevel% neq 0 (
echo Executing: git --version echo Executing: git --version
pause pause
git --version git --version
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & popd & exit /b !errorlevel! )
) )
echo -------------------------------------------------- echo --------------------------------------------------
@@ -81,7 +83,7 @@ echo --------------------------------------------------
echo Executing: git clone %REPO_URL% echo Executing: git clone %REPO_URL%
pause pause
git clone %REPO_URL% git clone %REPO_URL%
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & popd & exit /b !errorlevel! )
@REM Pythonのセットアップ、仮想環境が有効化されて戻って来る @REM Pythonのセットアップ、仮想環境が有効化されて戻って来る
echo -------------------------------------------------- echo --------------------------------------------------
@@ -90,7 +92,7 @@ echo --------------------------------------------------
echo Executing: call Setup-Python.bat ".\lib\python" ".\Style-Bert-VITS2\venv" echo Executing: call Setup-Python.bat ".\lib\python" ".\Style-Bert-VITS2\venv"
pause pause
call Setup-Python.bat ".\lib\python" ".\Style-Bert-VITS2\venv" call Setup-Python.bat ".\lib\python" ".\Style-Bert-VITS2\venv"
if %errorlevel% neq 0 ( popd & exit /b %errorlevel% ) if !errorlevel! neq 0 ( popd & exit /b !errorlevel! )
@REM Style-Bert-VITS2フォルダに移動 @REM Style-Bert-VITS2フォルダに移動
pushd Style-Bert-VITS2 pushd Style-Bert-VITS2
@@ -101,7 +103,7 @@ echo --------------------------------------------------
echo Executing: pip install -r requirements.txt echo Executing: pip install -r requirements.txt
pause pause
pip install -r requirements.txt pip install -r requirements.txt
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & popd & exit /b !errorlevel! )
echo ---------------------------------------- echo ----------------------------------------
echo Environment setup is complete. Start downloading the model. echo Environment setup is complete. Start downloading the model.

View File

@@ -1,6 +1,8 @@
chcp 65001 > NUL chcp 65001 > NUL
@echo off @echo off
setlocal
@REM エラーコードを遅延評価するために設定
setlocal enabledelayedexpansion
@REM PowerShellのコマンド @REM PowerShellのコマンド
set PS_CMD=PowerShell -NoProfile -NoLogo -ExecutionPolicy Bypass set PS_CMD=PowerShell -NoProfile -NoLogo -ExecutionPolicy Bypass
@@ -31,7 +33,7 @@ echo --------------------------------------------------
echo Executing: git --version echo Executing: git --version
pause pause
git --version git --version
if %errorlevel% neq 0 ( if !errorlevel! neq 0 (
echo -------------------------------------------------- echo --------------------------------------------------
echo Git is not installed, so download and use PortableGit. echo Git is not installed, so download and use PortableGit.
echo Downloading PortableGit... echo Downloading PortableGit...
@@ -39,7 +41,7 @@ if %errorlevel% neq 0 (
echo Executing: curl -L %DL_URL% -o "%DL_DST%" echo Executing: curl -L %DL_URL% -o "%DL_DST%"
pause pause
curl -L %DL_URL% -o "%DL_DST%" curl -L %DL_URL% -o "%DL_DST%"
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & popd & exit /b !errorlevel! )
echo -------------------------------------------------- echo --------------------------------------------------
echo Extracting PortableGit... echo Extracting PortableGit...
@@ -47,7 +49,7 @@ if %errorlevel% neq 0 (
echo Executing: "%DL_DST%" -y echo Executing: "%DL_DST%" -y
pause pause
"%DL_DST%" -y "%DL_DST%" -y
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & popd & exit /b !errorlevel! )
echo -------------------------------------------------- echo --------------------------------------------------
echo Removing %DL_DST%... echo Removing %DL_DST%...
@@ -55,7 +57,7 @@ if %errorlevel% neq 0 (
echo Executing: del "%DL_DST%" echo Executing: del "%DL_DST%"
pause pause
del "%DL_DST%" del "%DL_DST%"
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & popd & exit /b !errorlevel! )
@REM Gitコマンドのパスを設定 @REM Gitコマンドのパスを設定
echo -------------------------------------------------- echo --------------------------------------------------
@@ -64,7 +66,7 @@ if %errorlevel% neq 0 (
echo Executing: set "PATH=%~dp0lib\PortableGit\bin;%PATH%" echo Executing: set "PATH=%~dp0lib\PortableGit\bin;%PATH%"
pause pause
set "PATH=%~dp0lib\PortableGit\bin;%PATH%" set "PATH=%~dp0lib\PortableGit\bin;%PATH%"
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & popd & exit /b !errorlevel! )
echo -------------------------------------------------- echo --------------------------------------------------
echo Checking Git Installation... echo Checking Git Installation...
@@ -72,7 +74,7 @@ if %errorlevel% neq 0 (
echo Executing: git --version echo Executing: git --version
pause pause
git --version git --version
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & popd & exit /b !errorlevel! )
) )
echo -------------------------------------------------- echo --------------------------------------------------
@@ -81,7 +83,7 @@ echo --------------------------------------------------
echo Executing: git clone %REPO_URL% echo Executing: git clone %REPO_URL%
pause pause
git clone %REPO_URL% git clone %REPO_URL%
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & popd & exit /b !errorlevel! )
@REM Pythonのセットアップ、仮想環境が有効化されて戻って来る @REM Pythonのセットアップ、仮想環境が有効化されて戻って来る
echo -------------------------------------------------- echo --------------------------------------------------
@@ -90,7 +92,7 @@ echo --------------------------------------------------
echo Executing: call Setup-Python.bat ".\lib\python" ".\Style-Bert-VITS2\venv" echo Executing: call Setup-Python.bat ".\lib\python" ".\Style-Bert-VITS2\venv"
pause pause
call Setup-Python.bat ".\lib\python" ".\Style-Bert-VITS2\venv" call Setup-Python.bat ".\lib\python" ".\Style-Bert-VITS2\venv"
if %errorlevel% neq 0 ( popd & exit /b %errorlevel% ) if !errorlevel! neq 0 ( popd & exit /b !errorlevel! )
@REM Style-Bert-VITS2フォルダに移動 @REM Style-Bert-VITS2フォルダに移動
pushd Style-Bert-VITS2 pushd Style-Bert-VITS2
@@ -101,7 +103,7 @@ echo --------------------------------------------------
echo Executing: pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 echo Executing: pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pause pause
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & popd & exit /b !errorlevel! )
echo -------------------------------------------------- echo --------------------------------------------------
echo Installing other dependencies... echo Installing other dependencies...
@@ -109,7 +111,7 @@ echo --------------------------------------------------
echo Executing: pip install -r requirements.txt echo Executing: pip install -r requirements.txt
pause pause
pip install -r requirements.txt pip install -r requirements.txt
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & popd & exit /b !errorlevel! )
echo ---------------------------------------- echo ----------------------------------------
echo Environment setup is complete. Start downloading the model. echo Environment setup is complete. Start downloading the model.

View File

@@ -2,6 +2,9 @@ chcp 65001 > NUL
@REM https://github.com/Zuntan03/EasyBertVits2 より引用・改変 @REM https://github.com/Zuntan03/EasyBertVits2 より引用・改変
@REM エラーコードを遅延評価するために設定
setlocal enabledelayedexpansion
@echo off @echo off
set PS_CMD=PowerShell -Version 5.1 -ExecutionPolicy Bypass set PS_CMD=PowerShell -Version 5.1 -ExecutionPolicy Bypass
set CURL_CMD=C:\Windows\System32\curl.exe set CURL_CMD=C:\Windows\System32\curl.exe
@@ -41,7 +44,7 @@ if not exist "%PYTHON_DIR%"\ (
echo Executing: %CURL_CMD% -o python.zip https://www.python.org/ftp/python/3.10.11/python-3.10.11-embed-amd64.zip echo Executing: %CURL_CMD% -o python.zip https://www.python.org/ftp/python/3.10.11/python-3.10.11-embed-amd64.zip
pause pause
%CURL_CMD% -o python.zip https://www.python.org/ftp/python/3.10.11/python-3.10.11-embed-amd64.zip %CURL_CMD% -o python.zip https://www.python.org/ftp/python/3.10.11/python-3.10.11-embed-amd64.zip
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & exit /b !errorlevel! )
echo -------------------------------------------------- echo --------------------------------------------------
echo Extracting zip... echo Extracting zip...
@@ -49,7 +52,7 @@ if not exist "%PYTHON_DIR%"\ (
echo Executing: %PS_CMD% Expand-Archive -Path python.zip -DestinationPath \"%PYTHON_DIR%\" echo Executing: %PS_CMD% Expand-Archive -Path python.zip -DestinationPath \"%PYTHON_DIR%\"
pause pause
%PS_CMD% Expand-Archive -Path python.zip -DestinationPath \"%PYTHON_DIR%\" %PS_CMD% Expand-Archive -Path python.zip -DestinationPath \"%PYTHON_DIR%\"
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & exit /b !errorlevel! )
echo -------------------------------------------------- echo --------------------------------------------------
echo Removing python.zip... echo Removing python.zip...
@@ -57,7 +60,7 @@ if not exist "%PYTHON_DIR%"\ (
echo Executing: del python.zip echo Executing: del python.zip
pause pause
del python.zip del python.zip
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & exit /b !errorlevel! )
echo -------------------------------------------------- echo --------------------------------------------------
echo Enabling 'site' module in the embedded Python environment... echo Enabling 'site' module in the embedded Python environment...
@@ -65,7 +68,7 @@ if not exist "%PYTHON_DIR%"\ (
echo Executing: %PS_CMD% "&{(Get-Content '%PYTHON_DIR%/python310._pth') -creplace '#import site', 'import site' | Set-Content '%PYTHON_DIR%/python310._pth' }" echo Executing: %PS_CMD% "&{(Get-Content '%PYTHON_DIR%/python310._pth') -creplace '#import site', 'import site' | Set-Content '%PYTHON_DIR%/python310._pth' }"
pause pause
%PS_CMD% "&{(Get-Content '%PYTHON_DIR%/python310._pth') -creplace '#import site', 'import site' | Set-Content '%PYTHON_DIR%/python310._pth' }" %PS_CMD% "&{(Get-Content '%PYTHON_DIR%/python310._pth') -creplace '#import site', 'import site' | Set-Content '%PYTHON_DIR%/python310._pth' }"
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & exit /b !errorlevel! )
echo -------------------------------------------------- echo --------------------------------------------------
echo Installing pip and virtualenv... echo Installing pip and virtualenv...
@@ -73,7 +76,7 @@ if not exist "%PYTHON_DIR%"\ (
echo Executing: %CURL_CMD% -o "%PYTHON_DIR%\get-pip.py" https://bootstrap.pypa.io/get-pip.py echo Executing: %CURL_CMD% -o "%PYTHON_DIR%\get-pip.py" https://bootstrap.pypa.io/get-pip.py
pause pause
%CURL_CMD% -o "%PYTHON_DIR%\get-pip.py" https://bootstrap.pypa.io/get-pip.py %CURL_CMD% -o "%PYTHON_DIR%\get-pip.py" https://bootstrap.pypa.io/get-pip.py
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & exit /b !errorlevel! )
echo -------------------------------------------------- echo --------------------------------------------------
echo Installing pip... echo Installing pip...
@@ -81,7 +84,7 @@ if not exist "%PYTHON_DIR%"\ (
echo Executing: "%PYTHON_CMD%" "%PYTHON_DIR%\get-pip.py" --no-warn-script-location echo Executing: "%PYTHON_CMD%" "%PYTHON_DIR%\get-pip.py" --no-warn-script-location
pause pause
"%PYTHON_CMD%" "%PYTHON_DIR%\get-pip.py" --no-warn-script-location "%PYTHON_CMD%" "%PYTHON_DIR%\get-pip.py" --no-warn-script-location
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & exit /b !errorlevel! )
echo -------------------------------------------------- echo --------------------------------------------------
echo Installing virtualenv... echo Installing virtualenv...
@@ -89,7 +92,7 @@ if not exist "%PYTHON_DIR%"\ (
echo Executing: "%PYTHON_CMD%" -m pip install virtualenv --no-warn-script-location echo Executing: "%PYTHON_CMD%" -m pip install virtualenv --no-warn-script-location
pause pause
"%PYTHON_CMD%" -m pip install virtualenv --no-warn-script-location "%PYTHON_CMD%" -m pip install virtualenv --no-warn-script-location
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & exit /b !errorlevel! )
) )
if not exist %VENV_DIR%\ ( if not exist %VENV_DIR%\ (
@@ -99,7 +102,7 @@ if not exist %VENV_DIR%\ (
echo Executing: "%PYTHON_CMD%" -m virtualenv --copies "%VENV_DIR%" echo Executing: "%PYTHON_CMD%" -m virtualenv --copies "%VENV_DIR%"
pause pause
"%PYTHON_CMD%" -m virtualenv --copies "%VENV_DIR%" "%PYTHON_CMD%" -m virtualenv --copies "%VENV_DIR%"
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & exit /b !errorlevel! )
) )
echo -------------------------------------------------- echo --------------------------------------------------
@@ -108,7 +111,7 @@ echo --------------------------------------------------
echo Executing: call "%VENV_DIR%\Scripts\activate.bat" echo Executing: call "%VENV_DIR%\Scripts\activate.bat"
pause pause
call "%VENV_DIR%\Scripts\activate.bat" call "%VENV_DIR%\Scripts\activate.bat"
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & exit /b !errorlevel! )
echo -------------------------------------------------- echo --------------------------------------------------
echo Upgrading pip... echo Upgrading pip...
@@ -116,7 +119,7 @@ echo --------------------------------------------------
echo Executing: python -m pip install --upgrade pip echo Executing: python -m pip install --upgrade pip
pause pause
python -m pip install --upgrade pip python -m pip install --upgrade pip
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & exit /b !errorlevel! )
echo -------------------------------------------------- echo --------------------------------------------------
echo Completed. echo Completed.

View File

@@ -1,9 +1,11 @@
chcp 65001 > NUL chcp 65001 > NUL
@echo off @echo off
@REM エラーコードを遅延評価するために設定
setlocal enabledelayedexpansion
pushd %~dp0 pushd %~dp0
set PATH=%~dp0lib\MinGit\cmd;%PATH%
pushd Style-Bert-VITS2 pushd Style-Bert-VITS2
@@ -11,7 +13,24 @@ echo --------------------------------------------------
echo Checking Git Installation... echo Checking Git Installation...
echo -------------------------------------------------- echo --------------------------------------------------
git --version git --version
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if !errorlevel! neq 0 (
echo --------------------------------------------------
echo Global Git is not installed, so use PortableGit.
echo Setting up PATH...
echo --------------------------------------------------
echo Executing: set "PATH=%~dp0lib\PortableGit\bin;%PATH%"
pause
set "PATH=%~dp0lib\PortableGit\bin;%PATH%"
if !errorlevel! neq 0 ( pause & popd & exit /b !errorlevel! )
echo --------------------------------------------------
echo Checking Git Installation...
echo --------------------------------------------------
echo Executing: git --version
pause
git --version
if !errorlevel! neq 0 ( pause & popd & exit /b !errorlevel! )
)
pause pause
@@ -19,7 +38,7 @@ echo --------------------------------------------------
echo Git pull... echo Git pull...
echo -------------------------------------------------- echo --------------------------------------------------
git pull git pull
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & popd & exit /b !errorlevel! )
@REM 仮想環境のpip requirements.txtを更新 @REM 仮想環境のpip requirements.txtを更新
@@ -29,10 +48,10 @@ echo --------------------------------------------------
@REM 仮想環境を有効化 @REM 仮想環境を有効化
call .\venv\Scripts\activate.bat call .\venv\Scripts\activate.bat
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & popd & exit /b !errorlevel! )
pip install -U -r requirements.txt pip install -U -r requirements.txt
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if !errorlevel! neq 0 ( pause & popd & exit /b !errorlevel! )
echo ---------------------------------------- echo ----------------------------------------
echo Update completed. echo Update completed.