------------------------------------------------------------ revno: 1989 committer: Václav Šmilauer <eudo...@arcig.cz> branch nick: trunk timestamp: Sun 2010-01-24 10:21:49 +0100 message: 1. Fix python docstring options for boost <=1.35 (hopefully) added: lib/pyutil/doc_opts.hpp modified: lib/serialization/Serializable.hpp py/_utils.cpp py/yadeWrapper/yadeWrapper.cpp
-- lp:yade https://code.launchpad.net/~yade-dev/yade/trunk Your team Yade developers is subscribed to branch lp:yade. To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription.
=== added file 'lib/pyutil/doc_opts.hpp' --- lib/pyutil/doc_opts.hpp 1970-01-01 00:00:00 +0000 +++ lib/pyutil/doc_opts.hpp 2010-01-24 09:21:49 +0000 @@ -0,0 +1,11 @@ +#pragma once +#include<boost/version.hpp> + +// macro to set the same docstring generation options in all modules +// disable_cpp_signatures apparently appeared after 1.35 or 1.34 +#if BOOST_VERSION<103600 + #define YADE_SET_DOCSTRING_OPTS python::docstring_options docopt; docopt.enable_all(); +#else + #define YADE_SET_DOCSTRING_OPTS python::docstring_options docopt; docopt.enable_all(); docopt.disable_cpp_signatures(); +#endif + === modified file 'lib/serialization/Serializable.hpp' --- lib/serialization/Serializable.hpp 2010-01-22 21:07:37 +0000 +++ lib/serialization/Serializable.hpp 2010-01-24 09:21:49 +0000 @@ -30,6 +30,7 @@ #include<iostream> #include<yade/lib-factory/Factorable.hpp> #include<yade/lib-pyutil/raw_constructor.hpp> +#include<yade/lib-pyutil/doc_opts.hpp> #include"SerializationExceptions.hpp" #include"Archive.hpp" @@ -90,7 +91,7 @@ #define YADE_CLASS_BASE_DOC_ATTRS_PY(thisClass,baseClass,docString,attrs,extras) \ REGISTER_ATTRIBUTES(baseClass,BOOST_PP_SEQ_FOR_EACH(_STRIPDOC,~,attrs)) \ REGISTER_CLASS_AND_BASE(thisClass,baseClass) \ - virtual void pyRegisterClass(python::object _scope) const { if(getClassName()!=#thisClass) return; boost::python::scope thisScope(_scope); boost::python::docstring_options docopt; docopt.enable_all(); docopt.disable_cpp_signatures(); boost::python::class_<thisClass,shared_ptr<thisClass>,boost::python::bases<baseClass>,boost::noncopyable>(#thisClass,docString).def("__init__",python::raw_constructor(Serializable_ctor_kwAttrs<thisClass>)).def("clone",&Serializable_clone<thisClass>,python::arg("attrs")=python::dict()) BOOST_PP_SEQ_FOR_EACH(_PYATTR_DEF,thisClass,attrs) extras ; } + virtual void pyRegisterClass(python::object _scope) const { if(getClassName()!=#thisClass) return; boost::python::scope thisScope(_scope); YADE_SET_DOCSTRING_OPTS; boost::python::class_<thisClass,shared_ptr<thisClass>,boost::python::bases<baseClass>,boost::noncopyable>(#thisClass,docString).def("__init__",python::raw_constructor(Serializable_ctor_kwAttrs<thisClass>)).def("clone",&Serializable_clone<thisClass>,python::arg("attrs")=python::dict()) BOOST_PP_SEQ_FOR_EACH(_PYATTR_DEF,thisClass,attrs) extras ; } #define YADE_CLASS_BASE_DOC_ATTRS(thisClass,baseClass,docString,attrs) \ YADE_CLASS_BASE_DOC_ATTRS_PY(thisClass,baseClass,docString,attrs,) === modified file 'py/_utils.cpp' --- py/_utils.cpp 2010-01-22 21:07:37 +0000 +++ py/_utils.cpp 2010-01-24 09:21:49 +0000 @@ -9,6 +9,7 @@ #include<yade/pkg-common/Sphere.hpp> #include<yade/pkg-common/NormShearPhys.hpp> #include<yade/lib-computational-geometry/Hull2d.hpp> +#include<yade/lib-pyutil/doc_opts.hpp> #include<cmath> #include<yade/pkg-dem/ViscoelasticPM.hpp> @@ -422,7 +423,8 @@ // http://numpy.scipy.org/numpydoc/numpy-13.html mentions this must be done in module init, otherwise we will crash import_array(); - python::docstring_options docopt; docopt.enable_all(); docopt.disable_cpp_signatures(); + YADE_SET_DOCSTRING_OPTS; + def("PWaveTimeStep",PWaveTimeStep,"Get timestep accoring to the velocity of P-Wave propagation; computed from sphere radii, rigidities and masses."); def("aabbExtrema",aabbExtrema,aabbExtrema_overloads(args("cutoff","centers"),"Return coordinates of box enclosing all bodies\n centers: do not take sphere radii in account, only their centroids (default=False)\n cutoff: 0-1 number by which the box will be scaled around its center (default=0)")); === modified file 'py/yadeWrapper/yadeWrapper.cpp' --- py/yadeWrapper/yadeWrapper.cpp 2010-01-23 15:40:06 +0000 +++ py/yadeWrapper/yadeWrapper.cpp 2010-01-24 09:21:49 +0000 @@ -27,6 +27,7 @@ #include<yade/lib-serialization-xml/XMLFormatManager.hpp> #include<yade/lib-pyutil/gil.hpp> #include<yade/lib-pyutil/raw_constructor.hpp> +#include<yade/lib-pyutil/doc_opts.hpp> #include<yade/core/Omega.hpp> #include<yade/core/ThreadRunner.hpp> #include<yade/core/FileGenerator.hpp> @@ -509,7 +510,7 @@ { python::scope().attr("__doc__")="Wrapper for c++ internals of yade."; - python::docstring_options docopt; docopt.enable_all(); docopt.disable_cpp_signatures(); + YADE_SET_DOCSTRING_OPTS; python::class_<pyOmega>("Omega") .add_property("iter",&pyOmega::iter,"Get current step number")
_______________________________________________ Mailing list: https://launchpad.net/~yade-dev Post to : yade-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp