Skip to content

Commit

Permalink
Force using of python -m pip instead of pip if local pip is broken (#…
Browse files Browse the repository at this point in the history
…43)

* Swap virtualenv pip if it's not working

* reference correct python versions
  • Loading branch information
dbraley authored Jan 13, 2022
1 parent 515286c commit d778201
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bin/pip
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

python -m pip $@
3 changes: 3 additions & 0 deletions bin/pip2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

python2 -m pip $@
8 changes: 8 additions & 0 deletions shared-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ create_and_activate_virtualenv() {
# Activate the virtualenv.
. "$1/bin/activate"

# pip may get broken by virtualenv for some reason. We're better off
# calling `python -m pip` so we'll just swap in a script that does
# that for us.
if ! pip --version 2>/dev/null ; then
cp bin/pip `which pip`
cp bin/pip2 `which pip2`
fi

# pip20+ stopped supporting python2.7, so we need to make sure
# we are using an older pip.
if ! pip --version | grep -q "pip 1[0-9]"; then
Expand Down

0 comments on commit d778201

Please sign in to comment.