diff options
Diffstat (limited to 'lib/am/python.am')
-rw-r--r-- | lib/am/python.am | 73 |
1 files changed, 16 insertions, 57 deletions
diff --git a/lib/am/python.am b/lib/am/python.am index 5c48ac7ef..736f82048 100644 --- a/lib/am/python.am +++ b/lib/am/python.am @@ -14,10 +14,6 @@ ## You should have received a copy of the GNU General Public License ## along with this program. If not, see <http://www.gnu.org/licenses/>. -if %?INSTALL% -include inst-vars.am -endif %?INSTALL% - ?FIRST?am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile) ## ------------ ## @@ -30,24 +26,12 @@ am__installdirs += "$(DESTDIR)$(%NDIR%dir)" ?!EXEC?.PHONY install-data-am: install-%DIR%PYTHON install-%DIR%PYTHON: $(%DIR%_PYTHON) @$(NORMAL_INSTALL) + @$(if $(and $(%NDIR%dir),$(%DIR%_PYTHON)),$(strip \ + )$(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)") if %?BASE% - @list='$(%DIR%_PYTHON)'; dlist=; list2=; test -n "$(%NDIR%dir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \ - fi; \ - for p in $$list; do \ -## A file can be in the source directory or the build directory. - if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \ - if test -f $$b$$p; then \ -## Compute basename of source file. Unless this is a nobase_ target, we -## want to install 'python/foo.py' as '$(DESTDIR)$(%NDIR%dir)/foo.py', -## not '$(DESTDIR)$(%NDIR%dir)/python/foo.py'. - $(am__strip_dir) \ - dlist="$$dlist $$f"; \ - list2="$$list2 $$b$$p"; \ - else :; fi; \ - done; \ + @test -n "$(%NDIR%dir)" && test -n "$(%DIR%_PYTHON)" || exit 0; \ + dlist='$(notdir $(%DIR%_PYTHON))'; \ + list2='$(foreach i,$(%DIR%_PYTHON),$(call am.vpath.rewrite,$i))'; \ for file in $$list2; do echo $$file; done | $(am__base_list) | \ while read files; do \ ## Don't perform translation, since script name is important. @@ -62,10 +46,6 @@ if %?BASE% else :; fi else !%?BASE% @list='$(%DIR%_PYTHON)'; test -n "$(%NDIR%dir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \ - fi; \ $(am__nobase_list) | { while read dir files; do \ xfiles=; for p in $$files; do \ ## A file can be in the source directory or the build directory. @@ -95,40 +75,19 @@ 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? 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. -## 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 \ - "$$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 + $(call am.uninst.cmd,$(%NDIR%dir), \ + $(strip $(foreach i, $(patsubst %.py,%, \ +?BASE? $(notdir $(%DIR%_PYTHON))), \ +?!BASE? $(patsubst $(srcdir)/%,%,$(%DIR%_PYTHON))), \ + $i.py \ +## Also remove the '.pyc' and '.pyo' byte-compiled versions, catering +## to PEP-3147. Note that installation of '.py' files is *not* +## influenced by that PEP. + $(foreach e, pyc pyo, \ + $i.$e $(dir $i)__pycache__/$(notdir $i).*.$e)))) endif %?INSTALL% @@ -144,5 +103,5 @@ endif %?INSTALL% ## -------------- ## if %?DIST% -DIST_COMMON += %DISTVAR% +am.dist.common-files += %DISTVAR% endif %?DIST% |