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 () {
32
32
mkvirtualenv " wipetest" > /dev/null 2>&1
33
33
(cd tests/testpackage && pip install -e .) > /dev/null 2>&1
34
34
before=" $( pip freeze) "
35
- assertTrue " testpackage not installed" " pip freeze | grep testpackage"
35
+ assertTrue " testpackage not installed: $before " " pip freeze | grep testpackage"
36
36
wipeenv > /dev/null 2>&1
37
37
after=" $( pip freeze) "
38
- assertFalse " testpackage still installed" " pip freeze | grep testpackage"
38
+ assertFalse " testpackage still installed: $after " " pip freeze | grep testpackage"
39
39
}
40
40
41
41
# test_wipeenv_pip_e_url () {
Original file line number Diff line number Diff line change @@ -1294,9 +1294,28 @@ function wipeenv {
1294
1294
if [ -n " $( cat " $req_file " ) " ]
1295
1295
then
1296
1296
echo " Uninstalling packages:"
1297
- cat " $req_file "
1298
1297
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 "
1300
1319
else
1301
1320
echo " Nothing to remove."
1302
1321
fi
You can’t perform that action at this time.
0 commit comments