Re: [Pythonmac-SIG] Trials with building app

2010-09-13 Thread Christopher Barker

Chris Weisiger wrote:
This thread suggests that Python is "lying about its architecture"; 
might be a holdover from using Python2.5 instead of 2.6:

http://old.nabble.com/py2app-architecture-problem-and-System-Python-question-td29262714.html


hmmm -- I'm not sure if Ronald is trying to keep it working with 2.5 
anymore -- there's a  lot of versions to keep track of and test on. I 
recall a discussion of what versions to support on the list, but can't 
find it right now.


You might find this note relevant:

Ronald Oussoren wrote:

Hi,

I've converted the repositories for py2app and related packages to mercurial 
and posted them on bitbucket. The new home pages are:

py2app: http://bitbucket.org/ronaldoussoren/py2app
macholib: http://bitbucket.org/ronaldoussoren/macholib
modulegraph: http://bitbucket.org/ronaldoussoren/modulegraph
altgraph: http://bitbucket.org/ronaldoussoren/altgraph

I have disabled the wiki for now, but did enable the issue tracker.


and my symlink isn't helping as much as I thought it was. Using main-fat 
as main-i386 will generate a working app, though.


glad to hear it!




--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] Trials with building app

2010-09-13 Thread Chris Weisiger
On Mon, Sep 13, 2010 at 3:00 PM, Christopher Barker
wrote:

> Chris Weisiger wrote:
>
>> Just another update on my travails with making an app build with py2app.
>> Since my previous posts haven't attracted much attention, I'm primarily
>> posting this on the off-chance that someone else is having similar issues
>> and might be helped. However, please do speak up if you have something to
>> contribute! I'm starting to get a wee bit frustrated.
>>
>
> This can be frustrating -- it's tricky stuff, and there are apparently only
> a few of us trying to do it.
>
> However, Ronald Oussoren has recently been giving py2app some much-needed
> love. He hasn't responded yet, so he may be busy or on vacton, or?? but he
> did specifically ask us all to let this list know when bugs were found.


Excellent news. I'm glad to hear that someone is taking charge of the
project -- it gives much more incentive to others to help out when they
discover fixable problems. It's a bit hard to report a bug, even if you have
the fix, if you have no ability to get that fix into the standard
distribution.


>
>
>  To build with a nonstandard Python install (necessary to get py2app to
>> include the Python interpreter in the build),
>>
>
> What is a "non-standard" install? you are right that it's won't include
> python if you use the Apple-supplied Python, but it should work with the
> build from python.org -- are you using something else? If so, why?
>
>
Sorry, I should have clarified here. By "non-standard" I mean "not the
distribution that comes with the OS". The standard distribution, IIRC, is
/usr/bin/python (which points to an install in /System/Frameworks); I'm
using /usr/local/bin/python (which points to an install in
/Library/Frameworks).


>
>  I have to "create" a main-i386 app template. This is done by going into
>> py2app-0.5.2-py2.5.egg/py2app/apptemplate/prebuilt and doing "ln -sf
>> main-fat3 main-i386"
>>
>
> This shouldn't be necessary, so something is up. py2app should "just work"
> with the exception of having to explicitly specify modules and packages
> sometimes (and data files...).
>

This thread suggests that Python is "lying about its architecture"; might be
a holdover from using Python2.5 instead of 2.6:
http://old.nabble.com/py2app-architecture-problem-and-System-Python-question-td29262714.html


>
>
First, key any any ability to help:
>
> What version of OS-X? what processor, exactly what version/build of Python,
> and what version of py2app?
>
>
OSX: 10.5.4
Processor: Intel Core 2 Duo 2GHz (Macbook)
Python: Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27)
 * I'd be on a newer version, but I have to deal with legacy cruft on a
regular basis, which doesn't work in 2.6.
py2app: 0.5.2.


> Second -- have you tried to do the very simplest thing first, with your
> set-up -- a simple hello world app? then you can add in modules that you may
> have problems with one at a time.
>
>
I really should have thought of this myself. Aside from the architecture
issue, hello.app fails with the same zlib error I mentioned earlier (when it
tries to import traceback in __boot__.py's _get_argvemulator()). I've put
the entirety of the test directory (including the source code, py2app's egg
directory with the symlink, and the build and dist directories) here:
http://derakon.dyndns.org/~chriswei/temp/hello.tgz

On a hunch, I tried using /usr/local/bin/python2.6. This doesn't give me the
architecture error, and the app successfully builds and runs with no
interference. So it looks like it's the architecture that's the problem, and
my symlink isn't helping as much as I thought it was. Using main-fat as
main-i386 will generate a working app, though. I tried using that for the
real program -- and it worked! Oddly enough, it doesn't need the __boot__.py
hack to find lib-dynload either.


>
>  This will allow py2app to build the app. However, it won't run, because I
>> have a dependency on a .so file which isn't in the default search paths that
>> py2app sets up.
>>
>
> Chris Weisiger wrote:
>
>> (creatively named "processor.app") that errors out on running with this
>> error:
>>
>> ImportError:
>> '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload/Crypto/Hash/SHA256.so'
>> not found
>>
>> SHA256.so does exist, in
>> ./dist/processor.app/Contents/Resources/lib/python2.5/lib-dynload/Crypto/Hash/SHA256.so
>>
>
> However, that is a *.so that is part of Apple's Python ('cause it's in
> "System") -- so you don't seem to be completely clean of the Apple python.
> That file does exist in my python.org install, so py2app should be able to
> do the right thing with it.
>
>
Per the above, this was, I suppose, an offshoot of claiming to be the wrong
architecture.


