[ovito] 09/10: Build with the system pybind11

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Fri Jan 13 20:38:28 UTC 2017


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository ovito.

commit e1b2e365c49e9c48b577f43d8b453497d28194ff
Author: Ghislain Antony Vaillant <ghisvail at gmail.com>
Date:   Fri Jan 13 15:48:52 2017 +0000

    Build with the system pybind11
    
    - New patch 0004-Use-system-pybind11.patch
    - Cherry-pick patch 0005-Updated-to-latest-pybind11-version.-Also-fixing-issu.patch
    - Cherry-pick patch 0006-Code-change-required-by-latest-pybind11-version.-Fix.patch
    - d/control: add pybind11-dev to b-deps
    
    Gbp-Dch: full
---
 debian/control                                     |  1 +
 debian/patches/0004-Use-system-pybind11.patch      | 31 ++++++++++
 ...latest-pybind11-version.-Also-fixing-issu.patch | 69 ++++++++++++++++++++++
 ...-required-by-latest-pybind11-version.-Fix.patch | 35 +++++++++++
 debian/patches/series                              |  3 +
 5 files changed, 139 insertions(+)

diff --git a/debian/control b/debian/control
index b1f58ba..e259657 100644
--- a/debian/control
+++ b/debian/control
@@ -28,6 +28,7 @@ Build-Depends: cmake,
                libqwt-qt5-dev,
                libswscale-dev,
                povray,
+               pybind11-dev,
                python-dev,
                python3-sphinx,
                python3-matplotlib,
