File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed
Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -32,10 +32,10 @@ test_wipeenv_pip_e () {
3232 mkvirtualenv " wipetest" > /dev/null 2>&1
3333 (cd tests/testpackage && pip install -e .) > /dev/null 2>&1
3434 before=" $( pip freeze) "
35- assertTrue " testpackage not installed" " pip freeze | grep testpackage"
35+ assertTrue " testpackage not installed: $before " " pip freeze | grep testpackage"
3636 wipeenv > /dev/null 2>&1
3737 after=" $( pip freeze) "
38- assertFalse " testpackage still installed" " pip freeze | grep testpackage"
38+ assertFalse " testpackage still installed: $after " " pip freeze | grep testpackage"
3939}
4040
4141# test_wipeenv_pip_e_url () {
Original file line number Diff line number Diff line change @@ -1294,9 +1294,28 @@ function wipeenv {
12941294 if [ -n " $( cat " $req_file " ) " ]
12951295 then
12961296 echo " Uninstalling packages:"
1297- cat " $req_file "
12981297 echo
1299- pip uninstall -y $( cat " $req_file " | grep -v ' ^-f' | sed ' s/>/=/g' | cut -f1 -d=)
1298+ while read line; do
1299+ typeset pkg=" "
1300+ if [[ " $line " =~ ^-f ]]; then
1301+ # ignore lines starting -f which pip sometimes
1302+ # includes and that do not point to specific
1303+ # dependencies
1304+ continue
1305+ fi
1306+ if [[ " $line " =~ ^-e ]]; then
1307+ # fix lines pointing to editable packages, which look like:
1308+ # -e git+ssh://git@github.com/python-virtualenvwrapper/virtualenvwrapper.git@1dc9e5f52102f0133b804c0c8a6b76c55db908bf#egg=testpackage&subdirectory=tests/testpackage
1309+ # and parse out the egg name to pass to pip
1310+ pkg=$( echo " $line " | cut -f2 -d' ' | sed -e ' s|&subdirectory.*||g' -e ' s|.*egg=||g' )
1311+ else
1312+ # Strip version specifiers off of the end of the line
1313+ # to keep only the package name.
1314+ pkg=$( echo " $line " | sed -e ' s/[<>!=].*//g' )
1315+ fi
1316+ echo $pkg
1317+ pip uninstall -y " $pkg "
1318+ done < " $req_file "
13001319 else
13011320 echo " Nothing to remove."
13021321 fi
You can’t perform that action at this time.
0 commit comments