aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Piotr Jaroszyński <peper@gentoo.org> 2007-09-10 11:17:10 +0000
committerAvatar Piotr Jaroszyński <peper@gentoo.org> 2007-09-10 11:17:10 +0000
commit531fb7ecbef246569cd98929a107e200089e5421 (patch)
tree566433622588c78c366468d5585f0d7a5e5684d7
parent7f30d2d58c9649051616d0691d9e68ed6c823295 (diff)
downloadpaludis-531fb7ecbef246569cd98929a107e200089e5421.tar.gz
paludis-531fb7ecbef246569cd98929a107e200089e5421.tar.xz
Check whether to enable Python Hooks in configure.ac.
-rw-r--r--configure.ac18
-rw-r--r--paludis/Makefile.am.m42
-rw-r--r--paludis/hooker.cc9
-rw-r--r--paludis/hooker_TEST.cc13
4 files changed, 23 insertions, 19 deletions
diff --git a/configure.ac b/configure.ac
index 17c7834..32c4c14 100644
--- a/configure.ac
+++ b/configure.ac
@@ -885,8 +885,26 @@ int main() { boost::python::throw_error_already_set(); return 0; }
LIBS="$save_LIBS"
CXXFLAGS="$save_CXXFLAGS"
dnl }}}
+
AC_DEFINE([ENABLE_PYTHON], [1], [Enable Python])
+ dnl {{{ check whether to enable Python Hooks
+ AC_MSG_CHECKING([whether to enable Python Hooks])
+ BOOST_MIN_VERSION="103400"
+ AC_EGREP_CPP(enable,
+ [#include <boost/version.hpp>
+ #if BOOST_VERSION >= $BOOST_MIN_VERSION
+ enable
+ #endif
+ ], enable_python_hooks=yes, enable_python_hooks=no)
+ if test $enable_python_hooks = "yes" ; then
+ AC_DEFINE([ENABLE_PYTHON_HOOKS], [1], [Enable Python Hooks])
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ AM_CONDITIONAL([ENABLE_PYTHON_HOOKS], test "$enable_python_hooks" = "yes")
+ dnl }}}
fi
AM_CONDITIONAL([ENABLE_PYTHON], test "x$enable_python" = "xyes")
dnl }}}
diff --git a/paludis/Makefile.am.m4 b/paludis/Makefile.am.m4
index 685ab40..1760f2f 100644
--- a/paludis/Makefile.am.m4
+++ b/paludis/Makefile.am.m4
@@ -130,7 +130,7 @@ else
lib_LTLIBRARIES = libpaludis.la
noinst_LTLIBRARIES = libpaludismanpagethings.la
-if ENABLE_PYTHON
+if ENABLE_PYTHON_HOOKS
lib_LTLIBRARIES += libpaludispythonhooks.la
endif
diff --git a/paludis/hooker.cc b/paludis/hooker.cc
index 0f82ade..3e6ba10 100644
--- a/paludis/hooker.cc
+++ b/paludis/hooker.cc
@@ -40,13 +40,6 @@
#include <iterator>
#include <dlfcn.h>
-#ifdef ENABLE_PYTHON
-# include <boost/version.hpp>
-# if BOOST_VERSION >= 103400
-# define PYTHON_HOOKS 1
-# endif
-#endif
-
using namespace paludis;
namespace
@@ -499,7 +492,7 @@ Hooker::perform_hook(const Hook & hook) const
+ "' because of naming conflict with '" + stringify(
hook_files.find(stringify(strip_trailing_string(e->basename(), so_suffix)))->second->file_name()) + "'");
-#ifdef PYTHON_HOOKS
+#ifdef ENABLE_PYTHON_HOOKS
if (is_file_with_extension(*e, ".py", IsFileWithOptions()))
{
static bool load_try(false);
diff --git a/paludis/hooker_TEST.cc b/paludis/hooker_TEST.cc
index 714a276..432e737 100644
--- a/paludis/hooker_TEST.cc
+++ b/paludis/hooker_TEST.cc
@@ -27,13 +27,6 @@
#include <fstream>
#include <iterator>
-#ifdef ENABLE_PYTHON
-# include <boost/version.hpp>
-# if BOOST_VERSION >= 103400
-# define PYTHON_HOOKS 1
-# endif
-#endif
-
using namespace test;
using namespace paludis;
@@ -50,7 +43,7 @@ namespace test_cases
HookResult result(0, "");
hooker.add_dir(FSEntry("hooker_TEST_dir/"), false);
-#ifdef PYTHON_HOOKS
+#ifdef ENABLE_PYTHON_HOOKS
result = hooker.perform_hook(Hook("py_hook"));
TEST_CHECK_EQUAL(result.max_exit_status, 0);
#endif
@@ -89,7 +82,7 @@ namespace test_cases
std::ifstream f(stringify(FSEntry("hooker_TEST_dir/ordering.out")).c_str());
std::string line((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>());
-#ifdef PYTHON_HOOKS
+#ifdef ENABLE_PYTHON_HOOKS
TEST_CHECK_EQUAL(line, "e\nc\nf\nd\nb\na\npy_hook\ng\ni\nh\nsohook\nk\nj\n");
#else
TEST_CHECK_EQUAL(line, "e\nc\nf\nd\nb\na\ng\ni\nh\nsohook\nk\nj\n");
@@ -173,7 +166,7 @@ namespace test_cases
TEST_CHECK_EQUAL(result.max_exit_status, 0);
TEST_CHECK_EQUAL(result.output, "foo");
-#ifdef PYTHON_HOOKS
+#ifdef ENABLE_PYTHON_HOOKS
result = hooker.perform_hook(Hook("py_hook_output")
.grab_output(Hook::AllowedOutputValues()("foo")));
TEST_CHECK_EQUAL(result.max_exit_status, 0);