From 4c64f2a0fe6f0a522c9536324817f31430557c8c Mon Sep 17 00:00:00 2001 From: Matthias Volk Date: Mon, 3 Jul 2017 23:57:18 +0200 Subject: [PATCH] Use PYBIND11_MODULE instead of PYBIND11_PLUGIN --- src/mod_core.cpp | 5 ++--- src/mod_dft.cpp | 7 +++---- src/mod_expressions.cpp | 10 ++++------ src/mod_info.cpp | 6 +++--- src/mod_logic.cpp | 9 ++++----- src/mod_pars.cpp | 5 ++--- src/mod_storage.cpp | 9 ++++----- src/mod_utility.cpp | 6 +++--- 8 files changed, 25 insertions(+), 32 deletions(-) diff --git a/src/mod_core.cpp b/src/mod_core.cpp index 1c2485a..b86e04a 100644 --- a/src/mod_core.cpp +++ b/src/mod_core.cpp @@ -6,8 +6,8 @@ #include "core/bisimulation.h" #include "core/input.h" -PYBIND11_PLUGIN(core) { - py::module m("core"); +PYBIND11_MODULE(core, m) { + m.doc() = "core"; #ifdef STORMPY_DISABLE_SIGNATURE_DOC py::options options; @@ -24,5 +24,4 @@ PYBIND11_PLUGIN(core) { define_modelchecking(m); define_bisimulation(m); define_input(m); - return m.ptr(); } diff --git a/src/mod_dft.cpp b/src/mod_dft.cpp index b6a8d41..4d840eb 100644 --- a/src/mod_dft.cpp +++ b/src/mod_dft.cpp @@ -2,14 +2,13 @@ #include "dft/dft.h" -PYBIND11_PLUGIN(dft) { - py::module m("dft", "Functionality for DFT analysis"); +PYBIND11_MODULE(dft, m) { + m.doc() = "Functionality for DFT analysis"; #ifdef STORMPY_DISABLE_SIGNATURE_DOC py::options options; options.disable_function_signatures(); #endif - + define_dft(m); - return m.ptr(); } diff --git a/src/mod_expressions.cpp b/src/mod_expressions.cpp index aad8006..c379cfc 100644 --- a/src/mod_expressions.cpp +++ b/src/mod_expressions.cpp @@ -1,16 +1,16 @@ #include "common.h" #include "storm/storage/expressions/ExpressionManager.h" -PYBIND11_PLUGIN(expressions) { - py::module m("expressions", "Storm expressions"); - +PYBIND11_MODULE(expressions, m) { + m.doc() = "Storm expressions"; + #ifdef STORMPY_DISABLE_SIGNATURE_DOC py::options options; options.disable_function_signatures(); #endif py::class_>(m, "ExpressionManager", "Manages variables for expressions"); - + py::class_(m, "Expression", "Holds an expression") .def("__str__", &storm::expressions::Expression::toString) .def_property_readonly("contains_variables", &storm::expressions::Expression::containsVariables) @@ -18,6 +18,4 @@ PYBIND11_PLUGIN(expressions) { .def_property_readonly("has_integer_type", &storm::expressions::Expression::hasIntegerType) .def_property_readonly("has_rational_type", &storm::expressions::Expression::hasRationalType) ; - - return m.ptr(); } diff --git a/src/mod_info.cpp b/src/mod_info.cpp index 471f528..22ce45f 100644 --- a/src/mod_info.cpp +++ b/src/mod_info.cpp @@ -1,8 +1,9 @@ #include "common.h" #include "storm/utility/storm-version.h" -PYBIND11_PLUGIN(info) { - py::module m("info", "Storm information"); +PYBIND11_MODULE(info, m) { + m.doc() = "Storm information"; + py::class_(m, "Version", "Version information for Storm") // static properties are still called with self as argument (which we ignore), see // https://pybind11.readthedocs.io/en/master/advanced/classes.html#static-properties @@ -10,5 +11,4 @@ PYBIND11_PLUGIN(info) { .def_property_readonly_static("long", [](py::object /* self */){ return storm::utility::StormVersion::longVersionString(); }, "Storm version in long representation") .def_property_readonly_static("build_info", [](py::object /* self */){ return storm::utility::StormVersion::buildInfo(); }, "Build info for Storm") ; - return m.ptr(); } diff --git a/src/mod_logic.cpp b/src/mod_logic.cpp index 881560b..6b1eca6 100644 --- a/src/mod_logic.cpp +++ b/src/mod_logic.cpp @@ -2,14 +2,13 @@ #include "logic/formulae.h" -PYBIND11_PLUGIN(logic) { - py::module m("logic", "Logic module for Storm"); - +PYBIND11_MODULE(logic, m) { + m.doc() = "Logic module for Storm"; + #ifdef STORMPY_DISABLE_SIGNATURE_DOC py::options options; options.disable_function_signatures(); #endif - + define_formulae(m); - return m.ptr(); } diff --git a/src/mod_pars.cpp b/src/mod_pars.cpp index b65de7b..ee28960 100644 --- a/src/mod_pars.cpp +++ b/src/mod_pars.cpp @@ -4,8 +4,8 @@ #include "pars/pla.h" #include "pars/model_instantiator.h" -PYBIND11_PLUGIN(pars) { - py::module m("pars", "Functionality for parametric analysis"); +PYBIND11_MODULE(pars, m) { + m.doc() = "Functionality for parametric analysis"; #ifdef STORMPY_DISABLE_SIGNATURE_DOC py::options options; @@ -15,5 +15,4 @@ PYBIND11_PLUGIN(pars) { define_pars(m); define_pla(m); define_model_instantiator(m); - return m.ptr(); } diff --git a/src/mod_storage.cpp b/src/mod_storage.cpp index ef8903f..fe1d6d9 100644 --- a/src/mod_storage.cpp +++ b/src/mod_storage.cpp @@ -6,18 +6,17 @@ #include "storage/state.h" #include "storage/labeling.h" -PYBIND11_PLUGIN(storage) { - py::module m("storage"); - +PYBIND11_MODULE(storage, m) { + m.doc() = "Data structures in Storm"; + #ifdef STORMPY_DISABLE_SIGNATURE_DOC py::options options; options.disable_function_signatures(); #endif - + define_bitvector(m); define_model(m); define_sparse_matrix(m); define_state(m); define_labeling(m); - return m.ptr(); } diff --git a/src/mod_utility.cpp b/src/mod_utility.cpp index f222c8f..1b6870c 100644 --- a/src/mod_utility.cpp +++ b/src/mod_utility.cpp @@ -2,8 +2,8 @@ #include "utility/shortestPaths.h" -PYBIND11_PLUGIN(utility) { - py::module m("utility", "Dumping ground of stuff that really should be somewhere more reasonable"); +PYBIND11_MODULE(utility, m) { + m.doc() = "Utilities for Storm"; + define_ksp(m); - return m.ptr(); }