Universal App from py2app : Build on Leopard run on intel and powerpc , tiger , leopard and snow- leopard

222 views
Skip to first unread message

hari jayaram

unread,
Oct 15, 2009, 6:14:26 PM10/15/09
to wxpytho...@googlegroups.com
Thanks to everyone for your help..I posted this to the pythonmac-sig
mailing list as well so I apologize for the double post.

I finally have a truly Universal build with py2app 0.4.3.
I have confirmed that it works on Intel and Power-PC , tiger , leopard
and snow-leopard.

Here is my protocol, I am repeating it because it took me a while to
get all the bits in place
I am building on Leopard -10.5.8 intel mac

1) I was using python.org python 2.6.3
2) wxpython binary build for 2.6 from wxpython.org
3) Installed all my dependent libraries for the new python 2.6.3 ,
reportlab , yaml and py2app and macholib from subversion (links here
http://www.undefined.org/python/)
4 ) Used the verbose setup.py ( see below)
5) Ran python setup.py py2app
6) I then had to manually create a directory for the Framework inside
the bundle.app/Contents/Frameworks directory
mkdir Python.framework
mkdir Python.framework/Versions
mkdir Python.framework/Versions/2.6
And copy in the Framework build from my disk into the *.app bundle

cp /Library/Frameworks/Python.framework/Versions/2.6/Python
Python.framework/Versions/2.6/

7) The Resulting app bundle was 103 M uncompressed
8) I used DiskUtility to create a dmg file after I moved the *.app
bundle into a new folder . Used the Disk utility command - create -
disk image from folder . The compressed disk image was 33MB

9) Importantly the Disk Image ran on both mac cpu platforms and tiger
, leopard and snow-leopard OSes

I am sure this process can be fine-tuned. But thought I would send this along .

Thanks
hari jayaram

setup.py:
"""
This is a setup.py script generated by py2applet

Usage:
python setup.py py2app
"""

from setuptools import setup

APP = ['GridZilla.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True,
'iconfile': './gzilla_ico_fin.icns',
'semi_standalone':'False',
'includes': 'wx,reportlab,yaml',
'packages':('wx','reportlab','yaml'),
'site_packages': True}

setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)

