[Pythonmac-SIG] py2app and nested packages
Chris Barker
chris.barker at noaa.gov
Mon Apr 23 20:42:18 CEST 2012
Folks,
py2app doesn't seem to do "the right thing" with nested packages.
However, it's not entirely clear what it should do...
example: the "pubsub" package is delivered with wxPython, so it is
commonly imported thusly:
from wx.lib.pubsub import Publisher
However, in wx.lib.pubsub, there is some trickery in the __init___, so
as py2app installs it, ot doesn't work (see previous messages to this
and the wxPython list). However, if you do:
packages = ['wx.lib.pubsub'] ...
in your py2app setup.py, you get the entire pubsub package, but installed in :
Peppy.app/Contents/Resources/lib/python2.7/pubsub
so it will work, but only if you now import it as:
from pubsub import Publisher
not too heinous, but it's really nice if we don't have to change
imports for the bundled version.
if I add 'wx' to packages, It does work, but I've then got all of wx,
all of wx.lib, etc, which is really a bit much (the resulting app
bundle is 124MB, vs. 60 without specifying the wx package)
At first, I thought I'd want:
wx/lib/pubsub/....
put on sys.path, with wx and lib empty except the specified dirs.
However, that would put two "wx" dirs on sys.path, which would not be
good (assuming wx is used...)
Would it be possible for the packages specification to be processed
after modulegraph is run, and it would then see that "wx" and "wx.lib"
are there, and then put all of pubsub in there? Or maybe put the parts
of wx and wx.lib that were already going to be included outside the
zip bundle?
-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.Barker at noaa.gov
More information about the Pythonmac-SIG
mailing list