[Pythonmac-SIG] Creating an applet that includes wxPython
Bob Ippolito
bob at redivi.com
Sun Sep 7 15:49:59 EDT 2003
On Sunday, Sep 7, 2003, at 03:03 America/New_York, Just van Rossum
wrote:
> velosa at cinenet.net wrote:
>
>> I have written a small Python application for managing family trees
>> that uses wxPython for the interface. My goal is to make this
>> available to various members of my family tree so they can enter the
>> information they have. I'm now trying to figure out how to make it
>> available to other people. I am hoping that there is a way to extend
>> the results of MacPython applet tool to include the wxPython
>> libraries, but I don't know enough about how Mac packaging works to
>> know whether this is really possible. I got my own environment
>> working by downloading MacPython and wxPython-mac and installing
>> them. I'm hoping I can simply provide a single bundle to the other
>> Mac users. Ideally I'd like them to be able to run it all off of a
>> CD. Is there a reasonable way to do this or do I have to separately
>> include MacPython and wxPython-mac with my little applet.
>
> You can create standalone .app bundle that includes Python with
> bundlebuilder.py. Check the archives of this list for discussion of
> some
> potential problems, there was a thread last week with the word
> "bundlebuilder" in the subject.
>
> Alternatively, we just discussed some bundlebuilder features on the
> PyObjC mailing list:
>
> http://sourceforge.net/mailarchive/
> forum.php?thread_id=3082424&forum_id=
> 4355
>
> (I somehow have to load that page twice before it works)
>
> I've never used wxPython, but I've heard repackaging it is non-trivial.
> Maybe there are other people on this list that have experience with
> building standalone apps that use wxPython?
wxPython installs the following extensions in site-packages:
wxPython/calendarc.so
wxPython/gizmosc.so
wxPython/glcanvasc.so
wxPython/gridc.so
wxPython/helpc.so
wxPython/htmlc.so
wxPython/oglc.so
wxPython/stc_c.so
wxPython/wizardc.so
wxPython/wxc.so
wxPython/xrcc.so
According to otool, all of these link to one or both of:
/usr/local/lib/libwx_macd-2.4.0.dylib (compatibility version
2.4.0, current version 2.4.1)
/usr/local/lib/libwx_macd_gl-2.4.0.dylib (compatibility version
2.4.0, current version 2.4.1)
These two libraries do not link to anything that requires relocation
(just system libraries).
What you have to from here is make a copy of the wxPython framework and
do this for each of the wxPython so files:
install_name_tool -change /usr/local/lib/libwx_macd-2.4.0.dylib
@executable_path/../Resources/libwx_macd-2.4.0.dylib %s
install_name_tool -change /usr/local/lib/libwx_macd_gl-2.4.0.dylib
@executable_path/../Resources/libwx_macd_gl-2.4.0.dylib %s
Then you have to make copies of the two libwx dylib files and do these
transformations to them:
install_name_tool -id
@executable_path/../Resources/libwx_macd-2.4.0.dylib
libwx_macd-2.4.0.dylib
install_name_tool -id
@executable_path/../Resources/libwx_macd_gl-2.4.0.dylib
libwx_macd_gl-2.4.0.dylib
Then all you have to do is make sure that your copy of the wxPython
package gets in the bundle instead of the one in your site-packages,
and make sure that these two transformed dylib files end up in
Resources of your app bundle.
Note that you will lose the wxWindows gettext translations when you do
this, because I don't know how to relocate that.. I don't know much
about gettext and I don't know if it's possible to override the gettext
search path to look places other than /usr/local/share/locale
I haven't tried this, but it should work. In a future version of
bundlebuilder, we could incorporate my potool module (
http://undefined.org/python/ ) to perform translations like this
automatically (though we would also need logic for Frameworks, and it
would have to do this process recursively).
-bob
More information about the Pythonmac-SIG
mailing list