last-svn-commit-175-g0581226 Generate python/data.py.

* python/data.py: Rename as... * python/data.py.in: ...this. Adjust. Turn top_srcdir into a variable substituted by configure. * python/Makefile.am (EXTRA_DIST): s/data.py/data.py.in/. * python/Makefile.am (all-local): New rule. Depend on data.py. (edit): Substitute top_srcdir. (data.py): New rule. (CLEANFILES): Add data.py. (TESTS_ENVIRONMENT): No longer set top_srcdir and top_builddir. * python/complex2-misc.py, python/max-tree.py: Do not import `data', as it is not used. --- swilena/ChangeLog | 18 ++++++++++++ swilena/python/Makefile.am | 48 +++++++++++++++++++++---------- swilena/python/complex2-misc.py | 1 - swilena/python/{data.py => data.py.in} | 4 +- swilena/python/max-tree.py | 1 - 5 files changed, 52 insertions(+), 20 deletions(-) rename swilena/python/{data.py => data.py.in} (88%) diff --git a/swilena/ChangeLog b/swilena/ChangeLog index f39ebab..c6fd900 100644 --- a/swilena/ChangeLog +++ b/swilena/ChangeLog @@ -1,3 +1,21 @@ +2010-05-28 Roland Levillain <roland@lrde.epita.fr> + + Generate python/data.py. + + * python/data.py: Rename as... + * python/data.py.in: ...this. + Adjust. + Turn top_srcdir into a variable substituted by configure. + * python/Makefile.am (EXTRA_DIST): s/data.py/data.py.in/. + * python/Makefile.am (all-local): New rule. + Depend on data.py. + (edit): Substitute top_srcdir. + (data.py): New rule. + (CLEANFILES): Add data.py. + (TESTS_ENVIRONMENT): No longer set top_srcdir and top_builddir. + * python/complex2-misc.py, python/max-tree.py: + Do not import `data', as it is not used. + 2010-04-08 Roland Levillain <roland@lrde.epita.fr> Simplify python/max-tree.py using Python's itertools. diff --git a/swilena/python/Makefile.am b/swilena/python/Makefile.am index 3e5937d..cd02746 100644 --- a/swilena/python/Makefile.am +++ b/swilena/python/Makefile.am @@ -22,7 +22,6 @@ ## FIXME: Factor as much as possible. See how we handled this in TC. -CLEANFILES = AM_CPPFLAGS = -I$(PYTHONINC) -I$(top_srcdir)/milena TOOLS_CXXFLAGS = @TOOLS_CXXFLAGS@ AM_CXXFLAGS = $(TOOLS_CXXFLAGS) @@ -40,13 +39,42 @@ AM_LDFLAGS = -avoid-version -module -shared fi +# Use Make to generate `data.py' and shell scripts (`sps' and +# `sps-local') instead of `configure', as advised by Autoconf's manual +# (see section ``Installation Directory Variables''). +edit = sed \ + -e 's|@top_srcdir[@]|$(top_srcdir)|g' \ + -e 's|@abs_srcdir[@]|$(abs_srcdir)|g' \ + -e 's|@abs_builddir[@]|$(abs_builddir)|g' \ + -e 's|@abs_top_builddir[@]|$(abs_top_builddir)|g' \ + -e 's|@libdir[@]|$(libdir)|g' \ + -e 's|@pythondir[@]|$(pythondir)|g' \ + -e 's|@PYTHON[@]|$(PYTHON)|g' + + # ltihooks.py: Python import hooks that understand Libtool libraries. python_PYTHON = ltihooks.py # swilena.py: The whole Swilena suite. python_PYTHON += swilena.py -# data.py: Access to the data of the distribution (images, meshes, etc.) -EXTRA_DIST = data.py +# data.py: Access to the data of the distribution (images, meshes, +# etc.). +# +# Use the all-local hook instead of the nodist_noinst_PYTHON variable, +# since ``[...] byte-compilation occurs at install time, any files +# listed in `noinst_PYTHON' will not be compiled'' (and therefore +# generated, in our case), according to Automake's manual, +all-local: data.py +EXTRA_DIST = data.py.in +data.py: data.py.in Makefile + rm -f $@ $@.tmp + srcdir=''; \ + test -f ./$< || srcdir=$(srcdir)/; \ + $(edit) $${srcdir}$< >>$@.tmp + chmod a-w $@.tmp + mv $@.tmp $@ + +CLEANFILES = data.py ## ----------------- ## @@ -297,17 +325,6 @@ noinst_SCRIPTS = sps-local EXTRA_DIST += sps-common.in sps.in sps-local.in -# Use Make to generate shell scripts (`sps' and `sps-local') instead -# of `configure', as advised by Autoconf's manual (see section -# ``Installation Directory Variables''). -edit = sed \ - -e 's|@abs_srcdir[@]|$(abs_srcdir)|g' \ - -e 's|@abs_builddir[@]|$(abs_builddir)|g' \ - -e 's|@abs_top_builddir[@]|$(abs_top_builddir)|g' \ - -e 's|@libdir[@]|$(libdir)|g' \ - -e 's|@pythondir[@]|$(pythondir)|g' \ - -e 's|@PYTHON[@]|$(PYTHON)|g' - sps sps-local: Makefile $(srcdir)/sps-common.in rm -f $@ $@.tmp srcdir=''; \ @@ -330,8 +347,7 @@ CLEANFILES += $(bin_SCRIPTS) $(noinst_SCRIPTS) include $(top_srcdir)/swilena/run.mk -TESTS_ENVIRONMENT = \ - top_srcdir="$(top_srcdir)" top_builddir="$(top_builddir)" $(RUN) +TESTS_ENVIRONMENT = $(RUN) # Ensure `run' is rebuilt before the tests are run. $(TESTS): $(srcdir)/run.stamp # The dependency is on `run.in' and not `run', since `run' is diff --git a/swilena/python/complex2-misc.py b/swilena/python/complex2-misc.py index 87fb27a..77332e9 100644 --- a/swilena/python/complex2-misc.py +++ b/swilena/python/complex2-misc.py @@ -22,7 +22,6 @@ # # See also Milena's tests/topo/complex.cc. -import data from swilena import * # A 2-d (simplicial) complex and its adjacency graph. diff --git a/swilena/python/data.py b/swilena/python/data.py.in similarity index 88% rename from swilena/python/data.py rename to swilena/python/data.py.in index 4a162d9..01f0a7f 100644 --- a/swilena/python/data.py +++ b/swilena/python/data.py.in @@ -1,6 +1,6 @@ #! /usr/bin/env python -# Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE) +# Copyright (C) 2008, 2010 EPITA Research and Development Laboratory (LRDE) # # This file is part of Olena. # @@ -21,6 +21,6 @@ import os -top_srcdir = os.environ["top_srcdir"] +top_srcdir = "@top_srcdir@" img_dir = os.path.join(top_srcdir, "milena", "img") lena = os.path.join (img_dir, "lena.pgm") diff --git a/swilena/python/max-tree.py b/swilena/python/max-tree.py index 7f09eff..05dd32a 100644 --- a/swilena/python/max-tree.py +++ b/swilena/python/max-tree.py @@ -19,7 +19,6 @@ # \file python/max-tree.py # \brief Test on the max-tree. -import data from swilena import * import itertools -- 1.5.6.5
participants (1)
-
Roland Levillain