Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.01; 'library,': 0.05; '"c"': 0.07; 'bits': 0.07; 'macros': 0.07; 'wrapper': 0.07; 'python': 0.08; 'scripts': 0.09; 'extern': 0.09; 'subject:distutils': 0.09; 'c++': 0.12; 'wrote:': 0.15; 'library': 0.15; 'bindings': 0.16; 'c++.': 0.16; 'distutils': 0.16; 'embed': 0.16; 'exposes': 0.16; 'function).': 0.16; 'iirc,': 0.16; 'obviously,': 0.16; 'okay,': 0.16; 'received:192.168.1.40': 0.16; 'subject:app': 0.16; 'terms,': 0.16; 'written': 0.17; 'script.': 0.19; 'convert': 0.19; 'seems': 0.20; 'figure': 0.21; 'extension': 0.22; 'header:In-Reply-To:1': 0.22; 'integrating': 0.23; 'module,': 0.23; 'code': 0.24; "python's": 0.25; '(or': 0.25; 'modules': 0.25; 'function': 0.26; "i'm": 0.27; 'objects': 0.28; 'all,': 0.28; 'correct': 0.29; 'compile': 0.29; 'originally': 0.29; 'sorry,': 0.29; 'definition': 0.30; 'module': 0.30; '(just': 0.30; 'easier.': 0.30; 'shared': 0.32; 'actually': 0.33; 'to:addr :python-list': 0.34; 'instead': 0.34; 'header:User-Agent:1': 0.34; 'difference': 0.34; 'things': 0.34; 'executable': 0.35; 'probably': 0.35; 'install': 0.36; 'but': 0.37; 'could': 0.37; 'using': 0.37; 'received:192': 0.38; 'subject:: ': 0.38; 'received:192.168.1': 0.39; 'should': 0.39; 'launch': 0.39; 'subject:with': 0.39; "there's": 0.39; 'to:addr:python.org': 0.39; 'might': 0.39; 'extend': 0.40; 'sense': 0.40; 'where': 0.40; 'your': 0.60; 'easily': 0.61; 'life': 0.64; 'received:62': 0.67; 'goals': 0.68; 'realized': 0.73; 'different.': 0.84; 'from:addr:t': 0.84; 'lastly,': 0.84; 'terminology': 0.84; 'exposing': 0.93; 'technically': 0.93 Date: Sat, 23 Jul 2011 02:30:52 +0200 From: Thomas Jollans User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110626 Iceowl/1.0b2 Icedove/3.1.11 MIME-Version: 1.0 To: python-list@python.org Subject: Re: compiling qt app extensions with distutils References: <562586f4-d1cd-4bce-af50-fefdbb2ef0f9@h7g2000prf.googlegroups.com> In-Reply-To: X-Enigmail-Version: 1.1.2 OpenPGP: id=5C8691ED Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1311381051 news.xs4all.nl 23920 [2001:888:2000:d::a6]:55614 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:10161 On 22/07/11 21:37, strattonbrazil wrote: >> Okay, your terminology was confused: you want to extend Python, not your >> application. > > Sorry, after I sent that e-mail, I realized I had already mixed up the > terms, where I should have written "embedding". > >> First of all, you don't technically need distutils: an extension module >> is simply a shared library that you can build like any other library, >> and I'm sure your build system can easily handle that. Then, you can >> probably use bits of distutils to figure out where to install things to. > > Hrmm, this seems like the most practical solution for me right now. > It makes sense to embed python in my application like I originally > planned, where I expose the individual functions I want to expose. > Eventually if I actually want to provide the exposed functions as a > library, I could actually just compile the application to a shared > library instead of an executable (just not using the main function). > The bindings in the C++ code are the same, correct? Only the way > they're built seems different. There's no difference between using C and C++. Obviously, you always need the correct extern "C" declarations, but IIRC, Python's method definition macros handle that. You could convert your whole application to a Python extension module, expose the main function to Python, and launch the program using a small Python wrapper script. (Or you could embed Python in your application.) > >> Lastly, depending on what your goals are, you might want to consider not >> integrating Python with your application at all, but exposing what >> functionality you want to expose to Python via dbus. You could write a >> skeleton module that exposes dbus proxy objects to Python scripts / >> modules to make life easier.