humanoid-path-planner / hpp-fcl

An extension of the Flexible Collision Library
Other
323 stars 91 forks source link

Documentation generation issues in Python 3 #175

Closed nim65s closed 4 years ago

nim65s commented 4 years ago

Hi,

On my computer, in python 3, headers inbuild/python/doxygen_autodoc/ are filled with ill-generated strings, eg.:


inline const char* member_func_doc ( hpp::fcl::ConvexBase * (*function_ptr) (const hpp::fcl::Vec3f *, int, bool, const char *))
{
  if (function_ptr == static_cast< hpp::fcl::ConvexBase * (*) (const hpp::fcl::Vec3f *, int, bool, const char *)>(&hpp::fcl::ConvexBase::convexHull))
    return "b'Build a convex hull based on Qhull library and store the vertices and optionally the triangles. \\n"\n"\\n"\n"\\n"\n"Param\\n"\n"  - points, num_points the points whose convex hull should be computed. \\n"\n"  - keepTriangles if true, returns a Convex<Triangle> object which contains the triangle of the shape. \\n"\n"  - qhullCommand the command sent to qhull.\\n"\n"- if keepTriangles is true, this parameter should include \\"Qt\\". If NULL, \\"Qt\\" is passed to Qhull.\\n"\n"- if keepTriangles is false, an empty string is passed to Qhull. \\n"\n"\\n"\n"\\n"\n"\\n"\n"Note: hpp-fcl must have been compiled with option HPP_FCL_HAS_QHULL set to ON. '";
  return "";
}

(please note the \\n"\n"\\n"\n"\\n"\n"\\n"\n" chains, which are generating compilation errors) In python 2, the generated files look good.

This commit fix the build for me in python 3 while not breaking python 2: https://github.com/nim65s/hpp-fcl/commit/86e0391dee384a294993c7210291b9c1748b61c8

The CI looks good: https://gitlab.laas.fr/humanoid-path-planner/hpp-fcl/pipelines/9761 But I suspect that this is because the CI doesn't have lxml, so this is generation is turned off in the CMake.

What should we do about that ? Apply this commit ? (I need to redo it without my autoformatting changes) Maybe this .decode() should be apply before, and we shouldn't have had those bytes strings in the first place ?

For me, this is blocking the next release.

nim65s commented 4 years ago

I also plan to add lxml to the dependencies in robotpkg, to get all the generated documentation.

nim65s commented 4 years ago

Also on this topic, @MaximilienNaveau pinged us with https://github.com/machines-in-motion/tuto_sphinx_doxygen

I think his goal is to generate a sphinx documentation website from the C++ docstrings, while the goal of doc/python/doxygen_xml_parser.py is to embed the C++ docstrings into the __doc__ attributes of the generated python bindings, but it might be worth taking a look at the tools used on both side.

jmirabel commented 4 years ago

I add the issue yesterday: e2814e5

nim65s commented 4 years ago

This looks better than my solution, thanks. Can we add this in devel ?