Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2008-05-31 05:37:59


On Friday 30 May 2008 23:49:35 Johnny Graettinger wrote:
> Is there a clean way to extract the configured interpreter, libraries, etc
> from the python module?
>
> In particular, I'd like to run some python scripts as a later stage of a
> build process to generate additional targets. Supposing that Jamroot may
> have been configured for some special variant of python, it'd be handy to
> extract the correct interpreter to use, eg:
>
> Way up in Jamroot:
>
> using python : <some version> : <some python root> ;
>
> Way down in a Jamfile:
>
> local py_interp = [ modules.peek python : interpreter ] ;

Well, this will not work, as you can configure several python
versions.

>
> make file.out : file.in : @in2out ;
> actions in2out
> {
> $(py_interp) in2out.py $(<) $(>)
> }
>
> Is there a way to do this? Am I going about it the wrong way altogether?

You can do the following:

        import toolset : flags ;
        flags in2out py_interp : <python.interpreter> ;
        actions in2out
        {
            $(py_interp) in2out.py $(<) $(>)
        }

The python.interpreter is a magic property set by python.init. It was not added by me, so
I cannot provide exact docs on how it works :-), however the above works for me in
in SVN trunk version of Boost.Build.

- Volodya

inside


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