[pkg-boost-commits] r14602 - in boost/trunk/debian: . patches

Steven Michael Robbins smr at alioth.debian.org
Sat Sep 18 22:47:21 UTC 2010


Author: smr
Date: 2010-09-18 22:47:21 +0000 (Sat, 18 Sep 2010)
New Revision: 14602

Added:
   boost/trunk/debian/patches/boost-1.44-py3.1.patch
Modified:
   boost/trunk/debian/changelog
   boost/trunk/debian/control
   boost/trunk/debian/patches/series
   boost/trunk/debian/rules
Log:
Enable build for Python 3.

Modified: boost/trunk/debian/changelog
===================================================================
--- boost/trunk/debian/changelog	2010-09-12 03:44:45 UTC (rev 14601)
+++ boost/trunk/debian/changelog	2010-09-18 22:47:21 UTC (rev 14602)
@@ -1,3 +1,13 @@
+boost1.44 (1.44.0-2) experimental; urgency=low
+
+  * rules, control: Build Python extensions for Python 3 in addition to
+    Python 2.
+
+  * patches/boost-1.44-py3.1.patch: New.  Fix Boost.MPI build failure for
+    Python 3 (thanks, Andreas Kloeckner).
+
+ -- Steve M. Robbins <smr at debian.org>  Sat, 18 Sep 2010 12:03:46 -0500
+
 boost1.44 (1.44.0-1) experimental; urgency=low
 
   * New upstream.  Closes: #582690, #594634.

Modified: boost/trunk/debian/control
===================================================================
--- boost/trunk/debian/control	2010-09-12 03:44:45 UTC (rev 14601)
+++ boost/trunk/debian/control	2010-09-18 22:47:21 UTC (rev 14602)
@@ -4,9 +4,10 @@
 Priority: optional
 Maintainer: Debian Boost Team <pkg-boost-devel at lists.alioth.debian.org>
 Uploaders: Steve M. Robbins <smr at debian.org>, Domenico Andreoli <cavok at debian.org>
-Build-Depends: debhelper (>= 7), bison, flex, docbook-to-man, xsltproc, doxygen, zlib1g-dev, libbz2-dev, libicu-dev, python-all-dev, python-support (>= 0.6), mpi-default-dev
-Build-Conflicts: boost-build, libopenmpi-dev (= 1.3.2-2)
+Build-Depends: debhelper (>= 7), bison, flex, docbook-to-man, xsltproc, doxygen, zlib1g-dev, libbz2-dev, libicu-dev, python-all-dev, python3-all-dev (>= 3.1), python-support (>= 0.6), mpi-default-dev
+Build-Conflicts: libopenmpi-dev (= 1.3.2-2)
 XS-Python-Version: >= 2.4
+XS-Python3-Version: >= 3.0
 Vcs-Browser: http://svn.debian.org/wsvn/pkg-boost/boost/trunk/
 Vcs-Svn: svn://svn.debian.org/svn/pkg-boost/boost/trunk
 Standards-Version: 3.8.3

