aboutsummaryrefslogtreecommitdiff
path: root/misc/openvdb
diff options
context:
space:
mode:
authorYuri Victorovich <yuri@FreeBSD.org>2020-04-01 20:06:02 +0000
committerYuri Victorovich <yuri@FreeBSD.org>2020-04-01 20:06:02 +0000
commit7f7c0690049260d4eb57ed5c9d9de43113547687 (patch)
treee0665c18e493fe41515af6a65263bc4334a8e8e5 /misc/openvdb
parent26f1775dd3eee18ac616c08f51868b48676af4ac (diff)
downloadports-7f7c0690049260d4eb57ed5c9d9de43113547687.tar.gz
ports-7f7c0690049260d4eb57ed5c9d9de43113547687.zip
misc/openvdb: Replace the dependency on python 2.7 with the default python (currently 3.x)
PR: 244347 Submitted by: VVD <vvd@unislabs.com>
Notes
Notes: svn path=/head/; revision=530238
Diffstat (limited to 'misc/openvdb')
-rw-r--r--misc/openvdb/Makefile2
-rw-r--r--misc/openvdb/files/patch-openvdb_python_pyOpenVDBModule.cc26
2 files changed, 27 insertions, 1 deletions
diff --git a/misc/openvdb/Makefile b/misc/openvdb/Makefile
index 3689f8ff0db0..fa57e3b60451 100644
--- a/misc/openvdb/Makefile
+++ b/misc/openvdb/Makefile
@@ -28,7 +28,7 @@ OPTIONS_DEFINE= PYTHON TOOLS DOCS # TOOLS should be a subpackage
OPTIONS_DEFAULT= PYTHON TOOLS
OPTIONS_SUB= yes
-PYTHON_USES= python:2.7 # 3.6 is broken: https://github.com/AcademySoftwareFoundation/openvdb/issues/427
+PYTHON_USES= python
PYTHON_CMAKE_BOOL= OPENVDB_BUILD_PYTHON_MODULE
PYTHON_CMAKE_ON= -DFREEBSD_PYTHON_VER:STRING=${PYTHON_VER} -DUSE_NUMPY:BOOL=ON
PYTHON_LIB_DEPENDS= ${PY_BOOST}
diff --git a/misc/openvdb/files/patch-openvdb_python_pyOpenVDBModule.cc b/misc/openvdb/files/patch-openvdb_python_pyOpenVDBModule.cc
new file mode 100644
index 000000000000..70c0ef90a862
--- /dev/null
+++ b/misc/openvdb/files/patch-openvdb_python_pyOpenVDBModule.cc
@@ -0,0 +1,26 @@
+--- openvdb/python/pyOpenVDBModule.cc.orig 2019-05-07 20:58:35 UTC
++++ openvdb/python/pyOpenVDBModule.cc
+@@ -320,7 +320,11 @@ struct PointIndexConverter
+ /// @return nullptr if the given Python object is not convertible to the PointIndex.
+ static void* convertible(PyObject* obj)
+ {
++#if PY_MAJOR_VERSION >= 3
++ if (!PyLong_Check(obj)) return nullptr; // not a Python integer
++#else
+ if (!PyInt_Check(obj)) return nullptr; // not a Python integer
++#endif
+ return obj;
+ }
+
+@@ -337,7 +341,11 @@ struct PointIndexConverter
+ // Extract the PointIndex from the python integer
+ PointIndexT* index = static_cast<PointIndexT*>(storage);
+
++#if PY_MAJOR_VERSION >= 3
++ *index = static_cast<IntType>(PyLong_AsLong(obj));
++#else
+ *index = static_cast<IntType>(PyInt_AsLong(obj));
++#endif
+ }
+
+ /// Register both the PointIndex-to-integer and the integer-to-PointIndex converters.