From 70c813b533a2663db86bf6f2fb2c73ccbadcf7eb Mon Sep 17 00:00:00 2001 From: Paul Dufour Date: Mon, 11 May 2026 22:42:58 -0700 Subject: [PATCH 1/2] Update get_pip_version function to check for pip3 --- cooldowns.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cooldowns.sh b/cooldowns.sh index 55df934..40988c2 100755 --- a/cooldowns.sh +++ b/cooldowns.sh @@ -68,15 +68,20 @@ esac # --------------------------------------------------------------------------- # Get pip version (e.g., "26.1.0" -> "26.1.0") -# Returns empty string if pip is not installed +# Returns empty string if neither pip nor pip3 is on PATH (e.g. Homebrew only ships pip3) get_pip_version() { - if ! command -v pip &>/dev/null; then + local pip_cmd="" + if command -v pip &>/dev/null; then + pip_cmd=pip + elif command -v pip3 &>/dev/null; then + pip_cmd=pip3 + else echo "" return 1 fi local version - version=$(command pip --version 2>/dev/null | awk '{print $2; exit}') + version=$(command "$pip_cmd" --version 2>/dev/null | awk '{print $2; exit}') echo "$version" } From e3437ebacf3ec46a67f70a33be0f5e978768e504 Mon Sep 17 00:00:00 2001 From: Paul Dufour Date: Mon, 11 May 2026 22:48:26 -0700 Subject: [PATCH 2/2] Add wrapper for older pip too --- cooldowns.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cooldowns.sh b/cooldowns.sh index 40988c2..6cdff5e 100755 --- a/cooldowns.sh +++ b/cooldowns.sh @@ -261,26 +261,28 @@ SHELL echo "pip: set PIP_UPLOADED_PRIOR_TO=\"P${days}D\" in $PROFILE_SCRIPT" else # Use shell wrapper for older pip or when pip is not installed - local date_cmd + local date_cmd pip_for_command date_cmd=$(_date_days_ago "$days") + pip_for_command=pip + command -v pip &>/dev/null || pip_for_command=pip3 cat >> "$PROFILE_SCRIPT" << SHELL # cooldowns:pip:start pip() { local pip_major cutoff - pip_major=\$(command pip --version 2>/dev/null | awk '{ split(\$2, a, "."); print a[1]; exit }') + pip_major=\$(command ${pip_for_command} --version 2>/dev/null | awk '{ split(\$2, a, "."); print a[1]; exit }') case "\$1" in install|download|wheel) if [[ "\${pip_major:-0}" -ge 26 ]]; then cutoff=\$($date_cmd) - command pip "\$1" --uploaded-prior-to "\$cutoff" "\${@:2}" + command ${pip_for_command} "\$1" --uploaded-prior-to "\$cutoff" "\${@:2}" else echo "warning: pip \${pip_major:-unknown} does not support --uploaded-prior-to (need >= 26), skipping cooldown" >&2 - command pip "\$@" + command ${pip_for_command} "\$@" fi ;; *) - command pip "\$@" + command ${pip_for_command} "\$@" ;; esac }