On Tue, Oct 13, 2009 at 11:33 AM, hari jayaram <har...@gmail.com> wrote:
> Hi Roel..here is what I tried:
>
> 1)hari$ type python
> python is hashed (/Library/Frameworks/Python.framework/Versions/2.6/bin/python)
>
>
> 2) When I run: /Library/Frameworks/Python.framework/Versions/2.6/bin/python
> dhcp-129-64-45-53:src hari$
> /Library/Frameworks/Python.framework/Versions/2.6/bin/python
> Python 2.6.3 (r263:75184, Oct  2 2009, 07:56:03)
> [GCC 4.0.1 (Apple Inc. build 5493)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>
>
> 3) I forced the non standalone build with semi_standalone:False in the
> setup.py. I now get a standalone build with python in the following
> location
> /GridZilla.app/Contents/MacOS/python
>
> 4) trying to run the app I get a Plist error :
> A Python runtime could be located.  You may need to install a
> framework build of Python, or edit the PyRuntimeLocations array in
> this application's Info.plist file.
>
> 5) If I look at the plist value it is set to:
> @executable_path/../Frameworks/Python.framework/Versions/2.6/Python
>
> This location does not exist : What Should I set it to to get the app to work?
>
> 6) I tried setting it to ../MacOS/python and the app failed to launch
> with the message:
> dhcp-129-64-45-53:dist hari$ open GridZilla.app
> LSOpenFromURLSpec() failed with error -10810 for the file
> /Users/hari/gzilla/src/dist/GridZilla.app.
>
> SO I guess I can force standalone builds with -s option . But now the
> Info.plist does not have the correct value.
> How can I get the correct value
>
> Thanks
> hari
>
>
>
>
>
>
> On Tue, Oct 13, 2009 at 10:55 AM, Roel van Os <roel....@humanitech.nl> wrote:
>>
>> Hi Hari,
>>
>> On 13-10-09 16:23, hari jayaram wrote:
>>> I have been trying for some time to build a self contained build for a
>>> wxpython app
>>>
>>> I am building on Leopard OSX 10.5.8 with python.org 2.6.3 and the
>>> patched py2app 0.4.3
>>> When I try and run the *.app bundle
>>>
>>> However no matter what I do I get the
>>>
>>> ImportError: '/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/wx/_core_.so'
>>> not found
>>>
>>> The app bundle does have this library but the symlink for python
>>> inside the bundle seems to be to the System python. The app bundle
>>> never seems to contain its own python.
>>>
>>> So inside the bundle I have: /GridZilla.app/Contents/MacOS
>>>
>>> lrwxr-xr-x  1 hari  harijay      92 Oct 13 10:16 python ->
>>> /Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python
>>>
>>
>> The only way I can get the same result in my setup is if I run py2app
>> with the -s (--semi-standalone) argument. If you don't use that flag
>> when running py2app, something else might be fooling py2app into
>> generating a semi-standalone build. This happens automatically when you
>> run py2app using the Python installation shipped with Mac OS X.
>>
>> What does "type python" (in a Terminal) say?
>>
>> Regards,
>> Roel
>>
>>>
>>> How can I get a truly self contained build.
>>> I have sent several messages on the pythonmac-sig mailing list. I have
>>> also tried to build with python.org 2.5.4 . No matter what I do I get
>>> the wrong symlink to python and the _core_.so not found error
>>>
>>>
>>> My setup.py is attached below
>>> Thanks for your help
>>> Its taken me over a week and I am still stuck. Looking for some way out .
>>> Thanks a tonne
>>> hari
>>>
>>>
>>> """
>>> This is a setup.py script generated by py2applet
>>>
>>> Usage:
>>>      python setup.py py2app
>>> """
>>>
>>> from setuptools import setup
>>>
>>> APP = ['GridZilla.py']
>>> DATA_FILES = []
>>> OPTIONS = {'argv_emulation': True,
>>>   'iconfile': './gzilla_ico_fin.icns',
>>>   'includes': 'wx,reportlab,yaml'}
>>>
>>> setup(
>>>      app=APP,
>>>      data_files=DATA_FILES,
>>>      options={'py2app': OPTIONS},
>>>      setup_requires=['py2app'],
>>> )
>>>
>>>
>>> On Tue, Oct 13, 2009 at 3:23 AM, Roel van Os<roel....@humanitech.nl>  wrote:
>>>
>>>> Hi Mark,
>>>>
>>>> On 12-10-09 21:44, Mark Guagenti wrote:
>>>>
>>>>> Just wondering if anyone out there is using Snow Leopard to create and
>>>>> bundle up an application?
>>>>>
>>>>>
>>>> I used to use MacPorts for wxPython development as well, however I
>>>> couldn't get a stable environment running on Snow Leopard, even when
>>>> forcing 32-bit compilation of everything using several hacks.
>>>>
>>>> I'm currently using the Python (2.6) installer from www.python.org,
>>>> combined with the packages for wxPython from www.wxpython.org. I
>>>> installed setuptools and then py2app using easy_install. I had to modify
>>>> py2app slighly in order for it to work correctly: if you get a TypeError
>>>> exception about "a number is required, not str", you could try to apply
>>>> the patch I've attached. After this modification, py2app produces
>>>> working app bundles.
>>>>
>>>> Regards,
>>>> Roel
>>>>
>>>>
>>>>> Thanks,
>>>>> --Mark
>>>>>
>>>>>
>>>>
>>>>>
>>>>
>>> >
>>>
>>
>>
>> >>
>>
>
Reply all
Reply to author
Forward
0 new messages