Added: boost/trunk/debian/patches/boost-1.44-py3.1.patch
===================================================================
--- boost/trunk/debian/patches/boost-1.44-py3.1.patch	                        (rev 0)
+++ boost/trunk/debian/patches/boost-1.44-py3.1.patch	2010-09-18 22:47:21 UTC (rev 14602)
@@ -0,0 +1,93 @@
+--- boost1.44-1.44.0.orig/libs/mpi/src/python/datatypes.cpp
++++ boost1.44-1.44.0/libs/mpi/src/python/datatypes.cpp
+@@ -17,7 +17,9 @@
+ 
+ void export_datatypes()
+ {
++#if PY_MAJOR_VERSION < 3
+   register_serialized(long(0), &PyInt_Type);
++#endif
+   register_serialized(false, &PyBool_Type);
+   register_serialized(double(0.0), &PyFloat_Type);
+ }
+--- boost1.44-1.44.0.orig/libs/mpi/src/python/py_environment.cpp
++++ boost1.44-1.44.0/libs/mpi/src/python/py_environment.cpp
+@@ -11,6 +11,9 @@
+  *  This file reflects the Boost.MPI "environment" class into Python
+  *  methods at module level.
+  */
++
++#include <locale>
++#include <string>
+ #include <boost/python.hpp>
+ #include <boost/mpi.hpp>
+ 
+@@ -50,11 +53,65 @@
+ 
+   // If anything changed, convert C-style argc/argv into Python argv
+   if (mpi_argv != my_argv)
++  {
++#if PY_MAJOR_VERSION >= 3
++    // Code stolen from py3k/Modules/python.c.
++
++    wchar_t **argv_copy = (wchar_t **)PyMem_Malloc(sizeof(wchar_t*)*mpi_argc);
++    /* We need a second copies, as Python might modify the first one. */
++    wchar_t **argv_copy2 = (wchar_t **)PyMem_Malloc(sizeof(wchar_t*)*mpi_argc);
++
++    if (!argv_copy || !argv_copy2) {
++      fprintf(stderr, "out of memory\n");
++      return false;
++    }
++
++    std::locale mylocale;
++    mbstate_t mystate;
++
++    const std::codecvt<char, wchar_t, mbstate_t>& myfacet =
++      std::use_facet<std::codecvt<char, wchar_t, mbstate_t> >(mylocale);
++
++    for (int i = 0; i < mpi_argc; i++) 
++    {
++      size_t length = strlen(mpi_argv[i]);
++
++      wchar_t *dest = (wchar_t *) PyMem_Malloc(sizeof(wchar_t) * (length + 1));
++
++      const char *from_next;
++      wchar_t *to_next;
++
++      std::codecvt<wchar_t,char,mbstate_t>::result myresult = 
++        myfacet.out(mystate,
++            mpi_argv[i], mpi_argv[i] + length + 1, from_next,
++            dest, dest+length+1, to_next);
++
++      if (myresult != std::codecvt<wchar_t,char,mbstate_t>::ok )
++      {
++        fprintf(stderr, "failure translating argv\n");
++        return 1;
++      }
++
++      argv_copy2[i] = argv_copy[i] = dest;
++      if (!argv_copy[i])
++          return false;
++    }
++
++    PySys_SetArgv(mpi_argc, argv_copy);
++
++    for (int i = 0; i < mpi_argc; i++) {
++        PyMem_Free(argv_copy2[i]);
++    }
++    PyMem_Free(argv_copy);
++    PyMem_Free(argv_copy2);
++#else
+     PySys_SetArgv(mpi_argc, mpi_argv);
++#endif
++  }
+ 
+-  for (int arg = 0; arg < my_argc; ++arg)
+-    free(my_argv[arg]);
+-  delete [] my_argv;
++  for (int arg = 0; arg < mpi_argc; ++arg)
++    free(mpi_argv[arg]);
++  delete [] mpi_argv;
+ 
+   return true;
+ }

Modified: boost/trunk/debian/patches/series
===================================================================
--- boost/trunk/debian/patches/series	2010-09-12 03:44:45 UTC (rev 14601)
+++ boost/trunk/debian/patches/series	2010-09-18 22:47:21 UTC (rev 14602)
@@ -11,3 +11,4 @@
 kfreebsd-thread.patch
 fusion-name-qual.patch
 remove-rpath.patch
+boost-1.44-py3.1.patch

Modified: boost/trunk/debian/rules
===================================================================
--- boost/trunk/debian/rules	2010-09-12 03:44:45 UTC (rev 14601)
+++ boost/trunk/debian/rules	2010-09-18 22:47:21 UTC (rev 14602)
@@ -13,7 +13,7 @@
 SOVERSION = 1.44.0
 SHLIBS_VERSION = (>= 1.44.0-1)
 
-pyversions = $(shell pyversions -rv)
+pyversions = $(shell pyversions -rv) 3.1
 
 # Boost libraries for which we want separate packages
 boost_libs := date-time filesystem graph-parallel graph iostreams math \




More information about the pkg-boost-commits mailing list