[Top][All Lists]
[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: |
15 Oct 2001 00:07:15 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
>>> "Tom" == Tom Tromey <address@hidden> writes:
>>>>>> "adl" == Alexandre Duret-Lutz <address@hidden> writes:
adl> See the comments in the patch: I have no idea about what should
adl> be done about the PYCFILES and PYOFILES documented variables.
Tom> According to the manual these variables are used to control whether
Tom> bytecode compilation is done. I agree that having this controlled by
Tom> these variables is somewhat ugly. What if we added a new
Tom> AUTOMAKE_OPTION instead?
Is there a need for them? To me it looks like they never
worked, and I've no idea when they are usefull.
adl> 2001-09-28 Alexandre Duret-Lutz <address@hidden>
adl> * lib/am/python.am (install-%DIR%PYTHON,
adl> uninstall-%DIR%PYTHON): Strip path of source file.
adl> (clean-python): Comment out.
Tom> Shouldn't we also support the `nobase_' prefix here?
Sure!
Tom> That is as easy as making the basename step conditional.
Tom> See lib/am/lisp.am for an example.
Thanks for the pointer. The patch below is what I came up to,
but I could not get it working.
In fact I'm wondering whether the nobase_ feature is functional
at all!
The trouble is that if you define
nobase_python_PYTHON=mumble.py, then, when python.am is
processed, %DIR% is substitued with 'python_PYTHON' instead of
'nobase_python_PYTHON'. So the line
DIST_COMMON += $(%DIR%_PYTHON)
become an error.
To me, the setup in &am_install_var is rather strange:
[...]
foreach my $X (sort keys %valid)
{
[...]
$X =~ s/^nobase_//;
[...]
my $nodir_name = $X;
[...]
$nodir_name =~ s/^(dist|nodist)_//;
[...]
$output_rules .= &file_contents ($file,
[...]
'DIR' => $X,
'NDIR' => $nodir_name,
[...]
DIR is the target name without nobase_, NDIR is the target name
without nobase_, dist_, and nodist_. Why this distinction?
I was not expecting to get nobase_ stripped off from DIR.
BTW, what is N meant for in 'NDIR'? (and 'no' in nodir_name?)
2001-10-14 Alexandre Duret-Lutz <address@hidden>
* lib/am/python.am (install-%DIR%PYTHON, uninstall-%DIR%PYTHON):
Have the basename step optional and use %NDIR% instead of %DIR% in
filename in order to support 'nobase_'.
--- lib/am/python.am Sun Oct 14 22:47:42 2001
+++ lib/am/python.am Sun Oct 14 23:05:47 2001
@@ -22,26 +22,28 @@
## ------------ ##
if %?INSTALL%
-_am_installdirs += $(DESTDIR)$(%DIR%dir)
+_am_installdirs += $(DESTDIR)$(%NDIR%dir)
?EXEC?.PHONY install-exec-am: install-%DIR%PYTHON
?!EXEC?.PHONY install-data-am: install-%DIR%PYTHON
install-%DIR%PYTHON: $(%DIR%_PYTHON)
@$(NORMAL_INSTALL)
- $(mkinstalldirs) $(DESTDIR)$(%DIR%dir)
- @list='$(%DIR%_PYTHON)'; dlist=''; for p in $$list; do\
+ $(mkinstalldirs) $(DESTDIR)$(%NDIR%dir)
+ @list='$(%NDIR%_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,^.*/,,'`; \
+## Compute basename of source file. Unless this is a nobase_ target, we
+## want to install 'python/foo.py' as '$(DESTDIR)$(%NDIR%dir)/foo.yo',
+## not '$(DESTDIR)$(%NDIR%dir)/python/foo.yo'.
+?BASE? d=`echo "$$p" | sed -e 's,^.*/,,'`; \
+?!BASE? d="$$p"; \
dlist="$$dlist $$d"; \
## Don't perform translation, since script name is important.
- echo " $(INSTALL_PROGRAM) $(srcdir)/$$p $(DESTDIR)$(%DIR%dir)/$$d";
\
- $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(%DIR%dir)/$$d; \
+ echo " $(INSTALL_PROGRAM) $(srcdir)/$$p
$(DESTDIR)$(%NDIR%dir)/$$d"; \
+ $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(%NDIR%dir)/$$d; \
else :; fi; \
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) $$dlist
+ PYTHON=$(PYTHON) $(py_compile) --basedir $(DESTDIR)$(%NDIR%dir) $$dlist
endif %?INSTALL%
@@ -53,13 +55,14 @@
.PHONY uninstall-am: uninstall-%DIR%PYTHON
uninstall-%DIR%PYTHON:
@$(NORMAL_UNINSTALL)
- list='$(%DIR%_PYTHON)'; for p in $$list; do \
- d=`echo "$$p" | sed -e 's,^.*/,,'`; \
- rm -f $(DESTDIR)$(%DIR%dir)/$$d; \
+ list='$(%NDIR%_PYTHON)'; for p in $$list; do \
+?BASE? d=`echo "$$p" | sed -e 's,^.*/,,'`; \
+?!BASE? d="$$p"; \
+ rm -f $(DESTDIR)$(%NDIR%dir)/$$d; \
## This is to remove the .pyc and .pyo byte compiled versions (a bit
## of a hack).
- rm -f $(DESTDIR)$(%DIR%dir)/$${d}c; \
- rm -f $(DESTDIR)$(%DIR%dir)/$${d}o; \
+ rm -f $(DESTDIR)$(%NDIR%dir)/$${d}c; \
+ rm -f $(DESTDIR)$(%NDIR%dir)/$${d}o; \
done
endif %?INSTALL%
--
Alexandre Duret-Lutz