From: Stefano Lattarini Date: Mon, 19 Nov 2012 19:16:47 +0000 (+0100) Subject: python: uninstall cater to PEP-3147 X-Git-Tag: v1.12.6~27^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3fea76478eb1364093804365904fdb3c1e5c93d2;p=platform%2Fupstream%2Fautomake.git python: uninstall cater to PEP-3147 After recent commit commit v1.12.4-43-ge0e99ed, "python: improve support for modern python (CPython 3.2 and PyPy)", the python install rules have been made smart enough to install "*.pyc" byte-compiled files according to PEP-3147 with modern (post-3.2) pythons. However, the uninstall rules hadn't been updated accordingly, causing leftover files to remain around after "make uninstall", as well as failures in "make distcheck". * lib/am/python.am (am__pep3147_tweak): New internal macro, used in ... (uninstall-%DIR%PYTHON): ... the recipe of this target, which has been adjusted to cater to PEP-3147 Signed-off-by: Stefano Lattarini --- diff --git a/lib/am/python.am b/lib/am/python.am index cab6129..2f12af4 100644 --- a/lib/am/python.am +++ b/lib/am/python.am @@ -94,19 +94,37 @@ endif %?INSTALL% ## -------------- ## if %?INSTALL% + +?FIRST?am__pep3147_tweak = \ +?FIRST? sed -e 's|\.py$$||' -e 's|[^/]*$$|__pycache__/&.*.py|' + .PHONY uninstall-am: uninstall-%DIR%PYTHON uninstall-%DIR%PYTHON: @$(NORMAL_UNINSTALL) @list='$(%DIR%_PYTHON)'; test -n "$(%NDIR%dir)" || list=; \ -?BASE? files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ -?!BASE? $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \ - test -n "$$files" || exit 0; \ +?BASE? py_files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ +?!BASE? $(am__nobase_strip_setup); py_files=`$(am__nobase_strip)`; \ + test -n "$$py_files" || exit 0; \ dir='$(DESTDIR)$(%NDIR%dir)'; \ ## Also remove the .pyc and .pyo byte compiled versions. - filesc=`echo "$$files" | sed 's|$$|c|'`; \ - fileso=`echo "$$files" | sed 's|$$|o|'`; \ +## This is somewhat tricky, because for newer pythons we have to take +## PEP-3147 into account. + pyc_files=`echo "$$py_files" | sed 's|$$|c|'`; \ + pyo_files=`echo "$$py_files" | sed 's|$$|o|'`; \ + py_files_pep3147=`echo "$$py_files" | $(am__pep3147_tweak)`; \ + echo "$$py_files_pep3147";\ + pyc_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|c|'`; \ + pyo_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|o|'`; \ st=0; \ - for files in "$$files" "$$filesc" "$$fileso"; do \ + for files in \ + "$$py_files" \ + "$$pyc_files" \ + "$$pyo_files" \ +## Installation of '.py' files is not influenced by PEP-3147, so it +## is correct *not* to have $pyfiles_pep3147 here. + "$$pyc_files_pep3147" \ + "$$pyo_files_pep3147" \ + ; do \ $(am__uninstall_files_from_dir) || st=$$?; \ done; \ exit $$st