> If you post a simple-as-possilbe-but-still-shos-the-problem example if an
> ap pthat uses SHA, maybe on of us can test it for you.
>
> For example, I've enclosed the simplest test of sha256 I could think of,
> along with a setup.py to build it. It works f

Re: [Pythonmac-SIG] Trials with building app

2010-09-13 Thread Christopher Barker

Chris Weisiger wrote:
Just another update on my travails with making an app build with py2app. 
Since my previous posts haven't attracted much attention, I'm primarily 
posting this on the off-chance that someone else is having similar 
issues and might be helped. However, please do speak up if you have 
something to contribute! I'm starting to get a wee bit frustrated.


This can be frustrating -- it's tricky stuff, and there are apparently 
only a few of us trying to do it.


However, Ronald Oussoren has recently been giving py2app some 
much-needed love. He hasn't responded yet, so he may be busy or on 
vacton, or?? but he did specifically ask us all to let this list know 
when bugs were found.


To build with a nonstandard Python install (necessary to get py2app to 
include the Python interpreter in the build),


What is a "non-standard" install? you are right that it's won't include 
python if you use the Apple-supplied Python, but it should work with the 
build from python.org -- are you using something else? If so, why?


I have to "create" a 
main-i386 app template. This is done by going into 
py2app-0.5.2-py2.5.egg/py2app/apptemplate/prebuilt and doing "ln -sf 
main-fat3 main-i386"


This shouldn't be necessary, so something is up. py2app should "just 
work" with the exception of having to explicitly specify modules and 
packages sometimes (and data files...).


First, key any any ability to help:

What version of OS-X? what processor, exactly what version/build of 
Python, and what version of py2app?


Second -- have you tried to do the very simplest thing first, with your 
set-up -- a simple hello world app? then you can add in modules that you 
may have problems with one at a time.


This will allow py2app to build the app. However, it won't run, because 
I have a dependency on a .so file which isn't in the default search 
paths that py2app sets up.


Chris Weisiger wrote:
(creatively named "processor.app") that errors out on running with this 
error:


ImportError: 
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload/Crypto/Hash/SHA256.so' 
not found


SHA256.so does exist, in 
./dist/processor.app/Contents/Resources/lib/python2.5/lib-dynload/Crypto/Hash/SHA256.so


However, that is a *.so that is part of Apple's Python ('cause it's in 
"System") -- so you don't seem to be completely clean of the Apple 
python. That file does exist in my python.org install, so py2app should 
be able to do the right thing with it.


If you post a simple-as-possilbe-but-still-shos-the-problem example if 
an ap pthat uses SHA, maybe on of us can test it for you.


For example, I've enclosed the simplest test of sha256 I could think of, 
along with a setup.py to build it. It works fine on my 10.5 PPC system 
with the python.org python2.6 (you need to open up the console to see 
the output when it runs)


Does this work for you?

Note that is puts _sha265.so in:

hashlib_test.app/Contents/Resources/lib/python2.6/lib-dynload


Maybe not much help, but you know you aren't alone...

-Chris



--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov


hashlib_test.py
Description: application/python


setup.py
Description: application/python
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


[Pythonmac-SIG] Trials with building app

2010-09-13 Thread Chris Weisiger
Just another update on my travails with making an app build with py2app.
Since my previous posts haven't attracted much attention, I'm primarily
posting this on the off-chance that someone else is having similar issues
and might be helped. However, please do speak up if you have something to
contribute! I'm starting to get a wee bit frustrated.

Things I have discovered (some of this is a recap):

To build with a nonstandard Python install (necessary to get py2app to
include the Python interpreter in the build), I have to "create" a main-i386
app template. This is done by going into
py2app-0.5.2-py2.5.egg/py2app/apptemplate/prebuilt and doing "ln -sf
main-fat3 main-i386"

This will allow py2app to build the app. However, it won't run, because I
have a dependency on a .so file which isn't in the default search paths that
py2app sets up. So I have to modify __boot__.py by adding this line to the
run() function right after it imports sys:
sys.path.insert(0, os.path.join(os.getcwd(), 'lib', 'python2.5',
'lib-dynload'))

That code actually isn't reachable yet, though (I know I have to fix it
because my previous nominally-successful builds weren't standalone and thus
made it further). Instead, I get this error when __boot__.py's
_chdir_resource() function tries to import the os module:
zipimport.ZipImportError: can't decompress data; zlib not available

zlib is present:
% find dist -name "zlib*"
dist/processor.app/Contents/Resources/lib/python2.5/lib-dynload/zlib.so

However, it's clearly not in the search path at this point -- and the
program can't import os to change its search path! I can find a copy of
os.py from my /Library/Frameworks and insert it at the same level as
__boot__.py, and it will find that -- then fail to load posixpath with the
same zlib error (and then stat when I add posixpath, etc.). If I manually
uncompress lib/python2.5/site-packages.zip and copy eveyrthing in it
(including directories) down two levels to the Resources directory, then
everything seems to go fine until my app tries to import wx, at which point
this happens:

ImportError:
dlopen(/Users/chriswei/proj/ucsf/bitbucket-repo/processor/dist/processor.app/Contents/Resources/lib/python2.5/lib-dynload/wx/_core_.so,
2): no suitable image found.  Did find:
/Users/chriswei/proj/ucsf/bitbucket-repo/processor/dist/processor.app/Contents/Resources/lib/python2.5/lib-dynload/wx/_core_.so:
no matching architecture in universal wrapper

And that's where I'm stuck now. I've found shreds and snippets of
similar-sounding problems from other users, but no indication of what fixed
things for them. The py2app trac site is down -- is it even supported any
more? If not, what's the plan for standalone Python programs on OSX going
forward?

-Chris
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG