diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index dbb16b09..53691502 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -12,6 +12,9 @@ project boost/python : source-location ../src ; +rule cond ( test ? : yes * : no * ) { if $(test) { return $(yes) ; } else { return $(no) ; } } +rule unless ( test ? : yes * : no * ) { if ! $(test) { return $(yes) ; } else { return $(no) ; } } + lib boost_python : # sources numeric.cpp @@ -60,7 +63,12 @@ lib boost_python # python_for_extensions is a target defined by Boost.Build to # provide the Python include paths, and on Windows, the Python # import library, as usage requirements. - /python//python_for_extensions + [ cond [ python.configured ] : /python//python_for_extensions ] + + # we prevent building when there is no python available + # as it's not possible anyway, and to cause dependents to + # fail to build + [ unless [ python.configured ] : no ] : # default build shared diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index a13bfe01..950b0e7c 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -2,12 +2,20 @@ # Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +import python ; + use-project /boost/python : ../build ; project /boost/python/test ; +local PY = ; +if [ python.configured ] +{ + PY = /python//python ; +} + rule py-run ( sources * : input-file ? ) { - return [ run $(sources) /boost/python//boost_python /python//python + return [ run $(sources) /boost/python//boost_python $(PY) : # args : $(input-file) : #requirements @@ -39,7 +47,7 @@ test-suite python : [ - run exec.cpp ../build//boost_python/static /python//python + run exec.cpp ../build//boost_python/static $(PY) : # program args : exec.py : # requirements @@ -183,7 +191,7 @@ bpl-test crossmod_opaque : : : BOOST_PYTHON_STATIC_LIB - /python//python + $(PY) ]