Boost logo

Boost-Build :

Subject: Re: [Boost-build] calling an action
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2016-10-31 10:39:26


AMDG

On 10/31/2016 06:53 AM, Stefan Seefeld wrote:
>
> trying to figure out whether I could use Python callables as actions in
> my Python frontend, I noticed that there was only a tiny bit of glue
> missing in the bjam Python interface to make this work:
> https://github.com/stefanseefeld/boost.build/commit/f9170f47406d0d587b8966ce5b5f30878e96a496
>
> This seems to work fine, at least for the very simple cases I tried. I
> can now register both a command string (e.g. "c++ -o $(<) $(>)") as well
> as a Python function (def func(target, source) print('making...')) with
> my rule.
>
> If I wanted to make my Python action a wrapper that executes the
> previous command string, what would I need to do ? (I need to at least
> do the variable substitution to replace '$(<)' with the list of targets,
> etc., but I'm sure there is more...)
>

  Executing an action at this level just does
variable expansion. It returns the actual
command as a string. The variable to which the
result is written is not accessible from Python.

https://github.com/boostorg/build/blob/develop/src/engine/function.c#L4932

In Christ,
Steven Watanabe


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk