From 798d1bfdc08000da9546f2c104fc9c965ee2b2b1 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Thu, 10 Oct 2002 18:22:05 +0000 Subject: [PATCH] For PR automake/369: * lib/am/python.am: Lookup python files in build directory or source directory. From Mathias Doreille. * tests/python3.test: New file. * tests/Makefile.am (TESTS): Add python3.test. * tests/defs: Handle `required=python'. --- ChangeLog | 8 +++++++ lib/am/python.am | 12 ++++++----- tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/python3.test | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 70 insertions(+), 5 deletions(-) create mode 100755 tests/python3.test diff --git a/ChangeLog b/ChangeLog index 3687abbe..dbb3d8ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2002-10-10 Alexandre Duret-Lutz + For PR automake/369: + * lib/am/python.am: Lookup python files in build directory or + source directory. + From Mathias Doreille. + * tests/python3.test: New file. + * tests/Makefile.am (TESTS): Add python3.test. + * tests/defs: Handle `required=python'. + For PR automake/358: * lib/am/texi-vers.am (%STAMPVTI%): Depend on configure instead of configure.ac. diff --git a/lib/am/python.am b/lib/am/python.am index ddf6974e..24f51d13 100644 --- a/lib/am/python.am +++ b/lib/am/python.am @@ -31,16 +31,18 @@ install-%DIR%PYTHON: $(%DIR%_PYTHON) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(%NDIR%dir) @list='$(%DIR%_PYTHON)'; dlist=''; for p in $$list; do\ - if test -f $(srcdir)/$$p; then \ +## 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.yo', -## not '$(DESTDIR)$(%NDIR%dir)/python/foo.yo'. +## want to install 'python/foo.py' as '$(DESTDIR)$(%NDIR%dir)/foo.py', +## not '$(DESTDIR)$(%NDIR%dir)/python/foo.py'. ?BASE? d=`echo "$$p" | sed -e 's,^.*/,,'`; \ ?!BASE? d="$$p"; \ dlist="$$dlist $$d"; \ ## Don't perform translation, since script name is important. - echo " $(%DIR%PYTHON_INSTALL) $(srcdir)/$$p $(DESTDIR)$(%NDIR%dir)/$$d"; \ - $(%DIR%PYTHON_INSTALL) $(srcdir)/$$p $(DESTDIR)$(%NDIR%dir)/$$d; \ + echo " $(%DIR%PYTHON_INSTALL) $$b$$p $(DESTDIR)$(%NDIR%dir)/$$d"; \ + $(%DIR%PYTHON_INSTALL) $$b$$p $(DESTDIR)$(%NDIR%dir)/$$d; \ else :; fi; \ done; \ ## Byte-compile must be done at install time, since file times are diff --git a/tests/Makefile.am b/tests/Makefile.am index 75cfa671..0b460a53 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -317,6 +317,7 @@ primary2.test \ proginst.test \ python.test \ python2.test \ +python3.test \ ranlib.test \ recurs.test \ recurs2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index e3c0fdbb..624ea0ff 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -409,6 +409,7 @@ primary2.test \ proginst.test \ python.test \ python2.test \ +python3.test \ ranlib.test \ recurs.test \ recurs2.test \ diff --git a/tests/python3.test b/tests/python3.test new file mode 100755 index 00000000..a4065227 --- /dev/null +++ b/tests/python3.test @@ -0,0 +1,53 @@ +#! /bin/sh +# Copyright (C) 2002 Free Software Foundation, Inc. +# +# This file is part of GNU Automake. +# +# GNU Automake 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. +# +# GNU Automake 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 autoconf; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# Make sure we install built python files. + +required=python +. ./defs || exit 1 + +set -e + +cat >>configure.in < Makefile.am <<'END' +mydir=$(prefix)/my +my_PYTHON = one.py + +one.py: + echo 'def one(): return 1' >$@ +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE --add-missing + +mkdir inst +inst=`pwd`/inst +mkdir build +cd build +../configure --prefix="$inst" +$MAKE install +test -f $inst/my/one.py +test -f $inst/my/one.pyc +test -f $inst/my/one.pyo -- 2.43.5