[PATCH 1/2] python: Properly uninstall __pycache__ in subdirectories

Lukas Fleischer <[email protected]>
Newsgroups gmane.comp.sysutils.automake.patches
Message-ID <[email protected]>
When uninstalling __pycache__ files in a subdirectory "sub", the
Makefile incorrectly removed the files from __pycache__/sub/ instead of
sub/__pycache__/.

* lib/am/python.am (uninstall-%DIR%PYTHON): Use the correct path when
installing byte-compiled files installed in '__pycache__'
subdirectories.
---
 lib/am/python.am | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/am/python.am b/lib/am/python.am
index 21e6f842c..f315d9722 100644
--- a/lib/am/python.am
+++ b/lib/am/python.am
@@ -97,7 +97,7 @@ endif %?INSTALL%
 if %?INSTALL%
 
 ?FIRST?am__pep3147_tweak = \
-?FIRST?  sed -e 's|\.py$$||' -e 's|[^/]*$$|&.*.pyc\n&.*.pyo|'
+?FIRST?  sed -e 's|\.py$$||' -e 's|[^/]*$$|__pycache__/&.*.pyc\n__pycache__/&.*.pyo|'
 
 .PHONY uninstall-am: uninstall-%DIR%PYTHON
 uninstall-%DIR%PYTHON:
@@ -116,7 +116,7 @@ uninstall-%DIR%PYTHON:
 	done; \
 ## This is somewhat tricky, because for newer pythons we have to take PEP-3147
 ## into account.  Avoid exceeding the command-line length limit.
-	dir='$(DESTDIR)$(%NDIR%dir)/__pycache__'; \
+	dir='$(DESTDIR)$(%NDIR%dir)'; \
 	echo "$$py_files" | $(am__pep3147_tweak) | $(am__base_list) | \
 	  while read files; do \
 	    $(am__uninstall_files_from_dir) || st=$$?; \
-- 
2.17.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.