[C++-sig] boost.python and distutils

2010-10-26 Thread John Reid

Hi,

I need to distribute a python package that includes a boost.python 
extension. I've been working on Linux but I'd like the distribution to 
install easily on any platform with boost and python.


I'm guessing distutils is the way to go. I'm not sure if the easiest way 
is to try to get distutils to call bjam or somehow to code all the 
compile and link options into the setup.py script (this seems like a 
headache). If I get distutils to call bjam how can the setup.py script 
know what the files are to install given different OSes and versions of 
boost?


Perhaps just using a boost.build script would be easier than distutils. 
This is what the boost.graph python bindings do.


Has anyone got any experience doing this?

Thanks,
John.

___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig


Re: [C++-sig] boost.python and distutils

2010-10-26 Thread Andreas Kloeckner
Hi John,

On Tue, 26 Oct 2010 12:22:53 +0100, John Reid  
wrote:
> I need to distribute a python package that includes a boost.python 
> extension. I've been working on Linux but I'd like the distribution to 
> install easily on any platform with boost and python.
> 
> I'm guessing distutils is the way to go. I'm not sure if the easiest way 
> is to try to get distutils to call bjam or somehow to code all the 
> compile and link options into the setup.py script (this seems like a 
> headache). If I get distutils to call bjam how can the setup.py script 
> know what the files are to install given different OSes and versions of 
> boost?
> 
> Perhaps just using a boost.build script would be easier than distutils. 
> This is what the boost.graph python bindings do.
> 
> Has anyone got any experience doing this?

I've done distutils+Boost.Python for years now, without any issue. See
here for code examples:

- http://git.tiker.net/pyopencl.git
- http://git.tiker.net/pyublas.git
- http://git.tiker.net/pycuda.git

No bjam whatsoever.

Andreas



pgpF5F7zAi5x2.pgp
Description: PGP signature
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] Reference count on class object and import()

2010-10-26 Thread Simon W
Of course, I did find another reference that I didn't notice. Python
reference works as expected .. hehe!

On Mon, Oct 25, 2010 at 7:35 PM, Simon W  wrote:

> Hey again,
>
> I'm trying to implement a load / unload module functionallity. When I
> delete the module in the __main__ dict the module's reference count is still
> > 1. I've been trying to find if I reference it anywhere else in my code but
> I can't find anything! When I did a check in vc++ debugger found something.
> When I run this code:
>
> object obj = import(name.c_str());
>
> *obj*'s *ob_refcnt* member is 2 when I check in the vc++ debugger.
> Shouldn't it be 1?
>
> After that line, I put it in the __main__ dict like:
>
> mMainNamespace[ name.c_str() ] = obj;
>
> The reference count shows 4, as expected.
>
> When I'm entering my unload() function when I want to remove the module I
> do like:
> void unload()
> {
> object t = mMainNamespace[ name.c_str() ];
> // reference count in t is now 4 ?
>
>  mMainNamespace[ name.c_str() ].del(); // I delete but it's not
> unloaded properly because it's still referenced somewhere ..
> }
>
> What does import() do? It must save some reference somewhere?
>
>
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig