diff --git a/boost-1.55.0-python-abi_letters.patch b/boost-1.55.0-python-abi_letters.patch new file mode 100644 index 0000000..71fa9bd --- /dev/null +++ b/boost-1.55.0-python-abi_letters.patch @@ -0,0 +1,62 @@ +--- boost_1_55_0/tools/build/v2/tools/python.jam 2013-05-21 06:14:18.000000000 +0200 ++++ boost_1_55_0/tools/build/v2/tools/python.jam 2014-05-29 19:09:12.115413877 +0200 +@@ -94,7 +94,7 @@ feature.feature pythonpath : : free opti + # using python : 2.3 : /usr/local/bin/python ; + # + rule init ( version ? : cmd-or-prefix ? : includes * : libraries ? +- : condition * : extension-suffix ? ) ++ : condition * : extension-suffix ? : abi-letters ? ) + { + project.push-current $(.project) ; + +@@ -107,7 +107,7 @@ rule init ( version ? : cmd-or-prefix ? + } + } + +- configure $(version) : $(cmd-or-prefix) : $(includes) : $(libraries) : $(condition) : $(extension-suffix) ; ++ configure $(version) : $(cmd-or-prefix) : $(includes) : $(libraries) : $(condition) : $(extension-suffix) : $(abi-letters) ; + + project.pop-current ; + } +@@ -653,7 +653,7 @@ local rule system-library-dependencies ( + + # Declare a target to represent Python's library. + # +-local rule declare-libpython-target ( version ? : requirements * ) ++local rule declare-libpython-target ( version ? : requirements * : abi-letters ? ) + { + # Compute the representation of Python version in the name of Python's + # library file. +@@ -677,13 +677,13 @@ local rule declare-libpython-target ( ve + } + + # Declare it. +- lib python.lib : : python$(lib-version) $(requirements) ; ++ lib python.lib : : python$(lib-version)$(abi-letters) $(requirements) ; + } + + + # Implementation of init. + local rule configure ( version ? : cmd-or-prefix ? : includes * : libraries ? : +- condition * : extension-suffix ? ) ++ condition * : extension-suffix ? : abi-letters ? ) + { + local prefix ; + local exec-prefix ; +@@ -699,6 +699,7 @@ local rule configure ( version ? : cmd-o + extension-suffix ?= _d ; + } + extension-suffix ?= "" ; ++ abi-letters ?= "" ; + + # Normalize and dissect any version number. + local major-minor ; +@@ -922,7 +923,7 @@ local rule configure ( version ? : cmd-o + } + else + { +- declare-libpython-target $(version) : $(target-requirements) ; ++ declare-libpython-target $(version) : $(target-requirements) : $(abi-letters) ; + + # This is an evil hack. On, Windows, when Python is embedded, nothing + # seems to set up sys.path to include Python's standard library diff --git a/boost-1.55.0-python-libpython_dep.patch b/boost-1.55.0-python-libpython_dep.patch new file mode 100644 index 0000000..202f4ec --- /dev/null +++ b/boost-1.55.0-python-libpython_dep.patch @@ -0,0 +1,13 @@ +Index: boost/tools/build/v2/tools/python.jam +=================================================================== +--- boost/tools/build/v2/tools/python.jam (revision 50406) ++++ boost/tools/build/v2/tools/python.jam (working copy) +@@ -994,7 +994,7 @@ + else + { + alias python_for_extensions +- : ++ : python + : $(target-requirements) + : + : $(usage-requirements) diff --git a/boost-1.55.0-python-test-PyImport_AppendInittab.patch b/boost-1.55.0-python-test-PyImport_AppendInittab.patch new file mode 100644 index 0000000..1d2ee5c --- /dev/null +++ b/boost-1.55.0-python-test-PyImport_AppendInittab.patch @@ -0,0 +1,98 @@ +diff -up boost_1_55_0/libs/python/test/exec.cpp\~ boost_1_55_0/libs/python/test/exec.cpp +--- boost_1_55_0/libs/python/test/exec.cpp~ 2010-07-05 00:38:38.000000000 +0200 ++++ boost_1_55_0/libs/python/test/exec.cpp 2015-01-09 21:31:12.903218280 +0100 +@@ -56,6 +56,20 @@ void eval_test() + BOOST_TEST(value == "ABCDEFG"); + } + ++struct PyCtx ++{ ++ PyCtx() { ++ Py_Initialize(); ++ } ++ ++ ~PyCtx() { ++ // N.B. certain problems may arise when Py_Finalize is called when ++ // using Boost.Python. However in this test suite it all seems to ++ // work fine. ++ Py_Finalize(); ++ } ++}; ++ + void exec_test() + { + // Register the module with the interpreter +@@ -68,6 +82,8 @@ void exec_test() + ) == -1) + throw std::runtime_error("Failed to add embedded_hello to the interpreter's " + "builtin modules"); ++ ++ PyCtx ctx; + // Retrieve the main module + python::object main = python::import("__main__"); + +@@ -148,41 +164,43 @@ void check_pyerr(bool pyerr_expected=fal + } + } + ++template ++bool ++run_and_handle_exception(Cb cb, bool pyerr_expected = false) ++{ ++ PyCtx ctx; ++ if (python::handle_exception(cb)) { ++ check_pyerr(pyerr_expected); ++ return true; ++ } else { ++ return false; ++ } ++} ++ + int main(int argc, char **argv) + { + BOOST_TEST(argc == 2 || argc == 3); + std::string script = argv[1]; +- // Initialize the interpreter +- Py_Initialize(); + +- if (python::handle_exception(eval_test)) { +- check_pyerr(); +- } +- else if(python::handle_exception(exec_test)) { +- check_pyerr(); +- } +- else if (python::handle_exception(boost::bind(exec_file_test, script))) { ++ // N.B. exec_test mustn't be called through run_and_handle_exception ++ // as it needs to handles the python context by itself. ++ if (run_and_handle_exception(eval_test) ++ || python::handle_exception(exec_test)) + check_pyerr(); +- } +- +- if (python::handle_exception(exec_test_error)) +- { +- check_pyerr(/*pyerr_expected*/ true); +- } + else +- { ++ run_and_handle_exception(boost::bind(exec_file_test, script)); ++ ++ if (!run_and_handle_exception(exec_test_error, true)) + BOOST_ERROR("Python exception expected, but not seen."); +- } + + if (argc > 2) { ++ PyCtx ctx; + // The main purpose is to test compilation. Since this test generates + // a file and I (rwgk) am uncertain about the side-effects, run it only + // if explicitly requested. + exercise_embedding_html(); + } + +- // Boost.Python doesn't support Py_Finalize yet. +- // Py_Finalize(); + return boost::report_errors(); + } + + +Diff finished. Fri Jan 9 21:31:13 2015 diff --git a/boost.spec b/boost.spec index 67840f0..e311091 100644 --- a/boost.spec +++ b/boost.spec @@ -36,7 +36,7 @@ Name: boost Summary: The free peer-reviewed portable C++ source libraries Version: 1.55.0 %define version_enc 1_55_0 -Release: 7%{?dist} +Release: 8%{?dist} License: Boost and MIT and Python %define toplev_dirname %{name}_%{version_enc} @@ -165,6 +165,11 @@ Patch58: boost-1.54.0-smart_ptr-shared_ptr_at.patch Patch59: boost-1.55.0-atomic-int128_1.patch Patch60: boost-1.55.0-atomic-int128_2.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1102667 +Patch61: boost-1.55.0-python-libpython_dep.patch +Patch62: boost-1.55.0-python-abi_letters.patch +Patch63: boost-1.55.0-python-test-PyImport_AppendInittab.patch + %bcond_with tests %bcond_with docs_generated @@ -654,6 +659,9 @@ a number of significant features and is now developed independently %patch58 -p1 %patch59 -p2 %patch60 -p2 +%patch61 -p1 +%patch62 -p1 +%patch63 -p1 # At least python2_version needs to be a macro so that it's visible in # %%install as well. @@ -674,11 +682,13 @@ cat >> ./tools/build/v2/user-config.jam << EOF # There are many strict aliasing warnings, and it's not feasible to go # through them all at this time. using gcc : : : -fno-strict-aliasing ; +%if %{with openmpi} || %{with mpich} using mpi ; +%endif %if %{with python3} # This _adds_ extra python version. It doesn't replace whatever # python 2.X is default on the system. -using python : %{python3_version} : /usr/bin/python3 : /usr/include/python%{python3_version}%{python3_abiflags} ; +using python : %{python3_version} : /usr/bin/python3 : /usr/include/python%{python3_version}%{python3_abiflags} : : : : %{python3_abiflags} ; %endif EOF @@ -1256,6 +1266,15 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man1/bjam.1* %changelog +* Fri Jan 9 2015 Petr Machata - 1.55.0-8 +- Build libboost_python and libboost_python3 such that they depend on + their respective libpython's. + (boost-1.55.0-python-libpython_dep.patch, + boost-1.55.0-python-abi_letters.patch) +- Fix Boost.Python test suite so that PyImport_AppendInittab is called + before PyInitialize, which broke the test suite with Python 3. + (boost-1.55.0-python-test-PyImport_AppendInittab.patch) + * Thu Jan 8 2015 Petr Machata - 1.55.0-7 - Change Requires: and other package references to use %%{?_isa}, so that dependencies are arch-aware.