Update detection of uv

pull/3051/head
bmaltais 2025-01-17 09:18:36 -05:00
parent 2e341c38fa
commit 89c92ffd04
2 changed files with 43 additions and 18 deletions

View File

@ -1,23 +1,47 @@
@echo off
#!/usr/bin/env bash
:: Install uv latest version
pip install --upgrade uv -q
# Checks to see if variable is set and non-empty.
# This is defined first, so we can use the function for some default variable values
env_var_exists() {
if [[ -n "${!1}" ]]; then
return 0
else
return 1
fi
}
set PATH=%PATH%;%~dp0venv\Lib\site-packages\torch\lib
# Define the directory path for WSL2
lib_path="/usr/lib/wsl/lib/"
echo Starting the GUI... this might take some time... Especially on 1st run after install or update...
# Check if the directory exists
if [ -d "$lib_path" ]; then
# Check if LD_LIBRARY_PATH is already set
if [ -z "${LD_LIBRARY_PATH}" ]; then
# LD_LIBRARY_PATH is not set, set it to the lib_path
export LD_LIBRARY_PATH="$lib_path"
# echo "LD_LIBRARY_PATH set to: $LD_LIBRARY_PATH"
fi
fi
# If it is run with the sudo command, get the complete LD_LIBRARY_PATH environment variable of the system and assign it to the current environment,
# because it will be used later.
if [ -n "$SUDO_USER" ] || [ -n "$SUDO_COMMAND" ]; then
echo "The sudo command resets the non-essential environment variables, we keep the LD_LIBRARY_PATH variable."
export LD_LIBRARY_PATH=$(sudo -i printenv LD_LIBRARY_PATH)
fi
# This gets the directory the script is run from so pathing can work relative to the script where needed.
SCRIPT_DIR=$(cd -- "$(dirname -- "$0")" && pwd)
# Step into GUI local directory
cd "$SCRIPT_DIR" || exit 1
# Check if uv is already installed
if [ ! -f "$HOME/.local/bin/uv" ]; then
# Setup uv
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.local/bin/env
fi
:: Make sure we are on the right sd-scripts commit
git submodule update --init --recursive
:: If the exit code is 0, run the kohya_gui.py script with the command-line arguments
if %errorlevel% equ 0 (
REM Check if the batch was started via double-click
IF /i "%comspec% /c %~0 " equ "%cmdcmdline:"=%" (
REM echo This script was started by double clicking.
cmd /k uv run --link-mode=copy kohya_gui.py --noverify %*
) ELSE (
REM echo This script was started from a command prompt.
uv run --link-mode=copy kohya_gui.py --noverify %*
)
)
uv run kohya_gui.py --noverify "$@"

1
kohya_ss Submodule

@ -0,0 +1 @@
Subproject commit e5e8be05fe0475a04e61ef668afffc632aa178f5