[Pythonmac-SIG] Trouble getting py2app to create self-contained app bundles
Dave Peterson
dpeterson at enthought.com
Wed Jul 15 21:38:43 CEST 2009
Hello,
I've been having a lot of trouble getting py2app (version 0.3.6) to
create truely self-contained app bundles. I'm thinking that either I'm
doing something so obviously wrong, or else py2app doesn't really create
self-contained bundles.
I've tried using it in both Apple's standard Python framework
environment (launch python via /usr/bin/python, site-packages in
/Library/Python/2.5/site-packages, etc.) and in an EPD Python framework
environment (installs to
/Library/Frameworks/Python.framework/Versions/4.3.0).
Here's what I'm doing. Does anyone see something wrong?
Create a directory tree:
/home/dpeterson/temp/
setup.py
test/
__init__.py
main.py
The setup.py looks like this:
from setuptools import setup, find_packages
setup(
name='test',
version='0.1',
packages=find_packages(),
entry_points = dict(
console_scripts = [
"test = test.main:main",
],
),
# py2app stuff
app = ['test/main.py'],
options = dict(py2app = dict(
extension = '.app',
)),
setup_requires = ['py2app'],
)
The test/__init__.py is an empty file and test/main.py looks like this:
def main():
print "Hello, world!"
if __name__ == "__main__":
main()
I then delete any pre-existing build and dist directories, then run
"python setup.py py2app" which outputs a lot of stuff, but doesn't
report any errors, and then try to run the generated app bundle's
executable via "dist/test.app/Contents/MacOS/test" -- it runs and prints
"Hello, world!" as expected.
BUT there is no Python.framework inside the generated app bundle under
the "dist" directory. And indeed, when I look inside
dist/test.app/Contents/Info.plist, I see the following lines which seems
to imply the bundle is falling back on the Python.framework version 2.5
installed in a system location.
<key>PyRuntimeLocations</key>
<array>
<string>@executable_path/../Frameworks/Python.framework/Versions/2.5/Python</string>
<string>/System/Library/Frameworks/Python.framework/Versions/2.5/Python</string>
</array>
Can anyone see what I'm doing wrong? I want to ensure my distributed
app bundle is self-contained and will continue to work even when Apple
stops shipping Python 2.5. Actually, I'd ideally like to use EPD to
build my app bundle then have it work even if that version of EPD isn't
installed on my co-workers machines. But I'd be happy to solve the
problem with Apple's python first.
Thanks in advance!
-- Dave
More information about the Pythonmac-SIG
mailing list