[gtk-osx] Only pip-uninstall packages that we installed.



commit c502fc0542c59e5faa594d1308bda4c6aea629f8
Author: John Ralls <jralls ceridwen us>
Date:   Tue Jul 30 14:33:48 2019 -0700

    Only pip-uninstall packages that we installed.
    
    If a package (in particular typing and enum34) is found in the system
    python directories pip will notice and not install it. If we later
    tell pip to uninstall it it will try and of course fail to remove it
    from the system directory. Check first that the package is installed in
    our directory before trying to uninstall it.

 gtk-osx-setup.sh | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/gtk-osx-setup.sh b/gtk-osx-setup.sh
index f6775c7..31fdd2c 100755
--- a/gtk-osx-setup.sh
+++ b/gtk-osx-setup.sh
@@ -37,6 +37,17 @@ envvar ()
         mkdir -p "$_var"
     fi
 }
+
+pip_remove()
+{
+    local _package=$1
+    local _local_package=`$PIP show $_package | grep Location | grep $PYTHONUSERBASE`
+    if test -n "$_local_package"; then
+        echo $_local_package
+        $PIP uninstall -y $_package
+    fi
+}
+
 # Environment variable defaults:
 #
 envvar DEVROOT "$HOME"
@@ -99,8 +110,7 @@ fi
 
 # Install pipenv
 $PIP install --upgrade --user pipenv==2018.10.09
-$PIP uninstall -y typing
-
+pip_remove typing
 PIPENV="$PYTHONUSERBASE/bin/pipenv"
 
 # Install jhbuild
@@ -199,7 +209,7 @@ if test "x`echo $PATH | grep "$DEVPREFIX/bin"`" == x ; then
 fi
 # pipenv wants enum34 because it's installed with Py2 but that conflicts
 # with Py3 so remove it.
-$PIP uninstall --yes enum34
+pip_remove enum34
 
 SDKROOT=`xcrun --show-sdk-path`
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]