mirror of
https://github.com/smittix/intercept.git
synced 2026-07-11 02:58:12 -07:00
fix: silence pip log noise during install
Adds two thin wrappers around pip: - _pip_run: used for pip upgrade and core installs. Filters the send2trash malformed-extras WARNING that fires on every pip invocation on systems where that package has broken metadata, while keeping all real output (download progress, install summaries, errors). - _pip_optional: used for the optional-packages loop. Runs pip with -q so "Requirement already satisfied" walls are suppressed on re-runs, and only shows output (filtered) when a package actually fails.
This commit is contained in:
@@ -552,7 +552,28 @@ install_python_deps() {
|
|||||||
PIP_OPTS="$PIP_OPTS --prefer-binary"
|
PIP_OPTS="$PIP_OPTS --prefer-binary"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! $PIP install $PIP_OPTS --upgrade pip setuptools wheel; then
|
# pip wrapper that filters the send2trash malformed-metadata WARNING.
|
||||||
|
# send2trash ships broken extras metadata on some systems, causing pip to
|
||||||
|
# print a WARNING on every single invocation. We suppress those three lines
|
||||||
|
# while preserving all other output and pip's real exit code.
|
||||||
|
_pip_run() {
|
||||||
|
$PIP "$@" 2>&1 | \
|
||||||
|
grep -Ev "^WARNING: Error parsing dependencies of send2trash|sys-platform.*darwin.*objc| +~\^"
|
||||||
|
return "${PIPESTATUS[0]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Silent variant for optional packages: shows nothing on success (suppresses
|
||||||
|
# "Requirement already satisfied" walls), shows filtered output on failure.
|
||||||
|
_pip_optional() {
|
||||||
|
local out rc
|
||||||
|
out=$($PIP install $PIP_OPTS -q "$@" 2>&1) && return 0
|
||||||
|
rc=$?
|
||||||
|
printf '%s\n' "$out" | \
|
||||||
|
grep -Ev "Error parsing dependencies of send2trash|sys-platform.*darwin.*objc| +~\^"
|
||||||
|
return "$rc"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ! _pip_run install $PIP_OPTS --upgrade pip setuptools wheel; then
|
||||||
warn "pip/setuptools/wheel upgrade failed - continuing with existing versions"
|
warn "pip/setuptools/wheel upgrade failed - continuing with existing versions"
|
||||||
else
|
else
|
||||||
ok "Upgraded pip tooling"
|
ok "Upgraded pip tooling"
|
||||||
@@ -565,7 +586,7 @@ install_python_deps() {
|
|||||||
# exist in ~/.local (user site-packages). Without this, pip sees them as
|
# exist in ~/.local (user site-packages). Without this, pip sees them as
|
||||||
# satisfied and skips the venv install, causing the health check to fail
|
# satisfied and skips the venv install, causing the health check to fail
|
||||||
# because it runs with 'python -s' which excludes ~/.local.
|
# because it runs with 'python -s' which excludes ~/.local.
|
||||||
$PIP install $PIP_OPTS --ignore-installed "flask>=3.0.0" "flask-wtf>=1.2.0" "flask-compress>=1.15" \
|
_pip_run install $PIP_OPTS --ignore-installed "flask>=3.0.0" "flask-wtf>=1.2.0" "flask-compress>=1.15" \
|
||||||
"flask-limiter>=2.5.4" "requests>=2.28.0" \
|
"flask-limiter>=2.5.4" "requests>=2.28.0" \
|
||||||
"Werkzeug>=3.1.5" "pyserial>=3.5" || true
|
"Werkzeug>=3.1.5" "pyserial>=3.5" || true
|
||||||
|
|
||||||
@@ -597,7 +618,7 @@ install_python_deps() {
|
|||||||
extra_opts=""
|
extra_opts=""
|
||||||
case " $binary_only_pkgs " in *" $pkg_name "*) extra_opts="--only-binary :all:" ;; esac
|
case " $binary_only_pkgs " in *" $pkg_name "*) extra_opts="--only-binary :all:" ;; esac
|
||||||
info " Installing ${pkg_name}..."
|
info " Installing ${pkg_name}..."
|
||||||
if ! $PIP install $PIP_OPTS $extra_opts "$pkg"; then
|
if ! _pip_optional $extra_opts "$pkg"; then
|
||||||
warn "${pkg_name} failed to install (optional - related features may be unavailable)"
|
warn "${pkg_name} failed to install (optional - related features may be unavailable)"
|
||||||
fi
|
fi
|
||||||
done < requirements.txt
|
done < requirements.txt
|
||||||
|
|||||||
Reference in New Issue
Block a user