mirror of
https://github.com/masterking32/MasterHttpRelayVPN.git
synced 2026-05-17 21:24:37 +03:00
Optimize dependency installation in start scripts to skip if already satisfied
This commit is contained in:
@@ -39,18 +39,30 @@ if not exist "%VENV_DIR%\Scripts\python.exe" (
|
|||||||
|
|
||||||
set "VPY=%VENV_DIR%\Scripts\python.exe"
|
set "VPY=%VENV_DIR%\Scripts\python.exe"
|
||||||
|
|
||||||
echo [*] Installing dependencies ...
|
REM -------- Skip dependency install when all required packages are already importable.
|
||||||
"%VPY%" -m pip install --disable-pip-version-check -q --upgrade pip >nul
|
REM Pip install (even with -q) takes ~3-8s every launch; this drops it to ~0.1s
|
||||||
"%VPY%" -m pip install --disable-pip-version-check -q -r requirements.txt
|
REM on warm runs. Falls through to the install path on first run, after a
|
||||||
if errorlevel 1 (
|
REM requirements.txt change, or when any import fails for any reason.
|
||||||
echo [!] PyPI install failed. Retrying via runflare mirror ...
|
set "DEPS_OK=0"
|
||||||
"%VPY%" -m pip install --disable-pip-version-check -q -r requirements.txt ^
|
"%VPY%" -c "import cryptography, h2, brotli, zstandard" >nul 2>&1
|
||||||
-i https://mirror-pypi.runflare.com/simple/ ^
|
if !errorlevel!==0 set "DEPS_OK=1"
|
||||||
--trusted-host mirror-pypi.runflare.com
|
|
||||||
|
if "!DEPS_OK!"=="1" (
|
||||||
|
echo [*] Dependencies already installed — skipping pip install.
|
||||||
|
) else (
|
||||||
|
echo [*] Installing dependencies ...
|
||||||
|
"%VPY%" -m pip install --disable-pip-version-check -q --upgrade pip >nul
|
||||||
|
"%VPY%" -m pip install --disable-pip-version-check -q -r requirements.txt
|
||||||
if errorlevel 1 (
|
if errorlevel 1 (
|
||||||
echo [X] Could not install dependencies.
|
echo [!] PyPI install failed. Retrying via runflare mirror ...
|
||||||
pause
|
"%VPY%" -m pip install --disable-pip-version-check -q -r requirements.txt ^
|
||||||
exit /b 1
|
-i https://mirror-pypi.runflare.com/simple/ ^
|
||||||
|
--trusted-host mirror-pypi.runflare.com
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo [X] Could not install dependencies.
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -34,13 +34,21 @@ fi
|
|||||||
|
|
||||||
VPY="$VENV_DIR/bin/python"
|
VPY="$VENV_DIR/bin/python"
|
||||||
|
|
||||||
echo "[*] Installing dependencies ..."
|
# Skip dependency install when all required packages are already importable.
|
||||||
"$VPY" -m pip install --disable-pip-version-check -q --upgrade pip >/dev/null
|
# Pip install (even with -q) takes ~3-8s every launch; this drops it to <0.1s
|
||||||
if ! "$VPY" -m pip install --disable-pip-version-check -q -r requirements.txt; then
|
# on warm runs. Falls through to the install path on first run or if any
|
||||||
echo "[!] PyPI install failed. Retrying via runflare mirror ..."
|
# import fails for any reason.
|
||||||
"$VPY" -m pip install --disable-pip-version-check -q -r requirements.txt \
|
if "$VPY" -c "import cryptography, h2, brotli, zstandard" >/dev/null 2>&1; then
|
||||||
-i https://mirror-pypi.runflare.com/simple/ \
|
echo "[*] Dependencies already installed — skipping pip install."
|
||||||
--trusted-host mirror-pypi.runflare.com
|
else
|
||||||
|
echo "[*] Installing dependencies ..."
|
||||||
|
"$VPY" -m pip install --disable-pip-version-check -q --upgrade pip >/dev/null
|
||||||
|
if ! "$VPY" -m pip install --disable-pip-version-check -q -r requirements.txt; then
|
||||||
|
echo "[!] PyPI install failed. Retrying via runflare mirror ..."
|
||||||
|
"$VPY" -m pip install --disable-pip-version-check -q -r requirements.txt \
|
||||||
|
-i https://mirror-pypi.runflare.com/simple/ \
|
||||||
|
--trusted-host mirror-pypi.runflare.com
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "config.json" ]; then
|
if [ ! -f "config.json" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user