Thread: [Pyobjc-dev] Help in bundling our PyObjC app?
Brought to you by:
ronaldoussoren
From: Gary R. <gro...@tr...> - 2003-06-13 01:47:39
|
Hello, I have two questions and would be grateful for help... Question 1: We're creating an OS X app with PyObjC. We have never created an OS X bundle before so we are quite the newbies in this regard. We have also never used python's freeze or other executable-generating capabilities. So our questions are going to be pretty naive. In fact we are just at the outset of doing this packaging work, and at this point are just looking for general guidance for how to go about it so that our learning time will be spent efficiently. Our application will be running a couple of separate "slave" straight Python (not Cocoa) scripts to handle some asynchronous tasks. Currently these scripts are started and managed with the popen2.Popen4 class. These slave scripts have to use a version of Python compiled to have SSL enabled. So they can't use the stock Python. I'm wondering if anyone has advice as to how we should put our Cocoa-Python app together with these separate scripts in a package for the user. I envision a bundle that contains the main app and the separate scripts in a folder on disk; these all appear to be one unit to the user if I understand bundles correctly. Since the separate scripts need an SSL-enabled Python, is there some way to include that Python in the bundle so that the scripts can share it? Or must each such script have the SSL Python separately merged into it? Question 2: The bundlebuilder.py script includes the following comment: # The # bootstrapping script fires up the interpreter with the right # arguments. os.execve() is used as OSX doesn't like us to # start a real new process. This comment made me feel concerned about our use of popen2.Popen4, mentioned above, to start "real new processes". We have had no problems in our internal testing, but does anyone know of anything we should worry about with this? Many thanks in advance for any and all help! --Gary -- <http://ThisURLEnablesEmailToGetThroughOverzealousSpamFilters.org> Gary Robinson CEO Transpose, LLC gro...@tr... 207-942-3463 http://www.transpose.com http://radio.weblogs.com/0101454 |
From: Jack J. <Jac...@cw...> - 2003-06-13 08:58:51
|
On Friday, Jun 13, 2003, at 03:47 Europe/Amsterdam, Gary Robinson wrote: > Our application will be running a couple of separate "slave" straight > Python > (not Cocoa) scripts to handle some asynchronous tasks. Currently these > scripts are started and managed with the popen2.Popen4 class. > > These slave scripts have to use a version of Python compiled to have > SSL > enabled. So they can't use the stock Python. > > I'm wondering if anyone has advice as to how we should put our > Cocoa-Python > app together with these separate scripts in a package for the user. > > I envision a bundle that contains the main app and the separate > scripts in a > folder on disk; these all appear to be one unit to the user if I > understand > bundles correctly. > > Since the separate scripts need an SSL-enabled Python, is there some > way to > include that Python in the bundle so that the scripts can share it? Or > must > each such script have the SSL Python separately merged into it? I think (but haven't tried) that you don't need a specially built Python to enable SSL support, you only need a specially built _socketmodule.so extension module. You can probably put this somewhere in the bundle, but this is Advanced Bundlebuilder so someone else will have to provide the details. > Question 2: > > The bundlebuilder.py script includes the following comment: > > # The > # bootstrapping script fires up the interpreter with the right > # arguments. os.execve() is used as OSX doesn't like us to > # start a real new process. > > This comment made me feel concerned about our use of popen2.Popen4, > mentioned above, to start "real new processes". We have had no > problems in > our internal testing, but does anyone know of anything we should worry > about > with this? Don't worry, the comment doesn't apply in your case. It should be clarified. What the comment tries to say is that the unix process that was started when the user double-clicked the application (and which runs the bootstrap script) must be the same process that later connects to the window manager, otherwise the OSX magic for window manager access doesn't work. This bootstrap code ensures that this is the case for your Cocoa code. Any process you fork off after that is a normal unix process again, i.e. doesn't have access to the window manager. But in your case that is exactly what you want, as your scripts are straight python without any Cocoa code. -- Jack Jansen, <Jac...@cw...>, http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman |
From: Gary R. <gro...@tr...> - 2003-06-13 15:53:02
|
> Don't worry, the comment doesn't apply in your case. It should be > clarified. Thanks for relieving my worries about that comment in bundlebuilder.py! :) > I think (but haven't tried) that you don't need a specially built Python > to enable SSL support, you only need a specially built _socketmodule.so > extension > module. You can probably put this somewhere in the bundle, but this is > Advanced > Bundlebuilder so someone else will have to provide the details. If anybody who is an Advanced Bundlebuilder has a suggestion about how it might be done, I would really appreciate it. I have never done anything with bundles before (and neither has anyone else at our company). References to good sources of insight (including books -- I don't mind paying for good descriptions) would be also very much appreciated. I have found a couple of Apple Web pages about bundles but they don't really seem to get into the nuts and bolts about how to build them for custom situations like this. --Gary -- <http://ThisURLEnablesEmailToGetThroughOverzealousSpamFilters.org> Gary Robinson CEO Transpose, LLC gro...@tr... 207-942-3463 http://www.transpose.com http://radio.weblogs.com/0101454 |
From: Just v. R. <ju...@le...> - 2003-06-13 19:30:16
|
Gary Robinson wrote: > > I think (but haven't tried) that you don't need a specially built > > Python to enable SSL support, you only need a specially built > > _socketmodule.so extension module. You can probably put this > > somewhere in the bundle, but this is Advanced Bundlebuilder so > > someone else will have to provide the details. > > If anybody who is an Advanced Bundlebuilder has a suggestion about > how it might be done, I would really appreciate it. I have never done > anything with bundles before (and neither has anyone else at our > company). References to good sources of insight (including books -- I > don't mind paying for good descriptions) would be also very much > appreciated. I have found a couple of Apple Web pages about bundles > but they don't really seem to get into the nuts and bolts about how > to build them for custom situations like this. You can either use the --resource=<path_to_a_file_or_folder> option, or add it to the resources list in your buildapp.py. In both cases, the file will end up in <YourApp>.app/Contents/Resources, which is a fine place since it's on sys.path when you app executes. Just |
From: Gary R. <gro...@tr...> - 2003-06-14 15:42:58
|
Thanks to everyone, particularly Jack and Just, for your insights. They help a lot. Now that I'm beginning to understand OS X bundles more (and have , I can ask better questions about bundling our application. The latest Python is 2.2.3. My understanding is that it contains a lot of bug fixes over the stock OS X Python 2.2. (Side question I saw a note somewhere that Jaguar now has 2.2.1? But when I start Python from the command line (using Jaguar 10.2.6), it says it's "Python 2.2 (#1, 07/14/02, 23:25:09)" -- is that 2.2.1? Jack says he thinks that to enable SSL, I don't need to recompile python as a whole, but only _socketmodule.so. But maybe I SHOULD include a non-stock python so I can get the latest bug fixes. I don't want the reliability of our app to be less because we are using the stock python and it doesn't include the latest bug fixes. So on to my latest set of questions: 1) Might the bug fixes in 2.2.3 (relative to the version most Jaguar users have as stock) make a meaningful difference to the reliability of a PyObjC app that uses such features as new-style classes and generators? 2) Can I simply include this python and its libraries in the package with our app? That is, are there any difficulties in making the app work with the included python and libraries (ignoring the stock python and its libraries)? Any tips on how to do it would also be appreciated. If we do this, I'll just compile the entire 2.2.3 including the SSL, and include everything in the bundle. 3) If there isn't much reason to go to all the trouble above, a tip for how to make stock python use the _socketmodule.so I'd be including in our bundle, rather than the stock version, would be very appreciated. --Gary -- <http://ThisURLEnablesEmailToGetThroughOverzealousSpamFilters.org> Gary Robinson CEO Transpose, LLC gro...@tr... 207-942-3463 http://www.transpose.com http://radio.weblogs.com/0101454 > From: Just van Rossum <ju...@le...> > Date: Fri, 13 Jun 2003 21:29:51 +0200 > To: Gary Robinson <gro...@tr...> > Cc: Jack Jansen <Jac...@cw...>, pyo...@li... > Subject: Re: [Pyobjc-dev] Help in bundling our PyObjC app? > > Gary Robinson wrote: > >>> I think (but haven't tried) that you don't need a specially built >>> Python to enable SSL support, you only need a specially built >>> _socketmodule.so extension module. You can probably put this >>> somewhere in the bundle, but this is Advanced Bundlebuilder so >>> someone else will have to provide the details. >> >> If anybody who is an Advanced Bundlebuilder has a suggestion about >> how it might be done, I would really appreciate it. I have never done >> anything with bundles before (and neither has anyone else at our >> company). References to good sources of insight (including books -- I >> don't mind paying for good descriptions) would be also very much >> appreciated. I have found a couple of Apple Web pages about bundles >> but they don't really seem to get into the nuts and bolts about how >> to build them for custom situations like this. > > You can either use the --resource=<path_to_a_file_or_folder> option, or > add it to the resources list in your buildapp.py. In both cases, the > file will end up in <YourApp>.app/Contents/Resources, which is a fine > place since it's on sys.path when you app executes. > > Just > |
From: Bill B. <bb...@ma...> - 2003-06-15 12:08:56
|
On Friday, June 13, 2003, at 11:52 AM, Gary Robinson wrote: > If anybody who is an Advanced Bundlebuilder has a suggestion about how > it > might be done, I would really appreciate it. I have never done > anything with > bundles before (and neither has anyone else at our company). > References to > good sources of insight (including books -- I don't mind paying for > good > descriptions) would be also very much appreciated. I have found a > couple of > Apple Web pages about bundles but they don't really seem to get into > the > nuts and bolts about how to build them for custom situations like this. It should be a bit easier than that. If you grab the pyssl module from.... http://pyobjc.sf.net/software/ .... it should compile with a simple ... python setup.py build ... and, looking with the build directory, you'll find _socket.so (or something similar). This .so simply needs to be somewhere in the PYTHONPATH (sys.path) before the socket module installed with Python. So, assuming that the Resources directory of the application is before /usr/lib/python2.2 in sys.path (which it is, I'm fairly certain), you simply need to copy _socket.so into the Resources/ directory of your application. You shouldn't need a custom NSBundle/CFBundle just for the socket module. b.bum |
From: Gary R. <gro...@tr...> - 2003-06-15 15:19:16
|
Bill, Many thanks! > It should be a bit easier than that. If you grab the pyssl module > from.... > > http://pyobjc.sf.net/software/ > > .... it should compile with a simple ... > > python setup.py build > > ... and, looking with the build directory, you'll find _socket.so (or > something similar). Actually a vaguely remembered this morning that you had emailed me about this once before, a few weeks ago! I searched my records and found it! OI had been so immersed in other tasks in the interim that I forgot. Maybe I'm losing brain cells in my old age! But the earlier message didn't explain how to use it as completely as this one did, so this is great. Thanks again! --Gary -- <http://ThisURLEnablesEmailToGetThroughOverzealousSpamFilters.org> Gary Robinson CEO Transpose, LLC gro...@tr... 207-942-3463 http://www.transpose.com http://radio.weblogs.com/0101454 |
From: <bb...@ma...> - 2003-06-16 02:05:20
|
On Sunday, Jun 15, 2003, at 11:18 US/Eastern, Gary Robinson wrote: > Actually a vaguely remembered this morning that you had emailed me > about > this once before, a few weeks ago! I searched my records and found it! > OI > had been so immersed in other tasks in the interim that I forgot. > Maybe I'm > losing brain cells in my old age! But the earlier message didn't > explain how > to use it as completely as this one did, so this is great. Heh -- I completely forgot I'd sent it.... a lot has happened in the past few weeks. The instructions for readline involve dynamically linking against Apple's Readline.framework. Which may not be there any longer (it was in one dev tool, but removed later or something). I just went through this on the plane today (I'm in CA for WWDC next week). Instead, I would recommend: - download the readline 4.3 source - install by: ./configure --disable-dynamic --enable-static sudo make install - grab the readline package I mentioned before - edit setup.py; remove all references to Frameworks. Add "-lreadline", "-lhistory", "-ltermcap" to the extra_link_args (after removing the -framework and -F for Readline.framework). - sudo python setup.py install End result should be a readline module that is statically linked against the readline library and will work against any OS X 10.2 system, regardless of the state of the readline framework. b.bum |