the Fink project is an effort to port
popular Unix programs to Mac OS X
Package: boost1.33
Version: 1.33.1
Revision: 1013
License: BSD
Distribution: 10.4, 10.5
Depends: %N-shlibs (= %v-%r)
Conflicts: boost1.31, boost1.32, boost1.32-py23, boost1.32-py24, boost1.32.python, boost1.34.nopython, boost1.34.python23, boost1.34.python24, boost1.34.python25, boost1.35.nopython, boost1.35.python23, boost1.35.python24, boost1.35.python25, boost1.35.python26, boost1.35.python27, boost1.41.cmake, boost1.46.1.cmake
Replaces: boost1.31, boost1.32, boost1.32-py23, boost1.32-py24, boost1.32.python, boost1.34.nopython, boost1.34.python23, boost1.34.python24, boost1.34.python25, boost1.35.nopython, boost1.35.python23, boost1.35.python24, boost1.35.python25, boost1.35.python26, boost1.35.python27, boost1.41.cmake, boost1.46.1.cmake
BuildDepends: boost-jam, fink (>= 0.24.12-1), python
BuildDependsOnly: True
Source: mirror:sourceforge:boost/boost_1_33_1.tar.gz
SourceDirectory: boost_1_33_1
Source-MD5: a0be7261bfdc8a6c98a25f964766c7a5
PatchFile: %{ni}.patch
PatchFile-MD5: 041b193141ebd3ab18b8730ab0efdce0
GCC: 4.0
CompileScript: <<
#!/bin/sh -ex
# build with the python version that %p/bin/python points to
PV=`%p/bin/python -c 'import sys; print sys.version[0:3]'`
bjam -sTOOLS=darwin -sPYTHON_ROOT=%p -sPYTHON_VERSION=$PV -sBUILD="debug release" --prefix=%p
<<
InstallScript: <<
#!/bin/sh -ev
# On some systems, we need -sPYTHON_VERSION once more
PV=`%p/bin/python -c 'import sys; print sys.version[0:3]'`
bjam -sTOOLS=darwin -sPYTHON_ROOT=%p -sPYTHON_VERSION=$PV --prefix=%i install
ln -s boost-1_33_1/boost %i/include/boost
for LIB in date_time filesystem iostreams prg_exec_monitor program_options \
regex signals test_exec_monitor thread unit_test_framework python \
serialization wserialization;
do
ln -s libboost_${LIB}-1_33_1.dylib %i/lib/libboost_${LIB}.dylib
ln -s libboost_${LIB}-d-1_33_1.dylib %i/lib/libboost_${LIB}-d.dylib
done
<<
Splitoff: <<
Package: %N-shlibs
Replaces: %N (<< 1.33.1-1011)
Files: <<
lib/libboost_date_time-1_33_1.dylib
lib/libboost_date_time-d-1_33_1.dylib
lib/libboost_filesystem-1_33_1.dylib
lib/libboost_filesystem-d-1_33_1.dylib
lib/libboost_iostreams-1_33_1.dylib
lib/libboost_iostreams-d-1_33_1.dylib
lib/libboost_prg_exec_monitor-1_33_1.dylib
lib/libboost_prg_exec_monitor-d-1_33_1.dylib
lib/libboost_program_options-1_33_1.dylib
lib/libboost_program_options-d-1_33_1.dylib
lib/libboost_regex-1_33_1.dylib
lib/libboost_regex-d-1_33_1.dylib
lib/libboost_signals-1_33_1.dylib
lib/libboost_signals-d-1_33_1.dylib
lib/libboost_test_exec_monitor-1_33_1.dylib
lib/libboost_test_exec_monitor-d-1_33_1.dylib
lib/libboost_thread-1_33_1.dylib
lib/libboost_thread-d-1_33_1.dylib
lib/libboost_unit_test_framework-1_33_1.dylib
lib/libboost_unit_test_framework-d-1_33_1.dylib
lib/libboost_python-1_33_1.dylib
lib/libboost_python-d-1_33_1.dylib
lib/libboost_serialization-1_33_1.dylib
lib/libboost_serialization-d-1_33_1.dylib
lib/libboost_wserialization-1_33_1.dylib
lib/libboost_wserialization-d-1_33_1.dylib
<<
Shlibs: <<
%p/lib/libboost_date_time-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_date_time-d-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_filesystem-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_filesystem-d-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_iostreams-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1011)
%p/lib/libboost_iostreams-d-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1011)
%p/lib/libboost_prg_exec_monitor-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_prg_exec_monitor-d-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_program_options-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_program_options-d-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_regex-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_regex-d-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_signals-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_signals-d-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_test_exec_monitor-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_test_exec_monitor-d-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_thread-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_thread-d-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_unit_test_framework-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_unit_test_framework-d-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_python-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_python-d-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_serialization-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_serialization-d-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_wserialization-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
%p/lib/libboost_wserialization-d-1_33_1.dylib 1.33.1 %n (>= 1.33.1-1)
<<
DocFiles: LICENSE_1_0.txt README
Description: Boost C++ Shared Library Files
<<
DocFiles: LICENSE_1_0.txt README
Description: Portable Peer-review C++ Source Libraries
DescDetail: <<
The Boost web site provides free peer-reviewed portable C++ source
libraries. The emphasis is on libraries which work well with the
C++ Standard Library. The libraries are intended to be widely useful,
and are in regular use by thousands of programmers across a broad
spectrum of applications.
A further goal is to establish "existing practice" and provide
reference implementations so that Boost libraries are suitable for
eventual standardization. Ten Boost libraries will be included in
the C++ Standards Committee's upcoming C++ Standard Library Technical
Report as a step toward becoming part of a future C++ Standard.
Although Boost was begun by members of the C++ Standards Committee
Library Working Group, participation has expanded to include thousands
of programmers from the C++ community at large.
<<
DescPort: <<
Jamfile - Created internal global variable for lib install directory
so that proper install_names for dylib is possible
libs/python/build/Jamfile
- added "-undefined dynamic_lookup" to linkflags
libs/test/build/Jamfile - corrected dylib linkflags
tools/build/v1/boost-base.jam
- removed toolset and version tags from filenames
tools/build/v1/gcc-tools.jam
- corrected gcc-link-action so that proper install_name and
file versioning of dylibs occurs
Uses Fink's python for building, any version from 2.3 to 2.5.
This needed some convincing, since the build system now really
badly wants python on darwin in framework form.
The resulting libboost_python is essentially independent of
the python version, so that we don't need pyXX variants.
Python2.5 compatibility is achieved through patches that are
mainly from boost CVS.
Previous revisions used the system Python framework
for building, but this did not allow to use libboost_python.dylib
with other versions of python.
<<
DescPackaging: Previous versions by Mark Treiber
Maintainer: Martin Costabel
Homepage: http://www.boost.org
diff -ur boost_1_33_1_ori/Jamfile boost_1_33_1/Jamfile
--- boost_1_33_1_ori/Jamfile 2005-11-08 05:39:45.000000000 +0100
+++ boost_1_33_1/Jamfile 2006-04-06 11:41:39.000000000 +0200
@@ -122,6 +122,7 @@
# object code libraries
local lib-locate = [ MATCH "^--libdir=(.*)" : $(ARGV) ] ;
lib-locate ?= $(exec-locate)/lib ;
+gLIB_INSTALL_DIR ?= $(lib-locate) ;
# where to build
local all-locate = [ MATCH "^--builddir=(.*)" : $(ARGV) ] ;
diff -ur boost_1_33_1_ori/libs/python/build/Jamfile boost_1_33_1/libs/python/build/Jamfile
--- boost_1_33_1_ori/libs/python/build/Jamfile 2005-05-20 22:12:29.000000000 +0200
+++ boost_1_33_1/libs/python/build/Jamfile 2006-04-06 11:41:39.000000000 +0200
@@ -62,7 +62,7 @@
$(bpl-linkflags)
-
+
;
diff -ur boost_1_33_1_ori/libs/test/build/Jamfile boost_1_33_1/libs/test/build/Jamfile
--- boost_1_33_1_ori/libs/test/build/Jamfile 2005-08-23 04:19:44.000000000 +0200
+++ boost_1_33_1/libs/test/build/Jamfile 2006-04-06 11:41:39.000000000 +0200
@@ -75,13 +75,16 @@
if $(TEST_DLLs)
{
dll boost_prg_exec_monitor : boost_test_lib
- ../src/$(PRG_EXEC_MON_SOURCES).cpp ;
+ ../src/$(PRG_EXEC_MON_SOURCES).cpp
+ :
dll boost_test_exec_monitor : boost_test_lib
- ../src/$(TEST_EXEC_MON_SOURCES).cpp ;
+ ../src/$(TEST_EXEC_MON_SOURCES).cpp
+ :
dll boost_unit_test_framework : boost_test_lib
- ../src/$(UTF_SOURCES).cpp ;
+ ../src/$(UTF_SOURCES).cpp
+ :
}
install test lib
diff -ur boost_1_33_1_ori/tools/build/v1/boost-base.jam boost_1_33_1/tools/build/v1/boost-base.jam
--- boost_1_33_1_ori/tools/build/v1/boost-base.jam 2005-10-20 00:34:04.000000000 +0200
+++ boost_1_33_1/tools/build/v1/boost-base.jam 2006-04-06 14:35:06.000000000 +0200
@@ -2618,7 +2618,6 @@
if
local runtime-tag = ;
- if
if
if [ MATCH .*(debug-python).* : $(variant) ] { runtime-tag += y ; }
else { if [ MATCH .*(debug).* : $(variant) ] { runtime-tag += d ; } }
diff -ur boost_1_33_1_ori/tools/build/v1/darwin-tools.jam boost_1_33_1/tools/build/v1/darwin-tools.jam
--- boost_1_33_1_ori/tools/build/v1/darwin-tools.jam 2005-05-11 08:15:20.000000000 +0200
+++ boost_1_33_1/tools/build/v1/darwin-tools.jam 2006-04-06 14:42:45.000000000 +0200
@@ -187,7 +187,7 @@
&& \
$(.GCC_BIN_DIR)$(.GXX) $(LINKFLAGS) -o "$(<[1])" "$(<[1]:S=.lo)" \
- -F$(FRAMEWORKS:D) -framework$(_)$(FRAMEWORKS:D=) \
- -L"$(LIBPATH:T)" -L"$(STDLIBPATH:T)" "$(NEEDLIBS)" "$(NEEDLIBS)" -l$(FINDLIBS) -dynamiclib -install_name "$(<[1]:D=:S=.dylib)" \
+ -L"$(LIBPATH:T)" -L"$(STDLIBPATH:T)" "$(NEEDLIBS)" "$(NEEDLIBS)" -l$(FINDLIBS) -dynamiclib \
+ -install_name "$(<[1]:D=$(gLIB_INSTALL_DIR):S=.dylib)" -compatibility_version $(DLLVERSION) -current_version $(DLLVERSION) \
&& \
rm -f "$(<[1]:S=.lo)"
}
--- boost_1_33_1/tools/build/v1/python.jam~ 2005-10-26 05:30:41.000000000 +0200
+++ boost_1_33_1/tools/build/v1/python.jam 2006-07-20 14:17:09.000000000 +0200
@@ -76,7 +76,7 @@
if $(OS) = MACOSX
{
- PYTHON_EMBEDDED_LIBRARY = ;
+ PYTHON_EMBEDDED_LIBRARY = python$(PYTHON_VERSION) ;
}
else if $(OS) = SOLARIS
{
--- boost_1_33_1/tools/build/v1/gcc-tools.jam~ 2005-11-19 20:21:16.000000000 +0100
+++ boost_1_33_1/tools/build/v1/gcc-tools.jam 2006-07-20 14:40:58.000000000 +0200
@@ -120,8 +120,8 @@
# MacOS X, doesn't need any threading options set
# -lpthread is linked to by default.
# There is no gcc/g++, we need to use cc/c++ instead:
- .GCC ?= cc ;
- .GXX ?= c++ ;
+ #.GCC ?= cc ;
+ #.GXX ?= c++ ;
}
case *BSD :
{
@@ -362,7 +362,17 @@
}
else
{
- flags gcc LINKFLAGS
+ switch $(JAMUNAME)
+ {
+ case Darwin :
+ {
+ flags gcc LINKFLAGS
+ }
+ case * :
+ {
+ flags gcc LINKFLAGS
+ }
+ }
}
flags gcc LIBPATH
Index: ./boost/python/docstring_options.hpp
===================================================================
RCS file: ./boost/python/docstring_options.hpp
diff -N ./boost/python/docstring_options.hpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ boost_1_33_1/boost/python/docstring_options.hpp 12 Oct 2006 06:41:18 -0000 1.3
@@ -0,0 +1,76 @@
+// Copyright Ralf W. Grosse-Kunstleve 2006.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+#ifndef DOCSTRING_OPTIONS_RWGK20060111_HPP
+# define DOCSTRING_OPTIONS_RWGK20060111_HPP
+
+#include
+
+namespace boost { namespace python {
+
+// Note: the static data members are defined in object/function.cpp
+
+class BOOST_PYTHON_DECL docstring_options : boost::noncopyable
+{
+ public:
+ docstring_options(bool show_all=true)
+ {
+ previous_show_user_defined_ = show_user_defined_;
+ previous_show_signatures_ = show_signatures_;
+ show_user_defined_ = show_all;
+ show_signatures_ = show_all;
+ }
+
+ docstring_options(bool show_user_defined, bool show_signatures)
+ {
+ previous_show_user_defined_ = show_user_defined_;
+ previous_show_signatures_ = show_signatures_;
+ show_user_defined_ = show_user_defined;
+ show_signatures_ = show_signatures;
+ }
+
+ ~docstring_options()
+ {
+ show_user_defined_ = previous_show_user_defined_;
+ show_signatures_ = previous_show_signatures_;
+ }
+
+ void
+ disable_user_defined() { show_user_defined_ = false; }
+
+ void
+ enable_user_defined() { show_user_defined_ = true; }
+
+ void
+ disable_signatures() { show_signatures_ = false; }
+
+ void
+ enable_signatures() { show_signatures_ = true; }
+
+ void
+ disable_all()
+ {
+ show_user_defined_ = false;
+ show_signatures_ = false;
+ }
+
+ void
+ enable_all()
+ {
+ show_user_defined_ = true;
+ show_signatures_ = true;
+ }
+
+ friend struct objects::function;
+
+ private:
+ static volatile bool show_user_defined_;
+ static volatile bool show_signatures_;
+ bool previous_show_user_defined_;
+ bool previous_show_signatures_;
+};
+
+}} // namespace boost::python
+
+#endif // DOCSTRING_OPTIONS_RWGK20060111_HPP
Index: boost/python/detail/api_placeholder.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/python/detail/api_placeholder.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -w -u -r1.4 -r1.5
--- boost/python/detail/api_placeholder.hpp 26 Jul 2004 00:32:07 -0000 1.4
+++ boost_1_33_1/boost/python/detail/api_placeholder.hpp 12 Jan 2006 21:33:01 -0000 1.5
@@ -2,17 +2,14 @@
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
+
+// DEPRECATED HEADER (2006 Jan 12)
+// Provided only for backward compatibility.
+// The boost::python::len() function is now defined in object.hpp.
+
#ifndef BOOST_PYTHON_API_PLACE_HOLDER_HPP
#define BOOST_PYTHON_API_PLACE_HOLDER_HPP
-namespace boost { namespace python {
-
- inline long len(object const& obj)
- {
- long result = PyObject_Length(obj.ptr());
- if (PyErr_Occurred()) throw_error_already_set();
- return result;
- }
-}} // namespace boost::python
+#include
#endif // BOOST_PYTHON_API_PLACE_HOLDER_HPP
Index: boost/python/object/function.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/python/object/function.hpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -w -u -r1.20 -r1.21
--- boost/python/object/function.hpp 26 Jul 2004 00:32:07 -0000 1.20
+++ boost_1_33_1/boost/python/object/function.hpp 12 Jan 2006 00:32:04 -0000 1.21
@@ -40,6 +40,8 @@
object const& name() const;
private: // helper functions
+ object signature(bool show_return_type=false) const;
+ object signatures(bool show_return_type=false) const;
void argument_error(PyObject* args, PyObject* keywords) const;
void add_overload(handle
Index: boost/python/list.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/python/list.hpp,v
retrieving revision 1.13
retrieving revision 1.15
diff -u -b -w -u -r1.13 -r1.15
--- boost/python/list.hpp 26 Jul 2004 00:32:05 -0000 1.13
+++ boost_1_33_1/boost/python/list.hpp 26 Sep 2006 00:25:06 -0000 1.15
@@ -9,6 +9,7 @@
# include
# include
+# include
namespace boost { namespace python {
@@ -24,11 +25,11 @@
long index(object_cref value) const; // return index of first occurrence of value
- void insert(int index, object_cref); // insert object before index
+ void insert(ssize_t index, object_cref); // insert object before index
void insert(object const& index, object_cref);
object pop(); // remove and return item at index (default last)
- object pop(long index);
+ object pop(ssize_t index);
object pop(object const& index);
void remove(object_cref value); // remove first occurrence of value
@@ -86,7 +87,7 @@
}
template
- void insert(int index, T const& x) // insert object before index
+ void insert(ssize_t index, T const& x) // insert object before index
{
base::insert(index, object(x));
}
@@ -98,7 +99,7 @@
}
object pop() { return base::pop(); }
- object pop(long index) { return base::pop(index); }
+ object pop(ssize_t index) { return base::pop(index); }
template
object pop(T const& index)
Index: boost/python/object.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/python/object.hpp,v
retrieving revision 1.9
retrieving revision 1.12
diff -u -b -w -u -r1.9 -r1.12
--- boost/python/object.hpp 26 Jul 2004 00:32:05 -0000 1.9
+++ boost_1_33_1/boost/python/object.hpp 26 Sep 2006 00:25:06 -0000 1.12
@@ -5,7 +5,7 @@
#ifndef OBJECT_DWA2002612_HPP
# define OBJECT_DWA2002612_HPP
-# include
+# include
# include
# include
# include
@@ -13,4 +13,15 @@
# include
# include
+namespace boost { namespace python {
+
+ inline ssize_t len(object const& obj)
+ {
+ ssize_t result = PyObject_Length(obj.ptr());
+ if (PyErr_Occurred()) throw_error_already_set();
+ return result;
+ }
+
+}} // namespace boost::python
+
#endif // OBJECT_DWA2002612_HPP
Index: boost/python/converter/builtin_converters.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/python/converter/builtin_converters.hpp,v
retrieving revision 1.25
retrieving revision 1.28
diff -u -b -w -u -r1.25 -r1.28
--- boost/python/converter/builtin_converters.hpp 8 Sep 2004 19:18:57 -0000 1.25
+++ boost_1_33_1/boost/python/converter/builtin_converters.hpp 26 Sep 2006 00:25:06 -0000 1.28
@@ -7,6 +7,7 @@
# include
# include
# include
+# include
# include
# include
# include
@@ -115,9 +116,9 @@
BOOST_PYTHON_TO_PYTHON_BY_VALUE(char, converter::do_return_to_python(x))
BOOST_PYTHON_TO_PYTHON_BY_VALUE(char const*, converter::do_return_to_python(x))
-BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::string, ::PyString_FromStringAndSize(x.data(),implicit_cast
-# ifndef BOOST_NO_STD_WSTRING
-BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::wstring, ::PyUnicode_FromWideChar(x.data(),implicit_cast
+BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::string, ::PyString_FromStringAndSize(x.data(),implicit_cast
+#if defined(Py_USING_UNICODE) && !defined(BOOST_NO_STD_WSTRING)
+BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::wstring, ::PyUnicode_FromWideChar(x.data(),implicit_cast
# endif
BOOST_PYTHON_TO_PYTHON_BY_VALUE(float, ::PyFloat_FromDouble(x))
BOOST_PYTHON_TO_PYTHON_BY_VALUE(double, ::PyFloat_FromDouble(x))
Index: libs/python/src/list.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/python/src/list.cpp,v
retrieving revision 1.8
retrieving revision 1.10
diff -u -b -w -u -r1.8 -r1.10
--- libs/python/src/list.cpp 26 Jul 2004 00:32:11 -0000 1.8
+++ boost_1_33_1/libs/python/src/list.cpp 26 Sep 2006 00:25:07 -0000 1.10
@@ -3,6 +3,7 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include
+#include
namespace boost { namespace python { namespace detail {
@@ -53,7 +54,7 @@
return result;
}
-void list_base::insert(int index, object_cref item)
+void list_base::insert(ssize_t index, object_cref item)
{
if (PyList_CheckExact(this->ptr()))
{
@@ -79,7 +80,7 @@
return this->attr("pop")();
}
-object list_base::pop(long index)
+object list_base::pop(ssize_t index)
{
return this->pop(object(index));
}
Index: libs/python/src/object_protocol.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/python/src/object_protocol.cpp,v
retrieving revision 1.7
retrieving revision 1.9
diff -u -b -w -u -r1.7 -r1.9
--- libs/python/src/object_protocol.cpp 26 Jul 2004 00:32:11 -0000 1.7
+++ boost_1_33_1/libs/python/src/object_protocol.cpp 26 Sep 2006 00:25:07 -0000 1.9
@@ -6,6 +6,7 @@
#include
#include
#include
+#include
namespace boost { namespace python { namespace api {
@@ -106,7 +107,7 @@
PySequenceMethods *sq = tp->tp_as_sequence;
if (sq && sq->sq_slice && ISINT(v) && ISINT(w)) {
- int ilow = 0, ihigh = INT_MAX;
+ ssize_t ilow = 0, ihigh = ssize_t_max;
if (!_PyEval_SliceIndex(v, &ilow))
return NULL;
if (!_PyEval_SliceIndex(w, &ihigh))
@@ -133,7 +134,7 @@
PySequenceMethods *sq = tp->tp_as_sequence;
if (sq && sq->sq_slice && ISINT(v) && ISINT(w)) {
- int ilow = 0, ihigh = INT_MAX;
+ ssize_t ilow = 0, ihigh = ssize_t_max;
if (!_PyEval_SliceIndex(v, &ilow))
return -1;
if (!_PyEval_SliceIndex(w, &ihigh))
Index: libs/python/src/str.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/python/src/str.cpp,v
retrieving revision 1.10
retrieving revision 1.12
diff -u -b -w -u -r1.10 -r1.12
--- libs/python/src/str.cpp 10 Aug 2004 14:59:58 -0000 1.10
+++ boost_1_33_1/libs/python/src/str.cpp 26 Sep 2006 00:25:07 -0000 1.12
@@ -3,6 +3,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include
#include
+#include
namespace boost { namespace python { namespace detail {
@@ -21,10 +22,25 @@
: object(detail::new_reference(::PyString_FromString(s)))
{}
+namespace {
+
+ ssize_t str_size_as_py_ssize_t(std::size_t n)
+ {
+ if (n > ssize_t_max)
+ {
+ throw std::range_error("str size > ssize_t_max");
+ }
+ return static_cast
+ }
+
+} // namespace
+
str_base::str_base(char const* start, char const* finish)
: object(
detail::new_reference(
- ::PyString_FromStringAndSize(start, finish - start)
+ ::PyString_FromStringAndSize(
+ start, str_size_as_py_ssize_t(finish - start)
+ )
)
)
{}
@@ -32,7 +48,9 @@
str_base::str_base(char const* start, std::size_t length) // new str
: object(
detail::new_reference(
- ::PyString_FromStringAndSize(start, length)
+ ::PyString_FromStringAndSize(
+ start, str_size_as_py_ssize_t(length)
+ )
)
)
{}
Index: libs/python/src/object/class.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/python/src/object/class.cpp,v
retrieving revision 1.66
retrieving revision 1.70
diff -u -b -w -u -r1.66 -r1.70
--- libs/python/src/object/class.cpp 16 May 2005 03:31:12 -0000 1.66
+++ boost_1_33_1/libs/python/src/object/class.cpp 26 Sep 2006 00:25:07 -0000 1.70
@@ -20,6 +20,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -69,7 +70,7 @@
} propertyobject;
static PyObject *
- static_data_descr_get(PyObject *self, PyObject *obj, PyObject * /*type*/)
+ static_data_descr_get(PyObject *self, PyObject * /*obj*/, PyObject * /*type*/)
{
propertyobject *gs = (propertyobject *)self;
@@ -77,7 +78,7 @@
}
static int
- static_data_descr_set(PyObject *self, PyObject *obj, PyObject *value)
+ static_data_descr_set(PyObject *self, PyObject * /*obj*/, PyObject *value)
{
propertyobject *gs = (propertyobject *)self;
PyObject *func, *res;
@@ -147,6 +148,14 @@
0, // filled in with type_new /* tp_new */
0, // filled in with __PyObject_GC_Del /* tp_free */
(inquiry)type_is_gc, /* tp_is_gc */
+ 0, /* tp_bases */
+ 0, /* tp_mro */
+ 0, /* tp_cache */
+ 0, /* tp_subclasses */
+ 0, /* tp_weaklist */
+#if PYTHON_API_VERSION >= 1012
+ 0 /* tp_del */
+#endif
};
namespace objects
@@ -243,6 +252,14 @@
0, // filled in with type_new /* tp_new */
0, // filled in with __PyObject_GC_Del /* tp_free */
(inquiry)type_is_gc, /* tp_is_gc */
+ 0, /* tp_bases */
+ 0, /* tp_mro */
+ 0, /* tp_cache */
+ 0, /* tp_subclasses */
+ 0, /* tp_weaklist */
+#if PYTHON_API_VERSION >= 1012
+ 0 /* tp_del */
+#endif
};
// Install the instance data for a C++ object into a Python instance
@@ -295,7 +312,7 @@
}
static PyObject *
- instance_new(PyTypeObject* type_, PyObject* args, PyObject *kw)
+ instance_new(PyTypeObject* type_, PyObject* /*args*/, PyObject* /*kw*/)
{
// Attempt to find the __instance_size__ attribute. If not present, no problem.
PyObject* d = type_->tp_dict;
@@ -340,14 +357,14 @@
static PyGetSetDef instance_getsets[] = {
- {"__dict__", instance_get_dict, instance_set_dict, NULL},
- {0}
+ {"__dict__", instance_get_dict, instance_set_dict, NULL, 0},
+ {0, 0, 0, 0, 0}
};
static PyMemberDef instance_members[] = {
- {"__weakref__", T_OBJECT, offsetof(instance<>, weakrefs), 0},
- {0}
+ {"__weakref__", T_OBJECT, offsetof(instance<>, weakrefs), 0, 0},
+ {0, 0, 0, 0, 0}
};
static PyTypeObject class_type_object = {
@@ -390,7 +407,17 @@
offsetof(instance<>,dict), /* tp_dictoffset */
0, /* tp_init */
PyType_GenericAlloc, /* tp_alloc */
- instance_new /* tp_new */
+ instance_new, /* tp_new */
+ 0, /* tp_free */
+ 0, /* tp_is_gc */
+ 0, /* tp_bases */
+ 0, /* tp_mro */
+ 0, /* tp_cache */
+ 0, /* tp_subclasses */
+ 0, /* tp_weaklist */
+#if PYTHON_API_VERSION >= 1012
+ 0 /* tp_del */
+#endif
};
BOOST_PYTHON_DECL type_handle class_type()
@@ -480,13 +507,14 @@
// were declared, we'll use our class_type() as the single base
// class.
std::size_t const num_bases = (std::max)(num_types - 1, static_cast
- handle<> bases(PyTuple_New(num_bases));
+ assert(num_bases <= ssize_t_max);
+ handle<> bases(PyTuple_New(static_cast
for (std::size_t i = 1; i <= num_bases; ++i)
{
type_handle c = (i >= num_types) ? class_type() : get_class(types[i]);
// PyTuple_SET_ITEM steals this reference
- PyTuple_SET_ITEM(bases.get(), i - 1, upcast
+ PyTuple_SET_ITEM(bases.get(), static_cast
}
// Call the class metatype to create a new class
@@ -504,6 +532,10 @@
if (scope().ptr() != Py_None)
scope().attr(name) = result;
+ // For pickle. Will lead to informative error messages if pickling
+ // is not enabled.
+ result.attr("__reduce__") = object(make_instance_reduce_function());
+
return result;
}
}
@@ -601,7 +633,6 @@
void class_base::enable_pickling_(bool getstate_manages_dict)
{
- setattr("__reduce__", object(make_instance_reduce_function()));
setattr("__safe_for_unpickling__", object(true));
if (getstate_manages_dict)
Index: libs/python/src/object/function.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/python/src/object/function.cpp,v
retrieving revision 1.42
retrieving revision 1.50
diff -u -b -w -u -r1.42 -r1.50
--- libs/python/src/object/function.cpp 12 Mar 2005 02:58:42 -0000 1.42
+++ boost_1_33_1/libs/python/src/object/function.cpp 26 Sep 2006 00:25:07 -0000 1.50
@@ -3,7 +3,7 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#include
+#include
#include
#include
#include
@@ -14,8 +14,8 @@
#include
#include
#include
+#include
-#include
#include
#include
@@ -28,6 +28,11 @@
# include
#endif
+namespace boost { namespace python {
+ volatile bool docstring_options::show_user_defined_ = true;
+ volatile bool docstring_options::show_signatures_ = true;
+}}
+
namespace boost { namespace python { namespace objects {
py_function_impl_base::~py_function_impl_base()
@@ -60,7 +65,7 @@
= max_arity > num_keywords ? max_arity - num_keywords : 0;
- unsigned tuple_size = num_keywords ? max_arity : 0;
+ ssize_t tuple_size = num_keywords ? max_arity : 0;
m_arg_names = object(handle<>(PyTuple_New(tuple_size)));
if (num_keywords != 0)
@@ -154,7 +159,9 @@
else
{
// build a new arg tuple, will adjust its size later
- inner_args = handle<>(PyTuple_New(max_arity));
+ assert(max_arity <= ssize_t_max);
+ inner_args = handle<>(
+ PyTuple_New(static_cast
// Fill in the positional arguments
for (std::size_t i = 0; i < n_unnamed_actual; ++i)
@@ -228,30 +235,12 @@
return 0;
}
-void function::argument_error(PyObject* args, PyObject* keywords) const
+object function::signature(bool show_return_type) const
{
- static handle<> exception(
- PyErr_NewException("Boost.Python.ArgumentError", PyExc_TypeError, 0));
+ py_function const& impl = m_fn;
- object message = "Python argument types in\n %s.%s("
- % make_tuple(this->m_namespace, this->m_name);
-
- list actual_args;
- for (int i = 0; i < PyTuple_Size(args); ++i)
- {
- char const* name = PyTuple_GetItem(args, i)->ob_type->tp_name;
- actual_args.append(str(name));
- }
- message += str(", ").join(actual_args);
- message += ")\ndid not match C++ signature:\n ";
-
- list signatures;
- for (function const* f = this; f; f = f->m_overloads.get())
- {
- py_function const& impl = f->m_fn;
-
- python::detail::signature_element const* s
- = impl.signature() + 1; // skip over return type
+ python::detail::signature_element const* return_type = impl.signature();
+ python::detail::signature_element const* s = return_type + 1;
list formal_params;
if (impl.max_arity() == 0)
@@ -269,9 +258,9 @@
if (s[n].lvalue)
param += " {lvalue}";
- if (f->m_arg_names) // None or empty tuple will test false
+ if (m_arg_names) // None or empty tuple will test false
{
- object kv(f->m_arg_names[n]);
+ object kv(m_arg_names[n]);
if (kv)
{
char const* const fmt = len(kv) > 1 ? " %s=%r" : " %s";
@@ -282,12 +271,39 @@
formal_params.append(param);
}
- signatures.append(
- "%s(%s)" % make_tuple(f->m_name, str(", ").join(formal_params))
- );
+ if (show_return_type)
+ return "%s(%s) -> %s" % make_tuple(
+ m_name, str(", ").join(formal_params), return_type->basename);
+ return "%s(%s)" % make_tuple(
+ m_name, str(", ").join(formal_params));
+}
+
+object function::signatures(bool show_return_type) const
+{
+ list result;
+ for (function const* f = this; f; f = f->m_overloads.get()) {
+ result.append(f->signature(show_return_type));
+ }
+ return result;
}
- message += str("\n ").join(signatures);
+void function::argument_error(PyObject* args, PyObject* /*keywords*/) const
+{
+ static handle<> exception(
+ PyErr_NewException("Boost.Python.ArgumentError", PyExc_TypeError, 0));
+
+ object message = "Python argument types in\n %s.%s("
+ % make_tuple(this->m_namespace, this->m_name);
+
+ list actual_args;
+ for (ssize_t i = 0; i < PyTuple_Size(args); ++i)
+ {
+ char const* name = PyTuple_GetItem(args, i)->ob_type->tp_name;
+ actual_args.append(str(name));
+ }
+ message += str(", ").join(actual_args);
+ message += ")\ndid not match C++ signature:\n ";
+ message += str("\n ").join(signatures());
#if BOOST_PYTHON_DEBUG_ERROR_MESSAGES
std::printf("\n--------\n%s\n--------\n", extract
@@ -392,6 +408,12 @@
void function::add_to_namespace(
object const& name_space, char const* name_, object const& attribute)
{
+ add_to_namespace(name_space, name_, attribute, 0);
+}
+
+void function::add_to_namespace(
+ object const& name_space, char const* name_, object const& attribute, char const* doc)
+{
str const name(name_);
PyObject* const ns = name_space.ptr();
@@ -463,16 +485,11 @@
PyErr_Clear();
if (PyObject_SetAttr(ns, name.ptr(), attribute.ptr()) < 0)
throw_error_already_set();
-}
-void function::add_to_namespace(
- object const& name_space, char const* name_, object const& attribute, char const* doc)
-{
- add_to_namespace(name_space, name_, attribute);
- if (doc != 0)
+ object mutable_attribute(attribute);
+ if (doc != 0 && docstring_options::show_user_defined_)
{
// Accumulate documentation
- object mutable_attribute(attribute);
if (
PyObject_HasAttrString(mutable_attribute.ptr(), "__doc__")
@@ -481,15 +498,30 @@
mutable_attribute.attr("__doc__") += "\n\n";
mutable_attribute.attr("__doc__") += doc;
}
- else
+ else {
mutable_attribute.attr("__doc__") = doc;
}
}
+ if (docstring_options::show_signatures_)
+ {
+ if ( PyObject_HasAttrString(mutable_attribute.ptr(), "__doc__")
+ && mutable_attribute.attr("__doc__")) {
+ mutable_attribute.attr("__doc__") += "\n";
+ }
+ else {
+ mutable_attribute.attr("__doc__") = "";
+ }
+ function* f = downcast
+ mutable_attribute.attr("__doc__") += str("\n ").join(make_tuple(
+ "C++ signature:", f->signature(true)));
+ }
+}
+
BOOST_PYTHON_DECL void add_to_namespace(
object const& name_space, char const* name, object const& attribute)
{
- function::add_to_namespace(name_space, name, attribute);
+ function::add_to_namespace(name_space, name, attribute, 0);
}
BOOST_PYTHON_DECL void add_to_namespace(
@@ -580,19 +612,19 @@
// We add a dummy __class__ attribute in order to fool PyDoc into
// treating these as built-in functions and scanning their
// documentation
- static PyObject* function_get_class(PyObject* op, void*)
+ static PyObject* function_get_class(PyObject* /*op*/, void*)
{
return python::incref(upcast
}
}
static PyGetSetDef function_getsetlist[] = {
- {"__name__", (getter)function_get_name, 0 },
- {"func_name", (getter)function_get_name, 0 },
- {"__class__", (getter)function_get_class, 0 }, // see note above
- {"__doc__", (getter)function_get_doc, (setter)function_set_doc},
- {"func_doc", (getter)function_get_doc, (setter)function_set_doc},
- {NULL} /* Sentinel */
+ {"__name__", (getter)function_get_name, 0, 0, 0 },
+ {"func_name", (getter)function_get_name, 0, 0, 0 },
+ {"__class__", (getter)function_get_class, 0, 0, 0 }, // see note above
+ {"__doc__", (getter)function_get_doc, (setter)function_set_doc, 0, 0},
+ {"func_doc", (getter)function_get_doc, (setter)function_set_doc, 0, 0},
+ {NULL, 0, 0, 0, 0} /* Sentinel */
};
PyTypeObject function_type = {
@@ -634,8 +666,17 @@
0, //offsetof(PyFunctionObject, func_dict), /* tp_dictoffset */
0, /* tp_init */
0, /* tp_alloc */
- 0,
- 0 /* tp_new */
+ 0, /* tp_new */
+ 0, /* tp_free */
+ 0, /* tp_is_gc */
+ 0, /* tp_bases */
+ 0, /* tp_mro */
+ 0, /* tp_cache */
+ 0, /* tp_subclasses */
+ 0, /* tp_weaklist */
+#if PYTHON_API_VERSION >= 1012
+ 0 /* tp_del */
+#endif
};
object function_object(
Index: boost/python/ssize_t.hpp
===================================================================
RCS file: boost/python/ssize_t.hpp
diff -N boost/python/ssize_t.hpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ boost_1_33_1/boost/python/ssize_t.hpp 26 Sep 2006 00:25:06 -0000 1.1
@@ -0,0 +1,29 @@
+// Copyright Ralf W. Grosse-Kunstleve & David Abrahams 2006.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PYTHON_SSIZE_T_RWGK20060924_HPP
+# define BOOST_PYTHON_SSIZE_T_RWGK20060924_HPP
+
+# include
+
+namespace boost { namespace python {
+
+#if PY_VERSION_HEX >= 0x02050000
+
+typedef Py_ssize_t ssize_t;
+ssize_t const ssize_t_max = PY_SSIZE_T_MAX;
+ssize_t const ssize_t_min = PY_SSIZE_T_MIN;
+
+#else
+
+typedef int ssize_t;
+ssize_t const ssize_t_max = INT_MAX;
+ssize_t const ssize_t_min = INT_MIN;
+
+#endif
+
+}} // namespace boost::python
+
+#endif // BOOST_PYTHON_SSIZE_T_RWGK20060924_HPP
--- boost/python/converter/registry.hpp 2005-05-16 05:30:56.000000000 +0200
+++ boost_1_33_1/boost/python/converter/registry.hpp 2006-12-03 14:39:02.000000000 +0100
@@ -10,6 +10,14 @@
# include
# include
+// undo a deliberately incompatible python2.5 API change
+#ifdef PyErr_Warn
+#undef PyErr_Warn
+extern "C" {
+ PyAPI_FUNC(int) PyErr_Warn(PyObject *, char *);
+}
+#endif
+
namespace boost { namespace python { namespace converter {
struct registration;