2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-20 16:52:15 +00:00

Compare commits

..

19 Commits

Author SHA1 Message Date
Stefan Seefeld
a383ecdd88 Fix build warning. 2018-03-19 13:58:48 -04:00
Stefan Seefeld
02e079cf4d Merge branch 'develop' 2018-03-08 07:07:42 -05:00
Stefan Seefeld
7c33ff0c59 Merge branch 'develop' 2017-11-17 10:06:54 -05:00
Stefan Seefeld
fc978f085b Merge branch 'develop' 2017-11-11 08:04:54 -05:00
Stefan Seefeld
fed4f0d0f9 Fix version number. 2017-08-19 11:57:56 -04:00
Stefan Seefeld
39edfd45cf Fix traits qualification. 2017-08-19 11:57:39 -04:00
Stefan Seefeld
8c2a808cbe Remove 'numeric' documentation. 2017-07-31 11:38:40 -04:00
Stefan Seefeld
aeedea409a Merge branch 'develop' 2017-07-20 13:04:44 -04:00
Stefan Seefeld
df6926551e Merge branch 'develop' 2017-06-25 18:27:19 -04:00
Stefan Seefeld
7d3df3d3a7 Merge branch 'develop' 2017-03-28 12:57:32 -04:00
Stefan Seefeld
ae747521b0 Merge branch 'develop' 2017-03-24 15:53:30 -04:00
Rene Rivera
5e4b44e0af Don't build numpy if there's no python version to target. 2017-03-06 10:39:01 -06:00
Rene Rivera
07b1489f3b BPL builds targets need to always be defined. 2017-03-05 15:17:26 -06:00
Rene Rivera
44ea0562b2 Fix no pynumpy target when no numpy configured. 2017-03-05 09:00:27 -06:00
Rene Rivera
60fba03e99 Fix libs from referencing BPL when there is no python configured. 2017-03-05 09:00:10 -06:00
Stefan Seefeld
e3c9dd78aa Merge branch 'develop' 2017-03-03 18:07:49 -05:00
Stefan Seefeld
aaf9022770 Merge branch 'develop' 2016-11-02 14:12:45 -04:00
Rene Rivera
88ea1f9626 Fix syntax error caused by merging. 2016-10-10 12:22:25 -05:00
Rene Rivera
731ba745ca Add, and update, documentation build targets. 2016-10-10 12:22:10 -05:00
13 changed files with 75 additions and 87 deletions

View File

@@ -4,7 +4,7 @@ environment:
# /E:ON and /V:ON options are not enabled in the batch script intepreter
# See: http://stackoverflow.com/a/13751649/163740
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\ci\\run_with_env.cmd"
BOOST_PREFIX: C:\Libraries\boost_1_66_0
BOOST_PREFIX: C:\Libraries\boost_1_63_0
matrix:
@@ -18,19 +18,21 @@ environment:
MSVC: "14.0"
ARCH: x86
#- PYTHON: "C:\\Python27-x64"
# PYTHON_VERSION: "2.7.x" # currently 2.7.9
# PYTHON_ARCH: "64"
# ARCH: "x86_64"
#- PYTHON: "C:\\Python35"
# PYTHON_VERSION: "3.5.x" # currently 3.4.3
# PYTHON_ARCH: "32"
- PYTHON: "C:\\Python36-x64"
PYTHON_VERSION: "3.6.x"
PYTHON_ARCH: "64"
MSVC: "12.0"
ARCH: x86_64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
PYTHON: "C:\\Python36-x64"
PYTHON_VERSION: "3.6.x"
PYTHON_ARCH: "64"
MSVC: "14.13.26128"
ARCH: x86_64
install:
# If there is a newer build queued for the same PR, cancel this one.
# The AppVeyor 'rollout builds' option is supposed to serve the same
@@ -45,9 +47,8 @@ install:
- ps: "ls \"C:/\""
- ECHO "Installed libraries:"
- ps: "ls \"C:/Libraries/\""
## This path doesn't exist with the VS 2017 worker images
#- ECHO "Installed SDKs:"
#- ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""
- ECHO "Installed SDKs:"
- ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""
# Install Python (from the official .msi of http://python.org) and pip when
# not already installed.
@@ -71,13 +72,13 @@ install:
# pip will build them from source using the MSVC compiler matching the
# target Python version and architecture
- |
curl -LfsS -o faber.tar.gz https://github.com/stefanseefeld/faber/archive/snapshot/2018-04-08.tar.gz
curl -LfsS -o faber.tar.gz https://github.com/stefanseefeld/faber/archive/snapshot/2018-03-07.tar.gz
tar xf faber.tar.gz
CD faber-snapshot-2018-04-08
CD faber-snapshot-2018-03-07
python setup.py install
CD ..
# report the available MSVC compilers
- faber --info=tools cxx
- python -m faber.tools.msvc
- easy_install sphinx
- pip install numpy

View File

