[libvirt] libvirt and python3

Daniel P. Berrange berrange at redhat.com
Fri Jul 19 08:58:30 UTC 2013


On Fri, Jul 19, 2013 at 07:26:09AM +0200, Michal Privoznik wrote:
> On 19.07.2013 04:04, Doug Goldstein wrote:
> > On Thu, Jul 18, 2013 at 1:13 PM, Dave Allan <dallan at redhat.com> wrote:
> >> I've seen a bunch of interest in python3 [1,2,3].  Has anybody started
> >> thinking about python3 bindings for libvirt?
> >>
> > 
> > While not really answering your question, I would like to see the
> > build system a little more flexible with regards to Python binding
> > generation. Currently you have to configure libvirt and it will
> > generate bindings for the python it detects (or is supplied) and if
> > you want to change that you need to rebuild the entire source tree.
> > It'd be nice in the future to be able to build against multiple
> > Python's without having to reconfigure and rebuild.
> 
> That's because python bindings need the client implementation. But I
> agree that it would be nice if one could just:
> 
> make -C python
> 
> to build the bindings.
> 
> To answer Dave's question, I'm not really into python but isn't 2to3 enough?

2to3 will take a python2 file & spit out a reasonable python3
file. The issue is that, IMHO, we don't want to be in the business
of maintaining 2 sets of python bindings. For any C code, I think
we want to make sure we use #if conditionals to minimize the extra
burden of python3.  For the py code, I think we should also aim to
try to support 2 & 3 with one set of code. There are some modules
you can import which give you access to some python3 style apis
from python2, which could help.


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list