[Pythonmac-SIG] Zope py2app, some progress

Bob Ippolito bob at redivi.com
Thu Feb 10 06:18:07 CET 2005


On Feb 9, 2005, at 23:47, Roger Binns wrote:

>> I'm not sure whether to ask if you could explain "compile them into 
>> the executable" (I don't know how to do that; I have to give my app 
>> to Windows people, but actually (*knowing* anything about Windows . . 
>> .) or if you could explain "(bleh)" -- but maybe the one question 
>> answers the other. Oh well . . .
>
> On Windows it is possible to make a single file executable and include
> all resources within that executable.  However most people expect there
> to be a single setup executable, and that setup will add the program 
> to the list of Add/Remove programs in the Control Panel.
>
> And if you are going to use to a single setup, there is no benefit to
> trying to make a single file - it doesn't matter how many files there
> are.
>
> There are also some resources you won't be able to make part of the
> single file such as help content as it needs them to be in seperate
> files.
>
> You can make a single app appear be in the native installer format
> for each platform.  We did it for BitPim.  Go ahead, download and
> try it.  You don't actually need a cell phone for the program to
> run.
>
> This is the Python code used to do the installer work:
>
> http://cvs.sf.net/viewcvs.py/bitpim/bitpim/makedist.py?view=markup
>
> Slides 18 through 22 of this talk explain how it is done.  Note
> however that we now use py2app on Mac.
>
> http://bitpim.org/papers/baypiggies/

I'd like to see that pie slice for the Mac OS X build to shrink even 
further.. I took at a look at your setup.py, and it looks a fair amount 
of it doesn't need to be specified:

- no need to import string
- no need to make a "dist" dir (py2app will do it)
- specifying CFBundleIconFile is redundant if you use iconfile=
- specifying CFBundleExecutable is redundant
- compressed is redundant, it's always on
- this can be rewritten:
app = [ dict(
                  script="bp.py",
                  ),]

as just:

app = ['bp.py']

There's currently no reason to specify an application as a dictionary, 
it just gives you another place to specify a plist and having multiple 
applications or plugins built from one setup(...) isn't supported yet 
as there is too much global state (inherited that problem from looking 
too hard at py2exe).

- this might be useful to you to determine the OS version (rather than 
using the uname):
from distutils.version import LooseVersion
from bdist_mpkg.tools import sw_vers
if LooseVersion(sw_vers()) < LooseVersion('10.3'):
     # jaguar
     ...
else:
     # not jaguar
     ...

Things that I need to address:
If you specify version= to setup() then you shouldn't need 
CFBundleShortVersionString or CFBundleGetInfoString
The DMG building stuff should be abstracted as an option for bdist_mpkg 
and py2app (PyObjC currently has its own bdist_dmg command, but it 
doesn't support that for 10.2 yet)

Other than removing whitespace, I think that's about all I can do to 
make your setup shorter :)

-bob



More information about the Pythonmac-SIG mailing list