Skip to content

Commit cd89514

Browse files
committed
More work on Boost.Python. Most tests now pass on Linux.
[SVN r27387]
1 parent 0e5e2dc commit cd89514

File tree

3 files changed

+182
-48
lines changed

3 files changed

+182
-48
lines changed

build/Jamfile.v2

Lines changed: 20 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,39 @@
11
import os ;
22
import modules ;
33

4-
# Use a very crude way to sense there python is locatted
4+
import python ;
55

6-
7-
local PYTHON_PATH = [ modules.peek : PYTHON_PATH ] ;
8-
9-
if [ GLOB /usr/local/include/python2.2 : * ]
10-
{
11-
PYTHON_PATH = /usr/local ;
12-
}
13-
else if [ GLOB /usr/include/python2.2 : * ]
14-
{
15-
PYTHON_PATH = /usr ;
16-
}
17-
18-
if [ os.name ] in CYGWIN NT
19-
{
20-
lib_condition = <link>shared: ;
21-
defines = USE_DL_IMPORT ;
22-
23-
# Declare a target for the python interpreter library
24-
lib python : : <name>python22 <search>$(PYTHON_PATH)/libs ;
25-
PYTHON_LIB = python ;
26-
}
27-
else
28-
{
29-
lib python : : <name>python2.2 ;
30-
PYTHON_LIB = python ;
31-
}
32-
33-
34-
35-
if $(PYTHON_PATH) {
6+
if [ python.configured ] {
367

378

389
project boost/python
3910
: source-location ../src
40-
: requirements <include>$(PYTHON_PATH)/include
41-
$(lib_condition)<library-path>$(PYTHON_PATH)/libs
42-
<link>shared:<library>$(PYTHON_LIB)
43-
<define>$(defines)
44-
: usage-requirements # requirement that will be propageted to *users* of this library
45-
<include>$(PYTHON_PATH)/include
11+
: requirements
12+
#<include>$(PYTHON_PATH)/include
13+
# $(lib_condition)<library-path>$(PYTHON_PATH)/libs
14+
# <link>shared:<library>$(PYTHON_LIB)
15+
# <define>$(defines)
16+
#: usage-requirements # requirement that will be propageted to *users* of this library
17+
# <include>$(PYTHON_PATH)/include
4618

4719
# We have a bug which causes us to conclude that conditionalized
4820
# properties in this section are not free.
4921
# $(lib_condition)<library-path>$(PYTHON_PATH)/lib/python2.2/config
5022
# <shared>true:<find-library>$(PYTHON_LIB)
5123

52-
<library-path>$(PYTHON_PATH)/lib/python2.2/config
53-
<library>$(PYTHON_LIB)
24+
# <library-path>$(PYTHON_PATH)/lib/python2.2/config
25+
# <library>$(PYTHON_LIB)
5426
;
5527

5628
lib boost_python
5729
:
5830
numeric.cpp
59-
6031
list.cpp
6132
long.cpp
6233
dict.cpp
6334
tuple.cpp
6435
str.cpp
36+
slice.cpp
6537

6638
aix_init_module.cpp
6739
converter/from_python.cpp
@@ -80,8 +52,15 @@ lib boost_python
8052
object/iterator.cpp
8153
object_protocol.cpp
8254
object_operators.cpp
55+
wrapper.cpp
8356
: <link>static:<define>BOOST_PYTHON_STATIC_LIB
8457
<define>BOOST_PYTHON_SOURCE
58+
<library>/python//python
8559
: <link>shared
86-
;
60+
;
61+
}
62+
else
63+
{
64+
ECHO "warning: Python location is not configured" ;
65+
ECHO "warning: the Boost.Python library won't be built" ;
8766
}

example/Jamfile.v2

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
# This is the Jamfile for Boost.Build v2, which is currently in
22
# prerelease. Ignore this file unless you are a bleading edge sort of
33
# person.
4-
use-project /boost/python : ../build ;
54

6-
project
7-
: requirements <library>/boost/python//boost_python
8-
;
9-
10-
python-extension getting_started1 : getting_started1.cpp : <link>shared ;
11-
python-extension getting_started2 : getting_started2.cpp : <link>shared ;
5+
project : requirements <library>/boost/python//boost_python ;
6+
7+
python-extension getting_started1 : getting_started1.cpp ;
8+
python-extension getting_started2 : getting_started2.cpp ;
129

test/Jamfile.v2

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
2+
use-project /boost/python : ../build ;
3+
4+
# A bug in the Win32 intel compilers causes compilation of one of our
5+
# tests to take forever when debug symbols are enabled. This rule
6+
# turns them off when added to the requirements section
7+
#rule turn-off-intel-debug-symbols ( toolset variant : properties * )
8+
#{
9+
# if $(NT) && [ MATCH (.*intel.*) : $(toolset) ]
10+
# {
11+
# properties = [ difference $(properties) : <debug-symbols>on ] <debug-symbols>off ;
12+
# }
13+
# return $(properties) ;
14+
#}
15+
16+
rule py-run ( sources * )
17+
{
18+
return [ run $(sources) /boost/python//boost_python ] ;
19+
}
20+
21+
rule py-compile ( sources * )
22+
{
23+
return [ compile $(sources) /boost/python//boost_python ] ;
24+
}
25+
26+
rule py-compile-fail ( sources * )
27+
{
28+
return [ compile-fail $(sources) /boost/python//boost_python ] ;
29+
}
30+
31+
32+
33+
#template py-unit-test
34+
# :
35+
# : $(PYTHON_PROPERTIES) <define>BOOST_PYTHON_SUPPRESS_REGISTRY_INITIALIZATION
36+
# [ difference $(PYTHON_PROPERTIES) : <define>BOOST_PYTHON_DYNAMIC_LIB ] <define>BOOST_PYTHON_STATIC_LIB
37+
# ;
38+
39+
40+
test-suite python
41+
:
42+
[ run ../test/embedding.cpp ../build//boost_python /python//python ]
43+
44+
[
45+
bpl-test crossmod_exception
46+
: crossmod_exception.py crossmod_exception_a.cpp crossmod_exception_b.cpp
47+
]
48+
49+
[ bpl-test injected ]
50+
[ bpl-test properties ]
51+
[ bpl-test return_arg ]
52+
[ bpl-test staticmethod ]
53+
[ bpl-test shared_ptr ]
54+
[ bpl-test polymorphism ]
55+
[ bpl-test polymorphism2 ]
56+
[ bpl-test auto_ptr ]
57+
[ bpl-test minimal ]
58+
[ bpl-test args ]
59+
[ bpl-test raw_ctor ]
60+
#[ bpl-test numpy ]
61+
[ bpl-test enum ]
62+
[ bpl-test exception_translator ]
63+
[ bpl-test pearu1 : test_cltree.py cltree.cpp ]
64+
[ bpl-test try : newtest.py m1.cpp m2.cpp ]
65+
[ bpl-test const_argument ]
66+
[ bpl-test keywords : keywords.cpp keywords_test.py ]
67+
68+
69+
[ python-extension builtin_converters : test_builtin_converters.cpp /boost/python//boost_python ]
70+
[ run-pyd builtin_converters_test : test_builtin_converters.py builtin_converters ]
71+
72+
[ bpl-test test_pointer_adoption ]
73+
[ bpl-test operators ]
74+
[ bpl-test callbacks ]
75+
[ bpl-test defaults ]
76+
77+
[ bpl-test object ]
78+
[ bpl-test list ]
79+
[ bpl-test long ]
80+
[ bpl-test dict ]
81+
[ bpl-test tuple ]
82+
[ bpl-test str ]
83+
[ bpl-test slice ]
84+
85+
[ bpl-test virtual_functions ]
86+
[ bpl-test back_reference ]
87+
[ bpl-test implicit ]
88+
[ bpl-test data_members ]
89+
90+
[ bpl-test ben_scott1 ]
91+
92+
[ bpl-test bienstman1 ]
93+
[ bpl-test bienstman2 ]
94+
[ bpl-test bienstman3 ]
95+
#
96+
#[ bpl-test multi_arg_constructor
97+
# : # files
98+
# : # requirements
99+
# turn-off-intel-debug-symbols ] # debug symbols slow the build down too much
100+
#
101+
[ bpl-test iterator : iterator.py iterator.cpp input_iterator.cpp ]
102+
103+
[ bpl-test extract ]
104+
105+
[ bpl-test opaque ]
106+
107+
[ bpl-test pickle1 ]
108+
[ bpl-test pickle2 ]
109+
[ bpl-test pickle3 ]
110+
[ bpl-test pickle4 ]
111+
112+
[ bpl-test nested ]
113+
114+
[ bpl-test docstring ]
115+
116+
[ bpl-test vector_indexing_suite ]
117+
118+
[ python-extension map_indexing_suite_ext
119+
: map_indexing_suite.cpp int_map_indexing_suite.cpp
120+
/boost/python//boost_python ]
121+
[ run-pyd
122+
map_indexing_suite : map_indexing_suite.py map_indexing_suite_ext ]
123+
124+
# if $(TEST_BIENSTMAN_NON_BUGS)
125+
# {
126+
# bpl-test bienstman4 ;
127+
# bpl-test bienstman5 ;
128+
# }
129+
130+
# --- unit tests of library components ---
131+
132+
[ run indirect_traits_test.cpp ]
133+
[ run destroy_test.cpp ]
134+
[ py-run pointer_type_id_test.cpp ]
135+
[ py-run bases.cpp ]
136+
[ run if_else.cpp ]
137+
[ py-run pointee.cpp ]
138+
[ run result.cpp ]
139+
140+
[ compile string_literal.cpp ]
141+
[ py-compile borrowed.cpp ]
142+
[ py-compile object_manager.cpp ]
143+
[ py-compile copy_ctor_mutates_rhs.cpp ]
144+
145+
[ py-run upcast.cpp ]
146+
147+
[ py-compile select_holder.cpp ]
148+
149+
[ py-run select_from_python_test.cpp ../src/converter/type_id.cpp ]
150+
151+
[ py-compile select_arg_to_python_test.cpp ]
152+
153+
[ py-compile-fail ./raw_pyobject_fail1.cpp ]
154+
[ py-compile-fail ./raw_pyobject_fail2.cpp ]
155+
[ py-compile-fail ./as_to_python_function.cpp ]
156+
[ py-compile-fail ./object_fail1.cpp ]
157+
158+
;

0 commit comments

Comments
 (0)