diff --git a/debian/patches/0004-Use-system-pybind11.patch b/debian/patches/0004-Use-system-pybind11.patch
new file mode 100644
index 0000000..19c304a
--- /dev/null
+++ b/debian/patches/0004-Use-system-pybind11.patch
@@ -0,0 +1,31 @@
+From: Ghislain Antony Vaillant <ghisvail at gmail.com>
+Date: Fri, 13 Jan 2017 15:46:25 +0000
+Subject: Use system pybind11
+
+---
+ src/plugins/pyscript/PyScript.h | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/plugins/pyscript/PyScript.h b/src/plugins/pyscript/PyScript.h
+index 7bc647bb..fd0ba267 100644
+--- a/src/plugins/pyscript/PyScript.h
++++ b/src/plugins/pyscript/PyScript.h
+@@ -33,12 +33,12 @@
+ #endif
+ 
+ // Include pybind11, which is located in our 3rd party source directory.
+-#include <3rdparty/pybind11/pybind11.h>
+-#include <3rdparty/pybind11/eval.h>
+-#include <3rdparty/pybind11/operators.h>
+-#include <3rdparty/pybind11/stl_bind.h>
+-#include <3rdparty/pybind11/stl.h>
+-#include <3rdparty/pybind11/numpy.h>
++#include <pybind11/pybind11.h>
++#include <pybind11/eval.h>
++#include <pybind11/operators.h>
++#include <pybind11/stl_bind.h>
++#include <pybind11/stl.h>
++#include <pybind11/numpy.h>
+ 
+ #ifdef PyScript_EXPORTS		// This is defined by CMake when building the plugin library.
+ #  define OVITO_PYSCRIPT_EXPORT Q_DECL_EXPORT
diff --git a/debian/patches/0005-Updated-to-latest-pybind11-version.-Also-fixing-issu.patch b/debian/patches/0005-Updated-to-latest-pybind11-version.-Also-fixing-issu.patch
new file mode 100644
index 0000000..95bef85
--- /dev/null
+++ b/debian/patches/0005-Updated-to-latest-pybind11-version.-Also-fixing-issu.patch
@@ -0,0 +1,69 @@
+From: Alexander Stukowski <stukowski at mm.tu-darmstadt.de>
+Date: Mon, 9 Jan 2017 22:57:42 +0100
+Subject: Updated to latest pybind11 version. Also fixing issue #5.
+
+---
+ src/plugins/pyscript/binding/AnimationBinding.cpp  | 11 ++++++-----
+ src/plugins/pyscript/binding/FileIOBinding.cpp     |  5 +++--
+ src/plugins/pyscript/python/ovito/anim/__init__.py |  3 ---
+ 3 files changed, 9 insertions(+), 10 deletions(-)
+
+diff --git a/src/plugins/pyscript/binding/AnimationBinding.cpp b/src/plugins/pyscript/binding/AnimationBinding.cpp
+index 28c987a1..110bfe8d 100644
+--- a/src/plugins/pyscript/binding/AnimationBinding.cpp
++++ b/src/plugins/pyscript/binding/AnimationBinding.cpp
+@@ -42,7 +42,7 @@ PYBIND11_PLUGIN(PyScriptAnimation)
+ 
+ 	py::module m("PyScriptAnimation");
+ 
+-	py::object TimeInterval_py = py::class_<TimeInterval>(m, "TimeInterval")
++	py::class_<TimeInterval>(m, "TimeInterval", py::metaclass())
+ 		.def(py::init<>())
+ 		.def(py::init<TimePoint>())
+ 		.def(py::init<TimePoint, TimePoint>())
+@@ -58,13 +58,14 @@ PYBIND11_PLUGIN(PyScriptAnimation)
+ 		.def("intersect", &TimeInterval::intersect)
+ 		.def_static("time_to_seconds", &TimeToSeconds)
+ 		.def_static("seconds_to_time", &TimeFromSeconds)
+-		.def_property_readonly_static("infinite", &TimeInterval::infinite)
+-		.def_property_readonly_static("empty", &TimeInterval::empty)
++		.def_property_readonly_static("infinite", [](py::object /*self*/) { return TimeInterval::infinite(); })
++		.def_property_readonly_static("empty", [](py::object /*self*/) { return TimeInterval::empty(); })
++		.def_property_readonly_static("TimeNegativeInfinity", [](py::object /*self*/) { return TimeNegativeInfinity(); })
++		.def_property_readonly_static("TimePositiveInfinity", [](py::object /*self*/) { return TimePositiveInfinity(); })
++		.def("__str__", [](TimeInterval& iv) { return py::str("({},{})").format(iv.start(), iv.end()); })
+ 		.def(py::self == TimeInterval())
+ 		.def(py::self != TimeInterval())
+ 	;
+-	py::setattr(TimeInterval_py, "TimeNegativeInfinity", py::cast(TimeNegativeInfinity()));
+-	py::setattr(TimeInterval_py, "TimePositiveInfinity", py::cast(TimePositiveInfinity()));
+ 
+ 	ovito_class<AnimationSettings, RefTarget>(m,
+ 			"Stores animation-related settings of the current :py:attr:`~ovito.DataSet`. You can access "
+diff --git a/src/plugins/pyscript/binding/FileIOBinding.cpp b/src/plugins/pyscript/binding/FileIOBinding.cpp
+index 3ebf7321..a19dd391 100644
+--- a/src/plugins/pyscript/binding/FileIOBinding.cpp
++++ b/src/plugins/pyscript/binding/FileIOBinding.cpp
+@@ -57,8 +57,9 @@ PYBIND11_PLUGIN(PyScriptFileIO)
+ 		.value("ResetScene", FileImporter::ResetScene)
+ 	;
+ 
+-	py::class_<FileManager>(m, "FileManager")
+-		.def_property_readonly_static("instance", py::cpp_function(&FileManager::instance, py::return_value_policy::reference))
++	py::class_<FileManager>(m, "FileManager", py::metaclass())
++		.def_property_readonly_static("instance", py::cpp_function(
++			[](py::object /*self*/) { return &FileManager::instance(); }, py::return_value_policy::reference))
+ 		//.def("removeFromCache", &FileManager::removeFromCache)
+ 		//.def("urlFromUserInput", &FileManager::urlFromUserInput)
+ 	;
+diff --git a/src/plugins/pyscript/python/ovito/anim/__init__.py b/src/plugins/pyscript/python/ovito/anim/__init__.py
+index bc25378f..465426bf 100644
+--- a/src/plugins/pyscript/python/ovito/anim/__init__.py
++++ b/src/plugins/pyscript/python/ovito/anim/__init__.py
+@@ -1,5 +1,2 @@
+ # Load the native module.
+ from PyScriptAnimation import *
+-
+-# Add __str__ method to TimeInterval class:
+-TimeInterval.__str__ = lambda self: str((self.start,self.end))
+\ No newline at end of file
diff --git a/debian/patches/0006-Code-change-required-by-latest-pybind11-version.-Fix.patch b/debian/patches/0006-Code-change-required-by-latest-pybind11-version.-Fix.patch
new file mode 100644
index 0000000..ff89c89
--- /dev/null
+++ b/debian/patches/0006-Code-change-required-by-latest-pybind11-version.-Fix.patch
@@ -0,0 +1,35 @@
+From: Alexander Stukowski <stukowski at mm.tu-darmstadt.de>
+Date: Mon, 9 Jan 2017 23:53:04 +0100
+Subject: Code change required by latest pybind11 version. Fixing issue #5.
+
+---
+ src/plugins/particles/resources/python/ovito/data/particles/__init__.py | 2 +-
+ src/plugins/pyscript/binding/PythonBinding.h                            | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/plugins/particles/resources/python/ovito/data/particles/__init__.py b/src/plugins/particles/resources/python/ovito/data/particles/__init__.py
+index c02b314a..c1dcdcda 100644
+--- a/src/plugins/particles/resources/python/ovito/data/particles/__init__.py
++++ b/src/plugins/particles/resources/python/ovito/data/particles/__init__.py
+@@ -380,7 +380,7 @@ class CutoffNeighborFinder(Particles.CutoffNeighborFinder):
+         
+     def __init__(self, cutoff, data_collection):
+         """ This is the constructor. """
+-        super(self.__class__, self).__init__()        
++        super(self.__class__, self).__init__()
+         if not hasattr(data_collection, 'position'):
+             raise KeyError("Data collection does not contain any particles.")
+         if not hasattr(data_collection, 'cell'):
+diff --git a/src/plugins/pyscript/binding/PythonBinding.h b/src/plugins/pyscript/binding/PythonBinding.h
+index 0f8095e2..4f2cb497 100644
+--- a/src/plugins/pyscript/binding/PythonBinding.h
++++ b/src/plugins/pyscript/binding/PythonBinding.h
+@@ -26,7 +26,7 @@
+ #include <plugins/pyscript/engine/ScriptEngine.h>
+ #include <core/utilities/io/FileManager.h>
+ 
+-PYBIND11_DECLARE_HOLDER_TYPE(T, Ovito::OORef<T>);
++PYBIND11_DECLARE_HOLDER_TYPE(T, Ovito::OORef<T>, true);
+ 
+ namespace pybind11 { namespace detail {
+ 
diff --git a/debian/patches/series b/debian/patches/series
index d92b3b4..9d2c0d3 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,6 @@
 0001-Disable-povray-test.patch
 0002-Fixing-issue-3-Test-suite-can-fail-when-executed-in-.patch
 0003-Fixing-issue-4-Tests-that-depend-on-the-CrystalAnaly.patch
+0004-Use-system-pybind11.patch
+0005-Updated-to-latest-pybind11-version.-Also-fixing-issu.patch
+0006-Code-change-required-by-latest-pybind11-version.-Fix.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ovito.git



More information about the debian-science-commits mailing list