compiling qt app extensions with distutils

strattonbrazil strattonbrazil at gmail.com
Fri Jul 22 12:22:09 EDT 2011


I have a simple Qt app that renders a scene in OpenGL does some very
basic geometry routines.  I originally was planning extending my app
just by including Python.h and the corresponding lib possibly using
pythonqt, but every time I brought it up on the python mailing list,
many would say I should be extending it instead usually referencing
this article (http://twistedmatrix.com/users/glyph/rant/
extendit.html).  The article makes pretty good sense in most cases.  I
could see the value of extending it as a module if my app ever wanted
to be used a library, but then I would have to do the whole business
of making a complex setup.py file to match the current Makefile.  I
can't find any other docs on doing this to a Qt app/library though
(especially since Trolltech uses the terms "extend" and "embed"
interchangeably).  The article does seem to glean over the
difficulties of extending a complex app and the python docs, at least,
seem to present "embedding" python as just a viable and worthwhile
option.

Like I said, the article made sense in theory, but at the same time I
have limited time to work on my project and don't want to spend too
much time trying to figure out out to create a Qt extension--
especially since it looks like few others have actually done it.  Is
there a way to build a simple python module from my existing
makefile?  Or should I just stick with embedding for now using the
existing makefile?  Thanks.

On Jul 22, 7:29 am, Thomas Jollans <t... at jollybox.de> wrote:
> On 22/07/11 15:43, strattonbrazil wrote:
>
> > I'd like to extend my C++ Qt applicaition using distutils.  Looking
> > over the tutorial docs (http://docs.python.org/extending/
> > building.html#building), it seems fairly intuitive for simple
> > examples, but I'm already using a rather complex qmake/Makefile system
> > to get all my cpp files and libraries included.  Is it possible to
> > take advantage of the existing makefile (http://pastebin.com/
> > Ln3NCkNL)?
>
> What do you want to do?
>
> Distutils is used to build extension modules. Do you want to turn your
> application into a Python module?
>
> It seams more likely that you want to embed Python in your application,
> in which case you're looking at altogether the wrong documentation and
> you simply have to link with libpythonX.Y like any other library




More information about the Python-list mailing list