Skip to content

Commit e968329

Browse files
committed
Clean up examples.
1 parent 07c8cbe commit e968329

26 files changed

+115
-328
lines changed

example/Jamroot

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,35 @@
1-
# Copyright David Abrahams 2006. Distributed under the Boost
2-
# Software License, Version 1.0. (See accompanying
3-
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
1+
# Copyright Stefan Seefeld 2016.
2+
# Distributed under the Boost Software License, Version 1.0.
3+
# (See accompanying file LICENSE_1_0.txt or copy at
4+
# http://www.boost.org/LICENSE_1_0.txt)
45

5-
# Specify the path to the Boost project. If you move this project,
6-
# adjust this path to refer to the Boost root directory.
7-
use-project boost
8-
: ../../.. ;
6+
import python ;
97

10-
# Set up the project-wide requirements that everything uses the
11-
# boost_python library from the project whose global ID is
12-
# /boost/python.
13-
project
14-
: requirements <library>/boost/python//boost_python
15-
<implicit-dependency>/boost//headers
16-
: usage-requirements <implicit-dependency>/boost//headers
17-
;
18-
19-
# Declare the three extension modules. You can specify multiple
20-
# source files after the colon separated by spaces.
21-
python-extension getting_started1 : getting_started1.cpp ;
22-
python-extension getting_started2 : getting_started2.cpp ;
23-
python-extension std_pair_ext : std_pair.cpp ;
24-
25-
# A little "rule" (function) to clean up the syntax of declaring tests
26-
# of these extension modules.
27-
local rule run-test ( test-name : sources + )
8+
if ! [ python.configured ]
289
{
29-
import testing ;
30-
testing.make-test run-pyd : $(sources) : : $(test-name) ;
10+
ECHO "warning: no Python configured in user-config.jam" ;
11+
ECHO "warning: will use default configuration" ;
12+
using python ;
3113
}
3214

33-
# Declare test targets
34-
run-test test1 : getting_started1 test_getting_started1.py ;
35-
run-test test2 : getting_started2 test_getting_started2.py ;
36-
run-test test3 : std_pair_ext test_std_pair.py ;
15+
# Adjust the following if Boost.Python isn't installed in a default location
16+
lib boost_python ;
3717

38-
# A target that runs all the tests
39-
alias test : test1 test2 test3 ;
18+
project
19+
: requirements
20+
# <include>/path/to/boost/python
21+
<library>boost_python
22+
;
4023

41-
# Only run tests when explicitly requested
42-
explicit test test1 test2 test3 ;
24+
rule run-test ( test-name : sources + )
25+
{
26+
import testing ;
27+
testing.make-test run-pyd : $(sources) : : $(test-name) ;
28+
}
4329

30+
build-project quickstart ;
31+
build-project tutorial ;
32+
if [ python.numpy ]
33+
{
34+
build-project numpy ;
35+
}

example/README

Lines changed: 0 additions & 16 deletions
This file was deleted.

example/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
![logo](https://raw.githubusercontent.com/boostorg/python/develop/doc/images/bpl.png)
2+
3+
# Examples
4+
5+
This directory contains various examples using Boost.Python.
6+
You may compile these using the `bjam` command either in this directory
7+
or in any of the subdirectories.
8+
You may need to adjust the paths in the Jamroot file if Boost.Python
9+
is not installed in a default location.
10+
See http://boostorg.github.io/python/doc/html/building/no_install_quickstart.html
11+
for details.

example/boost-build.jam

Lines changed: 0 additions & 7 deletions
This file was deleted.

example/getting_started1.cpp

Lines changed: 0 additions & 25 deletions
This file was deleted.

example/getting_started2.cpp

Lines changed: 0 additions & 41 deletions
This file was deleted.

example/numpy/Jamfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright Stefan Seefeld 2016.
2+
# Distributed under the Boost Software License, Version 1.0.
3+
# (See accompanying file LICENSE_1_0.txt or copy at
4+
# http://www.boost.org/LICENSE_1_0.txt)
5+
6+
import python ;
7+
8+
# Adjust the following if Boost.Python isn't installed in a default location
9+
lib boost_numpy
10+
:
11+
: <search>/usr/local/Boost/lib
12+
<include>/usr/local/Boost/include
13+
;
14+
15+
project numpy
16+
: requirements
17+
<include>/usr/local/Boost/include
18+
<library>boost_numpy
19+
<location>.
20+
;
21+
22+
exe simple : simple.cpp boost_numpy /python//python ;
23+
exe dtype : dtype.cpp boost_numpy /python//python ;
24+
exe ndarray : ndarray.cpp /python//python ;
25+
exe fromdata : fromdata.cpp /python//python ;
26+
exe ufunc : ufunc.cpp /python//python ;
27+
exe wrap : wrap.cpp /python//python ;
28+
29+
python-extension gaussian : gaussian.cpp ;

example/numpy/dtype.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
*
1313
*/
1414

15-
#include <boost/numpy.hpp>
15+
#include <boost/python/numpy.hpp>
1616
#include <iostream>
1717

1818
namespace p = boost::python;
19-
namespace np = boost::numpy;
19+
namespace np = boost::python::numpy;
2020

2121
int main(int argc, char **argv)
2222
{

example/numpy/fromdata.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
* manipulate data in either Python or C++ and have the changes reflected in both.
99
*/
1010

11-
#include <boost/numpy.hpp>
11+
#include <boost/python/numpy.hpp>
1212
#include <iostream>
1313

1414
namespace p = boost::python;
15-
namespace np = boost::numpy;
15+
namespace np = boost::python::numpy;
1616

1717

1818
int main(int argc, char **argv)

example/numpy/gaussian.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// (See accompanying file LICENSE_1_0.txt or copy at
44
// http://www.boost.org/LICENSE_1_0.txt)
55

6-
#include <boost/numpy.hpp>
6+
#include <boost/python/numpy.hpp>
77

88
#include <cmath>
99
#include <memory>
@@ -14,7 +14,7 @@ const double M_PI = boost::math::constants::pi<double>();
1414
#endif
1515

1616
namespace bp = boost::python;
17-
namespace bn = boost::numpy;
17+
namespace bn = boost::python::numpy;
1818

1919
/**
2020
* A 2x2 matrix class, purely for demonstration purposes.

0 commit comments

Comments
 (0)