2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-27 07:02:15 +00:00

Automatically add library-path values to RUN_PATH/RUN_LD_LIBRARY_PATH

[SVN r17562]
This commit is contained in:
Dave Abrahams
2003-02-20 20:28:05 +00:00
parent 1f9d0bb196
commit 2663e73f1c
4 changed files with 46 additions and 5 deletions

View File

@@ -148,9 +148,13 @@ namespace
dict d;
d["__slots__"] = tuple();
d["values"] = dict();
object module_name = module_prefix();
if (module_name)
module_name += '.';
object result = (object(metatype))(
module_prefix() + name, make_tuple(base), d);
module_name + name, make_tuple(base), d);
scope().attr(name) = result;

View File

@@ -153,6 +153,7 @@ run result.cpp ;
compile string_literal.cpp ;
compile borrowed.cpp : $(UNIT_TEST_PROPERTIES) ;
compile object_manager.cpp : $(UNIT_TEST_PROPERTIES) ;
compile copy_ctor_mutates_rhs.cpp : $(UNIT_TEST_PROPERTIES) ;
run upcast.cpp <lib>../../test/build/boost_test_exec_monitor
: # command-line args

View File

@@ -8,6 +8,7 @@
#include <boost/python/class.hpp>
#include <boost/python/extract.hpp>
#include <boost/python/def.hpp>
#include <boost/python/implicit.hpp>
#include "test_class.hpp"
#include <memory>
@@ -16,6 +17,11 @@ using namespace boost::python;
typedef test_class<> X;
struct Y : X
{
Y(int n) : X(n) {};
};
int look(std::auto_ptr<X> const& x)
{
return (x.get()) ? x->value() : -1;
@@ -60,6 +66,10 @@ BOOST_PYTHON_MODULE(auto_ptr_ext)
.def("value", &X::value)
;
class_<Y, std::auto_ptr<Y>, bases<X>, boost::noncopyable>("X", init<int>())
;
implicitly_convertible<std::auto_ptr<Y>, std::auto_ptr<X> >();
def("look", look);
def("steal", steal);
def("maybe_steal", maybe_steal);

View File

@@ -3,7 +3,6 @@
>>> x = X(42)
>>> x.value()
42
>>> look(x), look(x)
(42, 42)
@@ -32,12 +31,39 @@
>>> look(x)
77
>>> y = callback(lambda y: y)
>>> y.value()
>>> z = callback(lambda z: z)
>>> z.value()
77
>>> extract(x).value()
77
#
# Test derived to base conversions
#
>>> y = Y(42)
>>> y.value()
42
>>> maybe_steal(y, 0)
42
>>> try: maybe_steal(y, 0)
... except TypeError: pass
... else: print 'expected a TypeError exception'
>>> y.value()
42
>>> steal(y)
42
>>> if not '--broken-auto-ptr' in sys.argv:
... try: y.value()
... except TypeError: pass
... else: print 'expected a TypeError exception'
'''
def run(args = None):