Date: Wednesday, September 20, 2017 @ 14:27:11 Author: svenstaro Revision: 258894
upgpkg: openvdb 4.0.2-2 rebuild with python support Added: openvdb/trunk/22d09714f9a6a29c62668b533495ed2afd4251ef.patch Modified: openvdb/trunk/PKGBUILD ------------------------------------------------+ 22d09714f9a6a29c62668b533495ed2afd4251ef.patch | 148 +++++++++++++++++++++++ PKGBUILD | 21 ++- 2 files changed, 163 insertions(+), 6 deletions(-) Added: 22d09714f9a6a29c62668b533495ed2afd4251ef.patch =================================================================== --- 22d09714f9a6a29c62668b533495ed2afd4251ef.patch (rev 0) +++ 22d09714f9a6a29c62668b533495ed2afd4251ef.patch 2017-09-20 14:27:11 UTC (rev 258894) @@ -0,0 +1,148 @@ +From 22d09714f9a6a29c62668b533495ed2afd4251ef Mon Sep 17 00:00:00 2001 +From: Jonathan Scruggs <[email protected]> +Date: Wed, 20 Sep 2017 10:18:19 +0100 +Subject: [PATCH] Attempt to fix boost 1.65 ndarray + +--- + openvdb/python/pyFloatGrid.cc | 8 +++++--- + openvdb/python/pyGrid.h | 31 ++++++++++++++++++++----------- + 2 files changed, 25 insertions(+), 14 deletions(-) + +diff --git a/openvdb/python/pyFloatGrid.cc b/openvdb/python/pyFloatGrid.cc +index e5686b20..7eb9eda2 100644 +--- a/openvdb/python/pyFloatGrid.cc ++++ b/openvdb/python/pyFloatGrid.cc +@@ -45,9 +45,11 @@ exportFloatGrid() + // Add a module-level list that gives the types of all supported Grid classes. + py::scope().attr("GridTypes") = py::list(); + +- // Specify that py::numeric::array should refer to the Python type numpy.ndarray +- // (rather than the older Numeric.array). +- py::numeric::array::set_module_and_type("numpy", "ndarray"); ++ #if BOOST_VERSION < 106500 ++ // Specify that py::numeric::array should refer to the Python type numpy.ndarray ++ // (rather than the older Numeric.array). ++ py::numeric::array::set_module_and_type("numpy", "ndarray"); ++ #endif + + pyGrid::exportGrid<FloatGrid>(); + #ifdef PY_OPENVDB_WRAP_ALL_GRID_TYPES +diff --git a/openvdb/python/pyGrid.h b/openvdb/python/pyGrid.h +index f1a01d92..0ae36db7 100644 +--- a/openvdb/python/pyGrid.h ++++ b/openvdb/python/pyGrid.h +@@ -81,6 +81,15 @@ using namespace openvdb::OPENVDB_VERSION_NAME; + #pragma clang diagnostic pop + #endif + ++#if BOOST_VERSION < 106500 ++ typedef typename py::numeric::array pyndarray; ++ namespace arrayFunc = boost::python::numeric; ++#else ++ #include <boost/python/numpy.hpp> ++ typedef typename py::numpy::ndarray pyndarray; ++ namespace arrayFunc = boost::python::numpy; ++#endif ++ + + namespace pyopenvdb { + +@@ -820,7 +829,7 @@ class CopyOpBase + + // Extract a reference to (not a copy of) the NumPy array, + // or throw an exception if arrObj is not a NumPy array object. +- const py::numeric::array arrayObj = pyutil::extractArg<py::numeric::array>( ++ const pyndarray arrayObj = pyutil::extractArg<pyndarray>( + arrObj, opName[toGrid], pyutil::GridTraits<GridType>::name(), + /*argIdx=*/1, "numpy.ndarray"); + +@@ -1113,7 +1122,7 @@ struct CopyVecOp<T, T> { + // and sizes from NumPy arrays to STL vectors + template<typename VecT> + inline void +-copyVecArray(py::numeric::array& arrayObj, std::vector<VecT>& vec) ++copyVecArray(pyndarray& arrayObj, std::vector<VecT>& vec) + { + typedef typename VecT::ValueType ValueT; + +@@ -1156,7 +1165,7 @@ meshToLevelSet(py::object pointsObj, py::object trianglesObj, py::object quadsOb + + // Raise a Python exception if the given NumPy array does not have dimensions M x N + // or does not have an integer or floating-point data type. +- static void validate2DNumPyArray(py::numeric::array arrayObj, ++ static void validate2DNumPyArray(pyndarray arrayObj, + const int N, const char* desiredType) + { + PyArrayObject* arrayObjPtr = reinterpret_cast<PyArrayObject*>(arrayObj.ptr()); +@@ -1222,7 +1231,7 @@ meshToLevelSet(py::object pointsObj, py::object trianglesObj, py::object quadsOb + if (!pointsObj.is_none()) { + // Extract a reference to (not a copy of) a NumPy array argument, + // or throw an exception if the argument is not a NumPy array object. +- py::numeric::array arrayObj = extractValueArg<GridType, py::numeric::array>( ++ pyndarray arrayObj = extractValueArg<GridType, pyndarray>( + pointsObj, Local::methodName(), /*argIdx=*/1, "numpy.ndarray"); + + // Throw an exception if the array has the wrong type or dimensions. +@@ -1235,7 +1244,7 @@ meshToLevelSet(py::object pointsObj, py::object trianglesObj, py::object quadsOb + // Extract the list of triangle indices from the arguments to this method. + std::vector<Vec3I> triangles; + if (!trianglesObj.is_none()) { +- py::numeric::array arrayObj = extractValueArg<GridType, py::numeric::array>( ++ ndarrays arrayObj = extractValueArg<GridType, pyndarray>( + trianglesObj, Local::methodName(), /*argIdx=*/2, "numpy.ndarray"); + Local::validate2DNumPyArray(arrayObj, /*N=*/3, /*desiredType=*/"int"); + copyVecArray(arrayObj, triangles); +@@ -1244,7 +1253,7 @@ meshToLevelSet(py::object pointsObj, py::object trianglesObj, py::object quadsOb + // Extract the list of quad indices from the arguments to this method. + std::vector<Vec4I> quads; + if (!quadsObj.is_none()) { +- py::numeric::array arrayObj = extractValueArg<GridType, py::numeric::array>( ++ pyndarray arrayObj = extractValueArg<GridType, pyndarray>( + quadsObj, Local::methodName(), /*argIdx=*/3, "numpy.ndarray"); + Local::validate2DNumPyArray(arrayObj, /*N=*/4, /*desiredType=*/"int"); + copyVecArray(arrayObj, quads); +@@ -1268,7 +1277,7 @@ volumeToQuadMesh(const GridType& grid, py::object isovalueObj) + tools::volumeToMesh(grid, points, quads, isovalue); + + // Copy vertices into an N x 3 NumPy array. +- py::object pointArrayObj = py::numeric::array(py::list(), "float32"); ++ py::object pointArrayObj = arrayFunc::array(py::list(), "float32"); + if (!points.empty()) { + npy_intp dims[2] = { npy_intp(points.size()), 3 }; + // Construct a NumPy array that wraps the point vector. +@@ -1282,7 +1291,7 @@ volumeToQuadMesh(const GridType& grid, py::object isovalueObj) + } + + // Copy face indices into an N x 4 NumPy array. +- py::object quadArrayObj = py::numeric::array(py::list(), "uint32"); ++ py::object quadArrayObj = arrayFunc::array(py::list(), "uint32"); + if (!quads.empty()) { + npy_intp dims[2] = { npy_intp(quads.size()), 4 }; + if (PyArrayObject* arrayObj = reinterpret_cast<PyArrayObject*>( +@@ -1312,7 +1321,7 @@ volumeToMesh(const GridType& grid, py::object isovalueObj, py::object adaptivity + tools::volumeToMesh(grid, points, triangles, quads, isovalue, adaptivity); + + // Copy vertices into an N x 3 NumPy array. +- py::object pointArrayObj = py::numeric::array(py::list(), "float32"); ++ py::object pointArrayObj = arrayFunc::array(py::list(), "float32"); + if (!points.empty()) { + npy_intp dims[2] = { npy_intp(points.size()), 3 }; + // Construct a NumPy array that wraps the point vector. +@@ -1326,7 +1335,7 @@ volumeToMesh(const GridType& grid, py::object isovalueObj, py::object adaptivity + } + + // Copy triangular face indices into an N x 3 NumPy array. +- py::object triangleArrayObj = py::numeric::array(py::list(), "uint32"); ++ py::object triangleArrayObj = arrayFunc::array(py::list(), "uint32"); + if (!triangles.empty()) { + npy_intp dims[2] = { npy_intp(triangles.size()), 3 }; + if (PyArrayObject* arrayObj = reinterpret_cast<PyArrayObject*>( +@@ -1337,7 +1346,7 @@ volumeToMesh(const GridType& grid, py::object isovalueObj, py::object adaptivity + } + + // Copy quadrilateral face indices into an N x 4 NumPy array. +- py::object quadArrayObj = py::numeric::array(py::list(), "uint32"); ++ py::object quadArrayObj = arrayFunc::array(py::list(), "uint32"); + if (!quads.empty()) { + npy_intp dims[2] = { npy_intp(quads.size()), 4 }; + if (PyArrayObject* arrayObj = reinterpret_cast<PyArrayObject*>( Modified: PKGBUILD =================================================================== --- PKGBUILD 2017-09-20 14:04:50 UTC (rev 258893) +++ PKGBUILD 2017-09-20 14:27:11 UTC (rev 258894) @@ -2,18 +2,27 @@ pkgname=openvdb pkgver=4.0.2 -pkgrel=1 +pkgrel=2 pkgdesc='A large suite of tools for the efficient storage and manipulation of sparse volumetric data discretized on three-dimensional grids' url='https://github.com/dreamworksanimation/openvdb' arch=('i686' 'x86_64') license=('MPL') depends=('openexr' 'boost-libs' 'intel-tbb' 'zlib' 'jemalloc' 'blosc') -makedepends=('doxygen' 'boost' 'cmake' 'mesa' 'cppunit' 'glfw-x11' 'glu') +makedepends=('doxygen' 'boost' 'cmake' 'mesa' 'cppunit' 'glfw-x11' 'glu' 'python') optdepends=('glfw: for tools' - 'glu: for tools') -source=("https://github.com/dreamworksanimation/openvdb/archive/v${pkgver}.tar.gz") -sha512sums=('8e3e12583b81f9b9303b309e839c8321c67b67ff8a0e61bb56c87276bf25c0deff22f5a73c7c5b661b8e5df345bfdabfa6b0aea9bf16fce57d9c53a76751c75d') + 'glu: for tools' + 'python: python module') +source=("https://github.com/dreamworksanimation/openvdb/archive/v${pkgver}.tar.gz" + 22d09714f9a6a29c62668b533495ed2afd4251ef.patch) +sha512sums=('8e3e12583b81f9b9303b309e839c8321c67b67ff8a0e61bb56c87276bf25c0deff22f5a73c7c5b661b8e5df345bfdabfa6b0aea9bf16fce57d9c53a76751c75d' + '702f42c33c6d6c9da7a85166823d6bc1e8789f328a2781639fea081f8944d29f785f2ea71419741a63f1177db94db8740dedeb7168fa7b5adb1a0a8cd387b342') +prepare() { + cd "${srcdir}/${pkgname}-${pkgver}" + + patch -Np1 < "${srcdir}/22d09714f9a6a29c62668b533495ed2afd4251ef.patch" +} + build() { cd "${srcdir}/${pkgname}-${pkgver}" @@ -30,7 +39,7 @@ -DOPENEXR_LOCATION=/usr/ \ -DCPPUNIT_LOCATION=/usr/include/cppunit \ -DCMAKE_INSTALL_PREFIX=/usr \ - -DOPENVDB_BUILD_PYTHON_MODULE=OFF \ + -DOPENVDB_BUILD_PYTHON_MODULE=ON \ -DOPENVDB_BUILD_DOCS=ON make
