From f0dc93dcb4bc69442733056e88de9aff0f890664 Mon Sep 17 00:00:00 2001
From: Ian Wienand <iwienand@redhat.com>
Date: Fri, 20 Apr 2018 10:42:07 +1000
Subject: [PATCH] Workaround pip10 uninstall of packages

As noted in comments, this is a hack to get pip10 to overwrite some
package installed libraries.

Change-Id: Iea24a3ea915e13f7e0882144028ec5ff5bfdfae1
---
 tools/fixup_stuff.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tools/fixup_stuff.sh b/tools/fixup_stuff.sh
index a939e30b02..1ff7bfa516 100755
--- a/tools/fixup_stuff.sh
+++ b/tools/fixup_stuff.sh
@@ -202,7 +202,19 @@ function fixup_fedora {
             # install requests with the bundled urllib3 to avoid conflicts
             pip_install --upgrade --force-reinstall requests
         fi
+
     fi
+
+    # Since pip10, pip will refuse to uninstall files from packages
+    # that were created with distutils (rather than more modern
+    # setuptools).  This is because it technically doesn't have a
+    # manifest of what to remove.  However, in most cases, simply
+    # overwriting works.  So this hacks around those packages that
+    # have been dragged in by some other system dependency
+    sudo rm -rf /usr/lib/python2.7/site-packages/enum34*.egg-info
+    sudo rm -rf /usr/lib/python2.7/site-packages/ipaddress*.egg-info
+    sudo rm -rf /usr/lib/python2.7/site-packages/ply-*.egg-info
+    sudo rm -rf /usr/lib/python2.7/site-packages/typing-*.egg-info
 }
 
 function fixup_suse {