[Pythonmac-SIG] py2app w/ setuptools

matgeek at gmail.com matgeek at gmail.com
Thu Dec 30 17:59:40 CET 2010


Hi Everyone,

  I've been playing around with py2app for the last few days, trying to
assemble Deluge 1.3.1 <http://dev.deluge-torrent.org/wiki/About> (a rather
large python/gtk project that links against the C++ project *libtorrent*)
into an .app and I'm at the point now where I should probably verify that
what I'm attempting to do is actually possible, before spending several more
hours pounding my head against my monitor.  I have a few years of *nix
experience and a small amount of programming background, but I'm certainly
not a unix power-user by any stretch of the imagination - this is proving to
be a limiting factor in my journey so far.

  I'm not sure that I'm fully understanding the specifics, so forgive me if
the following sounds ridiculous.

  I have installed Deluge via MacPorts using this command: "*sudo port
install boost +python26 pango +no_x11+quartz cairo +no_x11+quartz gtk2
+no_x11+quartz libnotify +no_x11+quartz deluge*"...  Which gets Deluge up
and running, so I know at least the dependcies have been satisfied.  After a
little digging, I've come to realize that it's being run by setuptools,
which is where things get a little foggy for me.  The file that is called,
which opens Deluge, is not an executable unix file, nor does it have a
python file extension.  It's simply called 'deluge' - the contents of which
are:

#!/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python

# EASY-INSTALL-ENTRY-SCRIPT: 'deluge==1.3.1','gui_scripts','deluge'

__requires__ = 'deluge==1.3.1'

import sys

from pkg_resources import load_entry_point


> if __name__ == '__main__':

    sys.exit(

        load_entry_point('deluge==1.3.1', 'gui_scripts', 'deluge')()

    )


  My assumption is that this file is where setuptools is working it's magic,
but it leaves me completely stumped as to which file I should be passing
into py2applet (and ultimately py2app).

  Since that left me stumped, I thought I'd try to create an .app from the
Deluge source code (not the installed, running version - just an extracted
tar ball).  I first renamed the setup.py included in the source to Deluge.py
and issued "py2applet --make-setup Deluge.py"  followed by  "python setup.py
py2app -A".  But the resulting .app is created way too quickly to be legit
and when I attempt to run it I get the following output:

Traceback (most recent call last):

  File
> "/Users/mat/Coding/Deluge/python/deluge-1.3.1/dist/Deluge.app/Contents/Resources/__boot__.py",
> line 164, in <module>


>  _run(('\x00\x00\x00\x00\x01\x1e\x00\x02\x00\x00\x04iMat\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc6Y\xdb\xecH+\x00\x00\x00\xe5\xcd\xf3\tDeluge.py\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf4ua\xc9As\xa2\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00I
> \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x08\x00\x00\xc6Z\x06\x1c\x00\x00\x00\x11\x00\x08\x00\x00\xc9A\xab\xe2\x00\x00\x00\x0e\x00\x14\x00\t\x00D\x00e\x00l\x00u\x00g\x00e\x00.\x00p\x00y\x00\x0f\x00\n\x00\x04\x00i\x00M\x00a\x00t\x00\x12\x005Users/mat/Coding/Deluge/python/deluge-1.3.1/Deluge.py\x00\x00\x13\x00\x01/\x00\x00\x15\x00\x02\x00\n\xff\xff\x00\x00',
> '/Users/mat/Coding/Deluge/python/deluge-1.3.1/Deluge.py'))

   File
> "/Users/mat/Coding/Deluge/python/deluge-1.3.1/dist/Deluge.app/Contents/Resources/__boot__.py",
> line 160, in _run

    execfile(path, globals(), globals())

  File "/Users/mat/Coding/Deluge/python/deluge-1.3.1/Deluge.py", line 29, in
> <module>

    from setuptools import setup, find_packages, Extension

  File
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/__init__.py",
> line 2, in <module>

   File
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/extension.py",
> line 2, in <module>

   File
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/dist.py",
> line 5, in <module>

   File
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/install.py",
> line 2, in <module>

   File
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/command/install.py",
> line 21, in <module>

     from site import USER_BASE

ImportError: cannot import name USER_BASE


  My assumption now is that py2app needs to be run against the installed,
running version in order to track the various libraries that need to be
bundled in the final .App - but perhaps I'm incorrect here?

  Again, I'm mostly looking to find out if my efforts have been in vain or
if there is actually hope in getting Deluge packaged up?  If you think it
should possible, any insights you might have would be greatly appreciated
and very much welcomed.

Best Regards,
Mat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20101230/c2b218cc/attachment.html>


More information about the Pythonmac-SIG mailing list