[Pythonmac-SIG] Running "freeze" on non-framework Python/universal binary issues
Bob Ippolito
bob at redivi.com
Fri Jul 21 01:42:27 CEST 2006
On Jul 20, 2006, at 4:18 PM, Kevin Walzer wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Bob Ippolito wrote:
>>
>> On Jul 20, 2006, at 11:43 AM, Kevin Walzer wrote:
>>
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> Bob Ippolito wrote:
>>>>
>>>
>>>>
>>>> The other question is why the heck are you using a non-framework
>>>> build?
>>>
>>> Because I'm trying to package an application that builds against X11
>>> Tkinter.
>>
>> Rebuilding Python entirely seems pretty silly... it's way easier
>> to just
>> rebuild the _tkinter extension. You could even do it in your py2app
>> setup.py. Just copy the sources from python. You'll probably need
>> to do
>> some fiddling in your main script if DISPLAY isn't set though.
>>
>> from setuptools import setup, Extension
>>
>> extensions = [
>> Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
>> define_macros=[('WITH_APPINIT', 1)],
>> include_dirs=['/usr/X11R6/include'],
>> library_dirs=['/usr/X11R6/lib'],
>> libraries=['tcl8.4', 'tk8.4', 'X11'],
>> ),
>> ]
>>
>> setup(
>> app=['MyApp.py'],
>> extensions=extensions,
>> setup_requires=['py2app'],
>> )
>>
>>
>
> I've already built Python to support X11 Tkinter, so that's not an
> issue.
>
> I finally got the built-in freeze tools to work (as a universal
> binary)
> and am running my app inside an application bundle. It uses an
> AppleScript launcher stub to set the DISPLAY and start up X11.app.
> There's some jiggering that has to be done with the installation of
> Tcl/Tk inside the app bundle so the frozen binary sees things
> correctly,
> but it's not too hard. After I've polished this up a bit and have
> released something I will document it somewhere.
You wouldn't need to do all the jiggering or rebuilding of things if
you had just swapped out _tkinter.so.
If I were doing it I'd check for DISPLAY and look at the output of "/
usr/X11R6/bin/xauth list" to see if X11 is running. If not, then
start X11 and wait for ~/.Xauthority to show up.
Would probably be faster than going through AppleScript, and the how
to documentation would be a heck of a lot shorter.
-bob
More information about the Pythonmac-SIG
mailing list