From 71680229154c0f2f1910c1fab20cddeb8f01c633 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Simon=20D=C3=A9saulniers?= <rostydela@gmail.com>
Date: Mon, 29 Feb 2016 12:56:16 -0500
Subject: [PATCH] pip to uninstall python files

---
 configure.ac       | 24 +++++++++++++++---------
 python/Makefile.am |  9 +++++++--
 2 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/configure.ac b/configure.ac
index 869a4f30..ff604401 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,21 +16,27 @@ AM_PROG_AR
 dnl Check for Doxygen
 AC_ARG_ENABLE([doc], [AS_HELP_STRING([--disable-doc], [Disable documentation generation (doxygen)])])
 AS_IF([test "x$enable_doc" != "xno"], [
-  AC_CHECK_PROGS([DOXYGEN], [doxygen])
-  AS_IF([test -z "$DOXYGEN"],[AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])])
-])
+       AC_CHECK_PROGS([DOXYGEN], [doxygen])
+       AS_IF([test -z "$DOXYGEN"],[AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])])
+       ])
 AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
 
 dnl Check for Python
 AC_ARG_ENABLE([python], [AS_HELP_STRING([--disable-python], [Disble python binding])])
 AS_IF([test "x$enable_python" != "xno"], [
-  AM_PATH_PYTHON([3.3],, [:])
-  AS_IF([test -n "$PYTHON"],[
-    AC_CHECK_PROGS([CYTHON], [cython])
-    AS_IF([test -z "$CYTHON"],[AC_MSG_WARN([Cython not found - continuing without python support])])
-  ])
-])
+       AM_PATH_PYTHON([3.3],, [:])
+       AS_IF([test -n "$PYTHON"],[
+              AC_CHECK_PROGS([CYTHON], [cython])
+              AS_IF([test -z "$CYTHON"],[AC_MSG_WARN([Cython not found - continuing without python support])])
+              ])
+       ])
 AM_CONDITIONAL([USE_CYTHON], [test -n "$CYTHON"])
+dnl Check for pip support (uninstall)
+AS_IF([test -n "$PYTHON"],[
+       AC_CHECK_PROGS([PIP], [pip3])
+       AS_IF([test -z "$PIP"],[AC_MSG_WARN([pip not found - continuing without python uninstall support])])
+       AM_CONDITIONAL([HAVE_PIP], [test -n "$PIP"])
+       ])
 
 case "${host_os}" in
   "")
diff --git a/python/Makefile.am b/python/Makefile.am
index 3c6100be..0949da89 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -10,8 +10,13 @@ all-local: pybuild.stamp
 clean-local:
 	rm -rf $(builddir)/build $(builddir)/*.so
 
-install:
+install-exec-local:
 	$(PYTHON) setup.py install
 	rm -rf $(builddir)/build
 
-endif
\ No newline at end of file
+if HAVE_PIP
+uninstall-local:
+	/usr/bin/yes | $(PIP) uninstall $(PACKAGE)
+endif
+
+endif
-- 
GitLab