mirror of
https://github.com/boostorg/python.git
synced 2026-01-31 08:22:18 +00:00
merging current boost/python and libs/python from trunk into release branch
[SVN r63937]
This commit is contained in:
@@ -14,14 +14,20 @@ if ! [ python.configured ] && ! ( --without-python in [ modules.peek : ARGV ] )
|
||||
# Attempt default configuration of python
|
||||
import toolset : using ;
|
||||
using python ;
|
||||
|
||||
if ! [ python.configured ]
|
||||
{
|
||||
ECHO "WARNING: No python installation configured and autoconfiguration" ;
|
||||
ECHO " failed. See http://www.boost.org/libs/python/doc/building.html" ;
|
||||
ECHO " for configuration instructions or pass --without-python to" ;
|
||||
ECHO " suppress this message and silently skip all Boost.Python targets" ;
|
||||
}
|
||||
}
|
||||
|
||||
if [ python.configured ] || ( --without-python in [ modules.peek : ARGV ] )
|
||||
{
|
||||
alias config-warning ;
|
||||
}
|
||||
else
|
||||
{
|
||||
message config-warning
|
||||
: "warning: No python installation configured and autoconfiguration"
|
||||
: "note: failed. See http://www.boost.org/libs/python/doc/building.html"
|
||||
: "note: for configuration instructions or pass --without-python to"
|
||||
: "note: suppress this message and silently skip all Boost.Python targets"
|
||||
;
|
||||
}
|
||||
|
||||
rule find-py3-version
|
||||
@@ -122,6 +128,7 @@ rule lib_boost_python ( is-py3 ? )
|
||||
# as it's not possible anyway, and to cause dependents to
|
||||
# fail to build
|
||||
[ unless [ python.configured ] : <build>no ]
|
||||
<dependency>config-warning
|
||||
|
||||
<python-debugging>on:<define>BOOST_DEBUG_PYTHON
|
||||
[ cond $(is-py3) : <python>$(py3-version) ]
|
||||
|
||||
@@ -122,9 +122,30 @@ BOOST_PYTHON_TO_INT(short)
|
||||
BOOST_PYTHON_TO_INT(int)
|
||||
BOOST_PYTHON_TO_INT(long)
|
||||
|
||||
// using Python's macro instead of Boost's - we don't seem to get the
|
||||
// config right all the time.
|
||||
# ifdef HAVE_LONG_LONG
|
||||
# if defined(_MSC_VER) && defined(_WIN64)
|
||||
/* Under 64-bit Windows std::size_t is "unsigned long long". To avoid
|
||||
getting a Python long for each std::size_t the value is checked before
|
||||
the conversion. A std::size_t is converted to a simple Python int
|
||||
if possible; a Python long appears only if the value is too small or
|
||||
too large to fit into a simple int. */
|
||||
BOOST_PYTHON_TO_PYTHON_BY_VALUE(
|
||||
signed BOOST_PYTHON_LONG_LONG,
|
||||
( x < static_cast<signed BOOST_PYTHON_LONG_LONG>(
|
||||
(std::numeric_limits<long>::min)())
|
||||
|| x > static_cast<signed BOOST_PYTHON_LONG_LONG>(
|
||||
(std::numeric_limits<long>::max)()))
|
||||
? ::PyLong_FromLongLong(x)
|
||||
: ::PyInt_FromLong(static_cast<long>(x)), &PyInt_Type)
|
||||
BOOST_PYTHON_TO_PYTHON_BY_VALUE(
|
||||
unsigned BOOST_PYTHON_LONG_LONG,
|
||||
x > static_cast<unsigned BOOST_PYTHON_LONG_LONG>(
|
||||
(std::numeric_limits<long>::max)())
|
||||
? ::PyLong_FromUnsignedLongLong(x)
|
||||
: ::PyInt_FromLong(static_cast<long>(x)), &PyInt_Type)
|
||||
//
|
||||
# elif defined(HAVE_LONG_LONG) // using Python's macro instead of Boost's
|
||||
// - we don't seem to get the config right
|
||||
// all the time.
|
||||
BOOST_PYTHON_TO_PYTHON_BY_VALUE(signed BOOST_PYTHON_LONG_LONG, ::PyLong_FromLongLong(x), &PyLong_Type)
|
||||
BOOST_PYTHON_TO_PYTHON_BY_VALUE(unsigned BOOST_PYTHON_LONG_LONG, ::PyLong_FromUnsignedLongLong(x), &PyLong_Type)
|
||||
# endif
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace registry
|
||||
BOOST_PYTHON_DECL void insert(to_python_function_t, type_info, PyTypeObject const* (*to_python_target_type)() = 0);
|
||||
|
||||
// Insert an lvalue from_python converter
|
||||
BOOST_PYTHON_DECL void insert(void* (*convert)(PyObject*), type_info, PyTypeObject const* (*expected_pytype)() = 0);
|
||||
BOOST_PYTHON_DECL void insert(convertible_function, type_info, PyTypeObject const* (*expected_pytype)() = 0);
|
||||
|
||||
// Insert an rvalue from_python converter
|
||||
BOOST_PYTHON_DECL void insert(
|
||||
|
||||
@@ -18,7 +18,7 @@ template <class ExceptionType, class Translate>
|
||||
void register_exception_translator(Translate translate, boost::type<ExceptionType>* = 0)
|
||||
{
|
||||
detail::register_exception_handler(
|
||||
bind<bool>(detail::translate_exception<ExceptionType,Translate>(), _1, _2, translate)
|
||||
boost::bind<bool>(detail::translate_exception<ExceptionType,Translate>(), _1, _2, translate)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
# define MODULE_INIT_DWA20020722_HPP
|
||||
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/stringize.hpp>
|
||||
|
||||
# ifndef BOOST_PYTHON_MODULE_INIT
|
||||
|
||||
@@ -18,41 +20,41 @@ BOOST_PYTHON_DECL PyObject* init_module(char const* name, void(*)());
|
||||
# if PY_VERSION_HEX >= 0x03000000
|
||||
|
||||
# define _BOOST_PYTHON_MODULE_INIT(name) \
|
||||
PyObject* PyInit_##name() \
|
||||
PyObject* BOOST_PP_CAT (PyInit_,name)() \
|
||||
{ \
|
||||
return boost::python::detail::init_module( \
|
||||
#name,&init_module_##name); \
|
||||
BOOST_PP_STRINGIZE(name),&BOOST_PP_CAT(init_module_,name)); \
|
||||
} \
|
||||
void init_module_##name()
|
||||
void BOOST_PP_CAT(init_module_,name)()
|
||||
|
||||
# else
|
||||
|
||||
# define _BOOST_PYTHON_MODULE_INIT(name) \
|
||||
void init##name() \
|
||||
void BOOST_PP_CAT(init,name)() \
|
||||
{ \
|
||||
boost::python::detail::init_module( \
|
||||
#name,&init_module_##name); \
|
||||
BOOST_PP_STRINGIZE(name),&BOOST_PP_CAT(init_module_,name)); \
|
||||
} \
|
||||
void init_module_##name()
|
||||
void BOOST_PP_CAT(init_module_,name)()
|
||||
|
||||
# endif
|
||||
|
||||
# if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(BOOST_PYTHON_STATIC_MODULE)
|
||||
|
||||
# define BOOST_PYTHON_MODULE_INIT(name) \
|
||||
void init_module_##name(); \
|
||||
void BOOST_PP_CAT(init_module_,name)(); \
|
||||
extern "C" __declspec(dllexport) _BOOST_PYTHON_MODULE_INIT(name)
|
||||
|
||||
# elif BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY
|
||||
|
||||
# define BOOST_PYTHON_MODULE_INIT(name) \
|
||||
void init_module_##name(); \
|
||||
void BOOST_PP_CAT(init_module_,name)(); \
|
||||
extern "C" __attribute__ ((visibility("default"))) _BOOST_PYTHON_MODULE_INIT(name)
|
||||
|
||||
# else
|
||||
|
||||
# define BOOST_PYTHON_MODULE_INIT(name) \
|
||||
void init_module_##name(); \
|
||||
void BOOST_PP_CAT(init_module_,name)(); \
|
||||
extern "C" _BOOST_PYTHON_MODULE_INIT(name)
|
||||
|
||||
# endif
|
||||
|
||||
@@ -10,10 +10,7 @@
|
||||
# include <boost/python/converter/registered.hpp>
|
||||
# include <boost/python/detail/decref_guard.hpp>
|
||||
# include <boost/python/detail/none.hpp>
|
||||
# include <boost/type_traits/is_class.hpp>
|
||||
# include <boost/type_traits/is_union.hpp>
|
||||
# include <boost/mpl/assert.hpp>
|
||||
# include <boost/mpl/or.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace objects {
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ namespace registry
|
||||
}
|
||||
|
||||
// Insert an rvalue from_python converter
|
||||
void insert(void* (*convertible)(PyObject*)
|
||||
void insert(convertible_function convertible
|
||||
, constructor_function construct
|
||||
, type_info key
|
||||
, PyTypeObject const* (*exp_pytype)())
|
||||
@@ -261,7 +261,7 @@ namespace registry
|
||||
}
|
||||
|
||||
// Insert an rvalue from_python converter
|
||||
void push_back(void* (*convertible)(PyObject*)
|
||||
void push_back(convertible_function convertible
|
||||
, constructor_function construct
|
||||
, type_info key
|
||||
, PyTypeObject const* (*exp_pytype)())
|
||||
|
||||
@@ -37,6 +37,13 @@ rule py-compile-fail ( sources * )
|
||||
return [ compile-fail $(sources) /boost/python//boost_python ] ;
|
||||
}
|
||||
|
||||
rule require-windows ( properties * )
|
||||
{
|
||||
if ! <target-os>windows in $(properties)
|
||||
{
|
||||
return <build>no ;
|
||||
}
|
||||
}
|
||||
|
||||
test-suite python
|
||||
:
|
||||
@@ -184,10 +191,8 @@ bpl-test crossmod_opaque
|
||||
# bpl-test bienstman5 ;
|
||||
# }
|
||||
|
||||
# XXX disabled on release branch only,
|
||||
# XXX to avoid failures on platforms other than Windows
|
||||
# [ bpl-test calling_conventions ]
|
||||
# [ bpl-test calling_conventions_mf ]
|
||||
[ bpl-test calling_conventions : : <conditional>@require-windows ]
|
||||
[ bpl-test calling_conventions_mf : : <conditional>@require-windows ]
|
||||
|
||||
# --- unit tests of library components ---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user