This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[python] [approval-request] Make uninstall-python safe


Hi,

not committed and IMO not so important as I am unaware if anyone uses
`uninstall':

datadir remains created although whole pythondir incl. its base gets deleted.

gdb/
	* Makefile.in (uninstall-python): Remove only the specific files.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 450c8a0..f32bb1d 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1949,9 +1949,17 @@ install-python:
 	  $(INSTALL_DATA) $(srcdir)/python/lib/$$file $(DESTDIR)$(pythondir)/$$file; \
 	done
 
-# Brute force.
+# Other packages may have their files installed in $(pythondir).
 uninstall-python:
-	rm -rf $(DESTDIR)/$(pythondir)
+	files='$(PY_FILES)'; for file in $$files; do \
+	  slashdir=`echo "/$$file" | sed 's,/[^/]*$$,,'`; \
+	  rm -f $(DESTDIR)$(pythondir)/$$file; \
+	  while test "x$$file" != "x$$slashdir"; do \
+	    rmdir 2>/dev/null "$(DESTDIR)$(pythondir)$$slashdir"; \
+	    file="$$slashdir"; \
+	    slashdir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \
+	  done \
+	done
 
 #
 # Dependency tracking.  Most of this is conditional on GNU Make being

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]