@@ -17,23 +17,20 @@ env:
matrix:
include:
- os: linux
- compiler: gcc
env: CXX=g++ PYTHON=python CXXFLAGS=-std=c++98
- os: linux
- compiler: gcc
env: CXX=g++ PYTHON=python CXXFLAGS=-std=c++11
- os: linux
- compiler: gcc
env: CXX=g++ PYTHON=python3 CXXFLAGS=-std=c++98
- os: linux
- compiler: gcc
env: CXX=g++ PYTHON=python3 CXXFLAGS=-std=c++11
- os: linux
- compiler: clang
env: CXX=clang++ PYTHON=python3 CXXFLAGS=-std=c++98
- os: linux
- compiler: clang
env: CXX=clang++ PYTHON=python3 CXXFLAGS=-std=c++11
- os: osx
env: CXX=clang++ PYTHON=python CXXFLAGS=-std=c++11
- env: PYTHON=python DOC=1
allow_failures:
- os: osx
addons:
apt:
@@ -67,6 +64,7 @@ install:
# Install our own version of Boost (the subset we need) as the system version is
# too old (for C++11 support).
- |
set -e
if [ ! -d $HOME/Boost/tools/boostbook ]; then
echo "rebuilding Boost prerequisites."
wget https://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.tar.gz/download
@@ -83,7 +81,7 @@ install:
echo "using cached Boost prerequisites."
fi
# Install Faber, the build tool.
date=2018-04-08
date=2018-03-07
wget https://github.com/stefanseefeld/faber/archive/snapshot/$date.tar.gz
tar xf $date.tar.gz
pushd faber-snapshot-$date

View File

