|
Boost : |
Subject: Re: [boost] [python] run python script from bjam
From: lcaminiti (lorcaminiti_at_[hidden])
Date: 2012-06-03 11:20:08
Dave Abrahams wrote
>
> on Fri May 25 2012, lcaminiti <lorcaminiti-AT-gmail.com> wrote:
>
>> Hello all,
>>
>> I build a Boost.Python module and install it using bjam as follow:
>>
>> python-extension pydef : deduced_params_pydef.cpp
>> : <library>/boost/python//boost_python
>> <library>/boost/regex//boost_regex
>> <link>shared:<define>BOOST_REGEX_DYN_LINK=1
>> ;
>> install pydef_install : pydef
>> : <install-dependencies>on
>> <install-type>SHARED_LIB
>> <install-type>PYTHON_EXTENSION
>> <location>.
>> ;
>>
>> I the same dir I have a python script deduced_params_pydef.py which will
>> import the module and test it.
>>
>> How do I run the python script automatically from bjam so to fully
>> compile
>> and test the module that my code generates?
>>
>> Something like (this doesn't work of course):
>>
>> # Make sure pydef target is built first, then runs python
>> deduced_params_pydef.py
>> run-py pydef_install : deduced_params_pydef.py ;
>
> Take a look at Boost.Python's own tests; that should give you everything
> you need.
>
Yes, I figured it out. Boost.Python used bpl-test (or a rule named like
that) but I ended up using
type.register UNIT_TEST_RAW : UNIT_TEST ;
generators.register-standard testing.unit-test : : UNIT_TEST_RAW ;
rule py-test ( name : pyscript : commandline )
{
unit-test-raw $(name) : $(pyscript) :
<testing.launcher>"python "$(pyscript)" "$(commandline) ;
always $(name) ;
}
This worked better for what I needed to do.
Thanks.
--Lorenzo
-- View this message in context: http://boost.2283326.n4.nabble.com/boost-python-run-python-script-from-bjam-tp4630494p4630856.html Sent from the Boost - Dev mailing list archive at Nabble.com.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk