Edit

kc3-lang/automake/lib/am/python.am

Branch :

  • Show log

    Commit

  • Author : Stefano Lattarini
    Date : 2012-03-16 23:48:53
    Hash : 368f1c4c
    Message : install: don't create empty dirs when an empty 'foo_PRIMARY' is used Fixes automake bug#11030 and bug#10997. An empty declaration of "foo_PRIMARY" in a Makefile.am used to cause the generated install rules to create the directory $(foodir) anyway, even if nothing was to be installed there. While this could be seen as a convenient way to create a $(foodir) directory upon "make install" (respecting $(DESTDIR) settings and such), it also caused problems with conditionals; for example, an input of: if FALSE pgkdata_DATA = something endif caused the generated install rules to unconditionally create the $(pkgdatadir) directory (see automake bug#10997). Also, a user wanting to create an empty directory upon installation can easily do so with a custom install hook, as in: installdirs-local: $(MKDIR_P) $(DESTDIR)$(foodir) install-data-hook: installdirs-local On the other hand, the old behavior of "always create $(foodir), even if 'foo_PRIMARY' is empty" was harder and more tricky to override. Thus, from now on, an empty declaration of "foo_PRIMARY" will not cause the directory $(foodir) to be created upon "make install" anymore. * lib/am/data.am, lib/am/java.am, lib/am/libs.am, lib/am/lisp.am, lib/am/ltlib.am, lib/am/mans.am, lib/am/progs.am, lib/am/python.am, lib/am/scripts.am, lib/am/texinfos.am: Adjust install rules to avoid creating an installation directory if no files are actually to be installed there. * tests/instdir-empty.test: Remove, it was testing a semantic opposite to the one we now want and implement. * tests/instdir-no-empty.test: New test, check the new semantic. * tests/instdir-cond.test: Enhance. Move the still-failing part of the test ... * tests/instdir-cond2.test: ... here. * tests/list-of-tests.mk, tests/Makefile.am (XFAIL_TESTS): Update. * tests/java3.test: Adjust to avoid spurious failures. * HACKING, NEWS, THANKS: Update. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>

  • lib/am/python.am
  • ## automake - create Makefile.in from Makefile.am
    ## Copyright (C) 1999-2012 Free Software Foundation, Inc.
    
    ## This program is free software; you can redistribute it and/or modify
    ## it under the terms of the GNU General Public License as published by
    ## the Free Software Foundation; either version 2, or (at your option)
    ## any later version.
    
    ## This program is distributed in the hope that it will be useful,
    ## but WITHOUT ANY WARRANTY; without even the implied warranty of
    ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ## GNU General Public License for more details.
    
    ## 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)
    
    ## ------------ ##
    ## Installing.  ##
    ## ------------ ##
    
    if %?INSTALL%
    am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
    .PHONY install-%EXEC?exec:data%-am: install-%DIR%PYTHON
    install-%DIR%PYTHON: $(%DIR%_PYTHON)
    	@$(NORMAL_INSTALL)
    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; \
    	for file in $$list2; do echo $$file; done | $(am__base_list) | \
    	while read files; do \
    ## Don't perform translation, since script name is important.
    	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(%NDIR%dir)'"; \
    	  $(INSTALL_DATA) $$files "$(DESTDIR)$(%NDIR%dir)" || exit $$?; \
    	done || exit $$?; \
    ## Byte-compile must be done at install time, since file times are
    ## encoded in the actual files.
    	if test -n "$$dlist"; then \
    	  $(am__py_compile) --destdir "$(DESTDIR)" \
    	                    --basedir "$(%NDIR%dir)" $$dlist; \
    	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.
    	    if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \
    	    if test -f "$$b$$p"; then xfiles="$$xfiles $$b$$p"; dlist="$$dlist $$p"; \
    	    else :; fi; done; \
    	  test -z "$$xfiles" || { \
    	    test "x$$dir" = x. || { \
    	      echo "$(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
    	      $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir"; }; \
    ## Don't perform translation, since script name is important.
    	    echo " $(INSTALL_DATA) $$xfiles '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
    	    $(INSTALL_DATA) $$xfiles "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; }; \
    ## Byte-compile must be done at install time, since file times are
    ## encoded in the actual files.
    	  if test -n "$$dlist"; then \
    	    $(am__py_compile) --destdir "$(DESTDIR)" \
    	                      --basedir "$(%NDIR%dir)" $$dlist; \
    	  else :; fi \
    	done
    endif !%?BASE%
    endif %?INSTALL%
    
    
    ## -------------- ##
    ## Uninstalling.  ##
    ## -------------- ##
    
    if %?INSTALL%
    .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; \
    	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|'`; \
    	st=0; \
    	for files in "$$files" "$$filesc" "$$fileso"; do \
    	  $(am__uninstall_files_from_dir) || st=$$?; \
    	done; \
    	exit $$st
    endif %?INSTALL%
    
    
    ## ---------- ##
    ## Cleaning.  ##
    ## ---------- ##
    
    ## There is nothing to clean here since files are
    ## byte-compiled when (and where) they are installed.
    
    ## -------------- ##
    ## Distributing.  ##
    ## -------------- ##
    
    if %?DIST%
    DIST_COMMON += %DISTVAR%
    endif %?DIST%