← Back to team overview

dolfin team mailing list archive

Re: dolfin:error doc string breaks build

 

On Wed, Nov 16, 2011 at 10:37:49AM -0800, Johan Hake wrote:
> On Wednesday November 16 2011 06:16:12 Garth N. Wells wrote:
> > On 16 November 2011 13:13, Anders Logg <logg@xxxxxxxxx> wrote:
> > > On Wed, Nov 16, 2011 at 01:06:41PM +0000, Garth N. Wells wrote:
> > >> On 16 November 2011 12:12, Anders Logg <logg@xxxxxxxxx> wrote:
> > >> > On Wed, Nov 16, 2011 at 01:04:54PM +0100, Anders Logg wrote:
> > >> >> On Wed, Nov 16, 2011 at 10:10:38AM +0000, Garth N. Wells wrote:
> > >> >> > I get
> > >> >> >
> > >> >> > [100%] Built target dolfin
> > >> >> > [100%] Swig source
> > >> >> > /home/garth/code/fenics/dolfin.d/1.0.d/working/dolfin/swig/docstrin
> > >> >> > gs.i:3081: Error: Syntax error in input(1).
> > >> >> > make[2]: *** [dolfin/swig/dolfinPYTHON_wrap.cxx] Error 1
> > >> >> > make[1]: *** [dolfin/swig/CMakeFiles/_cpp.dir/all] Error 2
> > >> >> >
> > >> >> > How was this not picked up by a local build?
> > >> >>
> > >> >> Strange, my branch builds fine here and so does my buildbot:
> > >> >>
> > >> >> http://fenicsproject.org:8082/
> > >> >>
> > >> >> Could it be a merge problem from when Johan merged his changes?
> > >> >
> > >> > The problem was that Johan ran generate.py to regenerate the
> > >> > docstrings and I didn't so the problem never showed up for me or on my
> > >> > buildbot which does not have that changeset.
> > >> >
> > >> > When should we run generate.py?
> > >>
> > >> It should be run when a header file is added or a doc string changes.
> > >> Adding functions or changing function signatures doesn't require
> > >> generate.py to be run.
> > >
> > > Why not? The function signature will be part of the online
> > > documentation and if a new function is added, then the corresponding
> > > docstring must be generated.
>
> AFAIK, generate.py only considers changes in docstrings.
>
> Previously we did include the signature in the docstrings, using:
>
>   %feature("autodoc")
>
> As a matter of fact it is still outcommented in dolfin.i. This feature
> included information about the signature directly in the docstring. However it
> conflicted with some of our typemaps, and it was disabled. However, it was
> never dependent on generate.py.

Check these two lines in generate.py:

  from documentation import generate_docstrings
  generate_docstrings()

It calls generate_docstrings defined in documentation.py, which does
among other things this:

def get_args(signature):
    "Get argument names (for Python) from signature."
#    print "sig: ", signature
    arg_string = signature.split("(")[-1].split(")")[0]
#    print "arg_string: '%s'" % arg_string
    args = []
    if arg_string:
        # This does not handle ',' inside type declaration,
        # e.g. std::pair<uint, uint>.
        # args = [a.split()[-1] for a in arg_string.split(",")]
        for a in arg_string.split(","):
            arg = a.split()[-1]
            # Assuming '::' is never in a name, but always
            # present when dealing with e.g. 'std::pair'
            # or boost::unordered_map.
            if not "::" in arg:
                args.append(arg)

--
Anders


> Johan
>
> > I quote from my email:
> >
> >  "or a doc string changes."
> >
> > The addition of a doc string is a change.
> >
> > Garth
> >
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~dolfin
> > Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~dolfin
> > More help   : https://help.launchpad.net/ListHelp


Follow ups

References