@@ -2,8 +2,6 @@
# Synopsis
[![Join the chat at https://gitter.im/boostorg/python](https://badges.gitter.im/boostorg/python.svg)](https://gitter.im/boostorg/python?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Welcome to Boost.Python, a C++ library which enables seamless interoperability between C++ and the Python programming language. The library includes support for:
* References and Pointers
@@ -21,8 +19,7 @@ See the [Boost.Python](http://boostorg.github.io/python) documentation for detai
**Hint :** Check out the [development version](http://boostorg.github.io/python/develop) of the documentation to see work in progress.
# Building [![Build Status](https://travis-ci.org/boostorg/python.svg?branch=develop)](https://travis-ci.org/boostorg/python) [![Build status](https://ci.appveyor.com/api/projects/status/cgx9xma6v3gjav92/branch/develop?svg=true)](https://ci.appveyor.com/project/stefanseefeld/python/branch/develop)
# Building ![Build Status](https://travis-ci.org/boostorg/python.svg?branch=develop)
While Boost.Python is part of the Boost C++ Libraries super-project, and thus can be compiled as part of Boost, it can also be compiled and installed stand-alone, i.e. against a pre-installed Boost package.

View File

@@ -30,8 +30,6 @@ else
;
}
if [ python.configured ]
{
project boost/python
: source-location ../src
;
@@ -132,30 +130,3 @@ lib boost_numpy
<link>static:<define>BOOST_NUMPY_STATIC_LIB
<python-debugging>on:<define>BOOST_DEBUG_PYTHON
;
# boost-install creates `stage` and `install` targets
#
# `stage` stages (builds and copies into `stage/lib`) the given libraries
# `boost_python` and `boost_numpy` and their dependencies and is similar
# to issuing `b2 --with-python stage` from top level
#
# `install` installs the two libraries and their dependencies and is similar
# to issuing `b2 --with-python install` from top level
boost-install boost_python boost_numpy ;
}
else
{
# When Python isn't configured, the above `boost-install` is not executed,
# so we create empty `stage` and `install` targets that do nothing but issue
# a warning message unless `--without-python` is given
alias stage : config-warning ;
explicit stage ;
alias install : config-warning ;
explicit install ;
}

View File

@@ -1871,6 +1871,36 @@ This technique has several advantages:
* Minimize the need to recompile
* Rapid prototyping (you can move the code to C++ if required without changing the interface)
You can even add a little syntactic sugar with the use of metaclasses. Let's
create a special metaclass that "injects" methods in other classes.
# The one Boost.Python uses for all wrapped classes.
# You can use here any class exported by Boost instead of "point"
BoostPythonMetaclass = point.__class__
class injector(object):
class __metaclass__(BoostPythonMetaclass):
def __init__(self, name, bases, dict):
for b in bases:
if type(b) not in (self, type):
for k,v in dict.items():
setattr(b,k,v)
return type.__init__(self, name, bases, dict)
# inject some methods in the point foo
class more_point(injector, point):
def __repr__(self):
return 'Point(x=%s, y=%s)' % (self.x, self.y)
def foo(self):
print 'foo!'
Now let's see how it got:
>>> print point()
Point(x=10, y=10)
>>> point().foo()
foo!
Another useful idea is to replace constructors with factory functions:
_point = point

View File

@@ -105,9 +105,7 @@
// Set the name of our library, this will get undef'ed by auto_link.hpp
// once it's done with it:
//
#define _BOOST_PYTHON_CONCAT(N, M, m) N ## M ## m
#define BOOST_PYTHON_CONCAT(N, M, m) _BOOST_PYTHON_CONCAT(N, M, m)
#define BOOST_LIB_NAME BOOST_PYTHON_CONCAT(boost_python, PY_MAJOR_VERSION, PY_MINOR_VERSION)
#define BOOST_LIB_NAME boost_python##PY_MAJOR_VERSION##PY_MINOR_VERSION
//
// If we're importing code from a dll, then tell auto_link.hpp about it:
//
@@ -120,9 +118,6 @@
#include <boost/config/auto_link.hpp>
#endif // auto-linking disabled
#undef BOOST_PYTHON_CONCAT
#undef _BOOST_PYTHON_CONCAT
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
#define BOOST_PYTHON_SUPPORTS_PY_SIGNATURES // enables smooth transition
#endif

View File

@@ -62,9 +62,7 @@
// Set the name of our library, this will get undef'ed by auto_link.hpp
// once it's done with it:
//
#define _BOOST_PYTHON_CONCAT(N, M, m) N ## M ## m
#define BOOST_PYTHON_CONCAT(N, M, m) _BOOST_PYTHON_CONCAT(N, M, m)
#define BOOST_LIB_NAME BOOST_PYTHON_CONCAT(boost_numpy, PY_MAJOR_VERSION, PY_MINOR_VERSION)
#define BOOST_LIB_NAME boost_numpy##PY_MAJOR_VERSION##PY_MINOR_VERSION
//
// If we're importing code from a dll, then tell auto_link.hpp about it:
//
@@ -77,9 +75,6 @@
#include <boost/config/auto_link.hpp>
#endif // auto-linking disabled
#undef BOOST_PYTHON_CONCAT
#undef _BOOST_PYTHON_CONCAT
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#endif // CONFIG_NUMPY20170215_H_

View File

@@ -1,5 +1,5 @@
#ifndef BOOST_PYTHON_OTHER_HPP
# define BOOST_PYTHON_OTHER_HPP
#ifndef OTHER_DWA20020601_HPP
# define OTHER_DWA20020601_HPP
# include <boost/python/detail/prefix.hpp>
// Copyright David Abrahams 2002.
@@ -7,6 +7,8 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
# pragma once
# include <boost/config.hpp>
namespace boost { namespace python {
@@ -49,4 +51,4 @@ namespace detail
}} // namespace boost::python
#endif
#endif // #ifndef OTHER_DWA20020601_HPP

View File

@@ -1,5 +1,5 @@
#ifndef BOOST_PYTHON_PTR_HPP
# define BOOST_PYTHON_PTR_HPP
#ifndef PTR_DWA20020601_HPP
# define PTR_DWA20020601_HPP
# include <boost/python/detail/prefix.hpp>
// Copyright David Abrahams 2002.
@@ -11,6 +11,8 @@
// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2001 Peter Dimov
# pragma once
# include <boost/config.hpp>
# include <boost/mpl/bool.hpp>
@@ -62,4 +64,4 @@ class unwrap_pointer<pointer_wrapper<T> >
}} // namespace boost::python
#endif
#endif // #ifndef PTR_DWA20020601_HPP

View File

@@ -19,7 +19,6 @@ static void wrap_import_array()
static void * wrap_import_array()
{
import_array();
return NULL;
}
#endif

View File

@@ -618,7 +618,7 @@ namespace objects
{
object property(
(python::detail::new_reference)
PyObject_CallFunction((PyObject*)&PyProperty_Type, const_cast<char*>("Osss"), fget.ptr(), (char*)NULL, (char*)NULL, docstr));
PyObject_CallFunction((PyObject*)&PyProperty_Type, const_cast<char*>("Osss"), fget.ptr(), 0, 0, docstr));
this->setattr(name, property);
}
@@ -628,7 +628,7 @@ namespace objects
{
object property(
(python::detail::new_reference)
PyObject_CallFunction((PyObject*)&PyProperty_Type, const_cast<char*>("OOss"), fget.ptr(), fset.ptr(), (char*)NULL, docstr));
PyObject_CallFunction((PyObject*)&PyProperty_Type, const_cast<char*>("OOss"), fget.ptr(), fset.ptr(), 0, docstr));
this->setattr(name, property);
}

View File

@@ -158,6 +158,11 @@ PyObject* function::call(PyObject* args, PyObject* keywords) const
{
// no argument preprocessing
}
else if (n_actual > max_arity)
{
// too many arguments
inner_args = handle<>();
}
else
{
// build a new arg tuple, will adjust its size later

View File

@@ -50,8 +50,6 @@ rule require-windows ( properties * )
}
}
if [ python.configured ]
{
test-suite python
:
@@ -99,16 +97,12 @@ bpl-test crossmod_exception
[ bpl-test polymorphism2_auto_ptr
: polymorphism2_auto_ptr.py polymorphism2.py polymorphism2_auto_ptr.cpp
: [ requires auto_ptr ]
]
[ bpl-test polymorphism ]
[ bpl-test polymorphism2 ]
[ bpl-test auto_ptr
: # files
: [ requires auto_ptr ]
]
[ bpl-test auto_ptr ]
[ bpl-test minimal ]
[ bpl-test args ]
@@ -254,4 +248,3 @@ bpl-test crossmod_opaque
;
}