* swig/python/config.py: Remove.
Superseded by...
* swig/python/config.py.in: ...this (new) file.
* swig/python/Makefile.am (edit): New variable.
(all-local): Depend on...
(config.py): ...this (new) target.
(EXTRA_DIST): s/config.py/config.py.in/.
(CLEANFILES) Add config.py and config.py[co].
---
extatica/ChangeLog | 13 ++++++++
extatica/swig/python/Makefile.am | 33 +++++++++++++++++--
extatica/swig/python/config.py | 28 -----------------
.../swig/python/config.py.in | 13 +++----
4 files changed, 48 insertions(+), 39 deletions(-)
delete mode 100644 extatica/swig/python/config.py
copy scribo/demo/Makefile.am => extatica/swig/python/config.py.in (84%)
diff --git a/extatica/ChangeLog b/extatica/ChangeLog
index 2a07f08..52020be 100644
--- a/extatica/ChangeLog
+++ b/extatica/ChangeLog
@@ -1,3 +1,16 @@
+2010-11-08 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Generate Extatica's swig/python/config.py.
+
+ * swig/python/config.py: Remove.
+ Superseded by...
+ * swig/python/config.py.in: ...this (new) file.
+ * swig/python/Makefile.am (edit): New variable.
+ (all-local): Depend on...
+ (config.py): ...this (new) target.
+ (EXTRA_DIST): s/config.py/config.py.in/.
+ (CLEANFILES) Add config.py and config.py[co].
+
2010-11-02 Roland Levillain <roland(a)lrde.epita.fr>
Use intermediate variables in src/Makefile.am.
diff --git a/extatica/swig/python/Makefile.am b/extatica/swig/python/Makefile.am
index f704065..c96c9e3 100644
--- a/extatica/swig/python/Makefile.am
+++ b/extatica/swig/python/Makefile.am
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE).
+# Copyright (C) 2009, 2010 EPITA Research and Development Laboratory (LRDE).
#
# This file is part of Olena.
#
@@ -23,7 +23,6 @@
## FIXME: Adjust.
-CLEANFILES =
AM_CPPFLAGS = -I$(PYTHONINC) -I$(top_builddir)/src -I$(top_srcdir)/src
## FIXME: Define an equivalent to Olena's TOOLS_CXXFLAGS?
##TOOLS_CXXFLAGS = @TOOLS_CXXFLAGS@
@@ -50,8 +49,34 @@ libdynmilena_la = $(top_builddir)/src/wrappers/libdynmilena.la
$(libdyn_la)
# ltihooks.py: Python import hooks that understand Libtool libraries.
python_PYTHON = ltihooks.py
-# config.py: Configuration values of the package.
-EXTRA_DIST = config.py
+# Use Make to generate `config.py' 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|@MILENA_DIR[@]|$(MILENA_DIR)|g'
+
+# config.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: config.py
+EXTRA_DIST = config.py.in
+config.py: config.py.in Makefile
+ rm -f $@ $@.tmp
+ srcdir=''; \
+ test -f ./$< || srcdir=$(srcdir)/; \
+ $(edit) $${srcdir}$< >>$@.tmp
+ chmod a-w $@.tmp
+ mv $@.tmp $@
+
+CLEANFILES = config.py config.py[co]
## ----------------- ##
diff --git a/extatica/swig/python/config.py b/extatica/swig/python/config.py
deleted file mode 100644
index 1594f5e..0000000
--- a/extatica/swig/python/config.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#! /usr/bin/env python
-
-# Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
-#
-# This file is part of Olena.
-#
-# Olena 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, version 2 of the License.
-#
-# Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
-
-# \file
-# \brief Configuration values of the package.
-
-# FIXME: We might want to turn this into a config.py.in file and
-# generate it instead of getting variables from the environment.
-
-import os
-
-abs_top_srcdir = os.environ["abs_top_srcdir"]
-abs_milena_dir = os.path.join(abs_top_srcdir, "..", "milena")
diff --git a/scribo/demo/Makefile.am b/extatica/swig/python/config.py.in
similarity index 84%
copy from scribo/demo/Makefile.am
copy to extatica/swig/python/config.py.in
index b1d3c5b..969799b 100644
--- a/scribo/demo/Makefile.am
+++ b/extatica/swig/python/config.py.in
@@ -1,5 +1,6 @@
-# Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
-# (LRDE).
+#! /usr/bin/env python
+
+# Copyright (C) 2009, 2010 EPITA Research and Development Laboratory (LRDE)
#
# This file is part of Olena.
#
@@ -15,9 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with Olena. If not, see <http://www.gnu.org/licenses/>.
-if HAVE_QT
-
-SUBDIRS = review viewer
-
-endif HAVE_QT
+# \file
+# \brief Configuration values of the package.
+abs_milena_dir = "@MILENA_DIR@"
--
1.5.6.5