This commit is contained in:
XiangXtreme
2026-04-30 13:09:26 +08:00
parent b8bfac4641
commit 884d882eb7
6 changed files with 441 additions and 69 deletions
+9 -36
View File
@@ -1,51 +1,24 @@
#!/bin/bash
cd "$(dirname "$0")"
# Skip dependency check if already installed before
if [ -f ".deps_installed" ]; then
python3 gui.py &
exit 0
fi
# Check if requirements.txt exists
if [ ! -f "requirements.txt" ]; then
if ! command -v uv >/dev/null 2>&1; then
echo
echo " [WARNING] requirements.txt not found!"
echo " [ERROR] uv not found. Install uv first:"
echo " pip install uv"
echo
read -p " Skip dependency install and launch directly? [Y/N]: " choice
echo
if [[ "$choice" =~ ^[Yy]$ ]]; then
python3 gui.py &
exit 0
fi
echo " Cancelled."
exit 1
fi
# requirements.txt found, ask to install
echo
echo " [OK] requirements.txt found."
echo " Syncing project environment with uv..."
echo
read -p " Install dependencies? [Y/N]: " install
echo
if [[ "$install" =~ ^[Yy]$ ]]; then
echo " Installing dependencies, please wait..."
uv sync -i https://pypi.tuna.tsinghua.edu.cn/simple
if [ $? -ne 0 ]; then
echo
pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
if [ $? -ne 0 ]; then
echo
echo " [ERROR] Installation failed! Check your network or pip config."
exit 1
fi
echo " [ERROR] uv sync failed! Check your network or uv config."
echo
echo " [OK] Done! Will skip this step on next launch."
touch .deps_installed
echo
else
touch .deps_installed
exit 1
fi
# Launch
python3 gui.py &
.venv/bin/python gui.py &
exit 0