automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: python-files-can-appear-in-subdirs.patch


From: Alexandre Duret-Lutz
Subject: Re: python-files-can-appear-in-subdirs.patch
Date: 29 Sep 2001 19:55:32 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

>>> "Akim" == Akim Demaille <address@hidden> writes:

 Akim> Looks good too.  
 Akim> Please, don't forget NEWS.

Playing a bit more with this revealed a couple of other issues:
  1. uninstall-%DIR%PYTHON need to be updated like install-%DIR%PYTHON
  2. the 'clean-python' seems to be useless; beside it prevents multiple
     _PYTHON targets in the same file.  See the comments in the
     patch: I have no idea about what should be done about the
     PYCFILES and PYOFILES documented variables.

2001-09-28  Alexandre Duret-Lutz  <address@hidden>

        * lib/am/python.am (install-%DIR%PYTHON,
        uninstall-%DIR%PYTHON): Strip path of source file.
        (clean-python): Comment out.

--- lib/am/python.am.15 Wed Sep 26 16:37:14 2001
+++ lib/am/python.am    Fri Sep 28 14:30:02 2001
@@ -28,16 +28,20 @@
 install-%DIR%PYTHON: $(%DIR%_PYTHON)
        @$(NORMAL_INSTALL)
        $(mkinstalldirs) $(DESTDIR)$(%DIR%dir)
-       @list='$(%DIR%_PYTHON)'; for p in $$list; do\
+       @list='$(%DIR%_PYTHON)'; dlist=''; for p in $$list; do\
          if test -f $(srcdir)/$$p; then \
+## Compute basename of source file.  We want to install 'python/foo.py'
+## as '$(DESTDIR)$(%DIR%dir)/foo.yo', not '$(DESTDIR)$(%DIR%dir)/python/foo.yo'
+           d=`echo "$$p" | sed -e 's,^.*/,,'`; \
+           dlist="$$dlist $$d"; \
 ## Don't perform translation, since script name is important.
-           echo " $(INSTALL_PROGRAM) $(srcdir)/$$p $(DESTDIR)$(%DIR%dir)/$$p"; 
\
-           $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(%DIR%dir)/$$p; \
+           echo " $(INSTALL_PROGRAM) $(srcdir)/$$p $(DESTDIR)$(%DIR%dir)/$$d"; 
\
+           $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(%DIR%dir)/$$d; \
          else :; fi; \
-       done
+       done; \
 ## Byte-compile must be done at install time, since file times are
 ## encoded in the actual files.
-       @PYTHON=$(PYTHON) $(py_compile) --basedir $(DESTDIR)$(%DIR%dir) 
$(%DIR%_PYTHON)
+       PYTHON=$(PYTHON) $(py_compile) --basedir $(DESTDIR)$(%DIR%dir) $$dlist
 endif %?INSTALL%
 
 
@@ -50,11 +54,12 @@
 uninstall-%DIR%PYTHON:
        @$(NORMAL_UNINSTALL)
        list='$(%DIR%_PYTHON)'; for p in $$list; do \
-         rm -f $(DESTDIR)$(%DIR%dir)/$$p; \
+         d=`echo "$$p" | sed -e 's,^.*/,,'`; \
+         rm -f $(DESTDIR)$(%DIR%dir)/$$d; \
 ## This is to remove the .pyc and .pyo byte compiled versions (a bit
 ## of a hack).
-         rm -f $(DESTDIR)$(%DIR%dir)/$${p}c; \
-         rm -f $(DESTDIR)$(%DIR%dir)/$${p}o; \
+         rm -f $(DESTDIR)$(%DIR%dir)/$${d}c; \
+         rm -f $(DESTDIR)$(%DIR%dir)/$${d}o; \
        done
 endif %?INSTALL%
 
@@ -63,9 +68,19 @@
 ## Cleaning.  ##
 ## ---------- ##
 
-.PHONY clean-am: clean-python
-clean-python:
-       -test -z "$(PYCFILES)$(PYOFILES)" || rm -f $(PYCFILES) $(PYOFILES)
+## FIXME: There is nothing to clean here since files are
+##        byte-compiled when (and where) they are installed.
+##        Some points thought:
+##          1) clean-python ought to be named clean-%DIR%PYTHON, to allow
+##             multiple _PYTHON targets.
+##          2) PYCFILES and PYOFILES are documented but not used anywhere
+##             else.
+##          3) PYCFILES and PYOFILES shoud be target-dependent for the same
+##             reason.
+##
+##.PHONY clean-am: clean-python
+##clean-python:
+##     -test -z "$(PYCFILES)$(PYOFILES)" || rm -f $(PYCFILES) $(PYOFILES)
 
 
 ## -------------- ##

-- 
Alexandre Duret-Lutz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]