From cd8951439ebc396ab4308177216bf9f138e13765 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Tue, 15 Feb 2005 12:10:09 +0000 Subject: [PATCH] More work on Boost.Python. Most tests now pass on Linux. [SVN r27387] --- build/Jamfile.v2 | 61 ++++++----------- example/Jamfile.v2 | 11 ++-- test/Jamfile.v2 | 158 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 182 insertions(+), 48 deletions(-) create mode 100644 test/Jamfile.v2 diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index 5c42a8e1..62074b0d 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -1,67 +1,39 @@ import os ; import modules ; -# Use a very crude way to sense there python is locatted +import python ; - -local PYTHON_PATH = [ modules.peek : PYTHON_PATH ] ; - -if [ GLOB /usr/local/include/python2.2 : * ] -{ - PYTHON_PATH = /usr/local ; -} -else if [ GLOB /usr/include/python2.2 : * ] -{ - PYTHON_PATH = /usr ; -} - -if [ os.name ] in CYGWIN NT -{ - lib_condition = shared: ; - defines = USE_DL_IMPORT ; - - # Declare a target for the python interpreter library - lib python : : python22 $(PYTHON_PATH)/libs ; - PYTHON_LIB = python ; -} -else -{ - lib python : : python2.2 ; - PYTHON_LIB = python ; -} - - - -if $(PYTHON_PATH) { +if [ python.configured ] { project boost/python : source-location ../src - : requirements $(PYTHON_PATH)/include - $(lib_condition)$(PYTHON_PATH)/libs - shared:$(PYTHON_LIB) - $(defines) - : usage-requirements # requirement that will be propageted to *users* of this library - $(PYTHON_PATH)/include + : requirements + #$(PYTHON_PATH)/include + # $(lib_condition)$(PYTHON_PATH)/libs + # shared:$(PYTHON_LIB) + # $(defines) + #: usage-requirements # requirement that will be propageted to *users* of this library + # $(PYTHON_PATH)/include # We have a bug which causes us to conclude that conditionalized # properties in this section are not free. # $(lib_condition)$(PYTHON_PATH)/lib/python2.2/config # true:$(PYTHON_LIB) - $(PYTHON_PATH)/lib/python2.2/config - $(PYTHON_LIB) + # $(PYTHON_PATH)/lib/python2.2/config + # $(PYTHON_LIB) ; lib boost_python : numeric.cpp - list.cpp long.cpp dict.cpp tuple.cpp str.cpp + slice.cpp aix_init_module.cpp converter/from_python.cpp @@ -80,8 +52,15 @@ lib boost_python object/iterator.cpp object_protocol.cpp object_operators.cpp + wrapper.cpp : static:BOOST_PYTHON_STATIC_LIB BOOST_PYTHON_SOURCE + /python//python : shared - ; + ; +} +else +{ + ECHO "warning: Python location is not configured" ; + ECHO "warning: the Boost.Python library won't be built" ; } diff --git a/example/Jamfile.v2 b/example/Jamfile.v2 index 841b4b86..7a9e5b87 100644 --- a/example/Jamfile.v2 +++ b/example/Jamfile.v2 @@ -1,12 +1,9 @@ # This is the Jamfile for Boost.Build v2, which is currently in # prerelease. Ignore this file unless you are a bleading edge sort of # person. -use-project /boost/python : ../build ; -project - : requirements /boost/python//boost_python - ; - -python-extension getting_started1 : getting_started1.cpp : shared ; -python-extension getting_started2 : getting_started2.cpp : shared ; +project : requirements /boost/python//boost_python ; + +python-extension getting_started1 : getting_started1.cpp ; +python-extension getting_started2 : getting_started2.cpp ; diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 new file mode 100644 index 00000000..c7dc3dd3 --- /dev/null +++ b/test/Jamfile.v2 @@ -0,0 +1,158 @@ + +use-project /boost/python : ../build ; + +# A bug in the Win32 intel compilers causes compilation of one of our +# tests to take forever when debug symbols are enabled. This rule +# turns them off when added to the requirements section +#rule turn-off-intel-debug-symbols ( toolset variant : properties * ) +#{ +# if $(NT) && [ MATCH (.*intel.*) : $(toolset) ] +# { +# properties = [ difference $(properties) : on ] off ; +# } +# return $(properties) ; +#} + +rule py-run ( sources * ) +{ + return [ run $(sources) /boost/python//boost_python ] ; +} + +rule py-compile ( sources * ) +{ + return [ compile $(sources) /boost/python//boost_python ] ; +} + +rule py-compile-fail ( sources * ) +{ + return [ compile-fail $(sources) /boost/python//boost_python ] ; +} + + + +#template py-unit-test +# : +# : $(PYTHON_PROPERTIES) BOOST_PYTHON_SUPPRESS_REGISTRY_INITIALIZATION +# [ difference $(PYTHON_PROPERTIES) : BOOST_PYTHON_DYNAMIC_LIB ] BOOST_PYTHON_STATIC_LIB +# ; + + +test-suite python + : + [ run ../test/embedding.cpp ../build//boost_python /python//python ] + +[ +bpl-test crossmod_exception + : crossmod_exception.py crossmod_exception_a.cpp crossmod_exception_b.cpp +] + +[ bpl-test injected ] +[ bpl-test properties ] +[ bpl-test return_arg ] +[ bpl-test staticmethod ] +[ bpl-test shared_ptr ] +[ bpl-test polymorphism ] +[ bpl-test polymorphism2 ] +[ bpl-test auto_ptr ] +[ bpl-test minimal ] +[ bpl-test args ] +[ bpl-test raw_ctor ] +#[ bpl-test numpy ] +[ bpl-test enum ] +[ bpl-test exception_translator ] +[ bpl-test pearu1 : test_cltree.py cltree.cpp ] +[ bpl-test try : newtest.py m1.cpp m2.cpp ] +[ bpl-test const_argument ] +[ bpl-test keywords : keywords.cpp keywords_test.py ] + + +[ python-extension builtin_converters : test_builtin_converters.cpp /boost/python//boost_python ] +[ run-pyd builtin_converters_test : test_builtin_converters.py builtin_converters ] + + [ bpl-test test_pointer_adoption ] + [ bpl-test operators ] + [ bpl-test callbacks ] + [ bpl-test defaults ] + +[ bpl-test object ] +[ bpl-test list ] +[ bpl-test long ] +[ bpl-test dict ] +[ bpl-test tuple ] +[ bpl-test str ] +[ bpl-test slice ] + +[ bpl-test virtual_functions ] +[ bpl-test back_reference ] +[ bpl-test implicit ] +[ bpl-test data_members ] + +[ bpl-test ben_scott1 ] + +[ bpl-test bienstman1 ] +[ bpl-test bienstman2 ] +[ bpl-test bienstman3 ] +# +#[ bpl-test multi_arg_constructor +# : # files +# : # requirements +# turn-off-intel-debug-symbols ] # debug symbols slow the build down too much +# +[ bpl-test iterator : iterator.py iterator.cpp input_iterator.cpp ] + +[ bpl-test extract ] + +[ bpl-test opaque ] + +[ bpl-test pickle1 ] +[ bpl-test pickle2 ] +[ bpl-test pickle3 ] +[ bpl-test pickle4 ] + +[ bpl-test nested ] + +[ bpl-test docstring ] + +[ bpl-test vector_indexing_suite ] + +[ python-extension map_indexing_suite_ext + : map_indexing_suite.cpp int_map_indexing_suite.cpp + /boost/python//boost_python ] +[ run-pyd + map_indexing_suite : map_indexing_suite.py map_indexing_suite_ext ] + +# if $(TEST_BIENSTMAN_NON_BUGS) +# { +# bpl-test bienstman4 ; +# bpl-test bienstman5 ; +# } + +# --- unit tests of library components --- + +[ run indirect_traits_test.cpp ] +[ run destroy_test.cpp ] +[ py-run pointer_type_id_test.cpp ] +[ py-run bases.cpp ] +[ run if_else.cpp ] +[ py-run pointee.cpp ] +[ run result.cpp ] + +[ compile string_literal.cpp ] +[ py-compile borrowed.cpp ] +[ py-compile object_manager.cpp ] +[ py-compile copy_ctor_mutates_rhs.cpp ] + +[ py-run upcast.cpp ] + +[ py-compile select_holder.cpp ] + +[ py-run select_from_python_test.cpp ../src/converter/type_id.cpp ] + + [ py-compile select_arg_to_python_test.cpp ] + +[ py-compile-fail ./raw_pyobject_fail1.cpp ] +[ py-compile-fail ./raw_pyobject_fail2.cpp ] +[ py-compile-fail ./as_to_python_function.cpp ] +[ py-compile-fail ./object_fail1.cpp ] + + ;