[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Compilation



Hi,

please do not give up using py2app too fast.

On Mac 10.7 (Lion) together with macports and python2.6 packaging works fine.
There where some issues, I have to admit, However, they are solvable!


1st:
make sure you won't run into relocation errors (for details on this http://www.danplanet.com/blog/2009/02/15/using-py2app-with-gtk/)
-> easy fix: in a fresh macports environment edit one line in
/opt/local/share/macports/Tcl/port1.0/portconfigure.tcl
to
default configure.ldflags   {"-L${prefix}/lib -Xlinker -headerpad_max_install_names"}

If you already have macports set up before, then a clean may be necessary ( be aware: your entire MacPorts environment gets uninstalled !!!)

backup list of installed ports:
$ port installed > myinstalled ports
(more info: https://trac.macports.org/wiki/UsingMacPortsQuickStart)

clean your port environment:
$ sudo port -fp uninstall --follow-dependents installed


2nd:
setup your build script correctly:
- include all necessary files
- declare modules as package

for a lot of files, you won't have to include every individual file by Hand, just use the directory traversing script given here: http://beckism.com/2009/03/pyobjc_tips/


A complete set of instructions for building a full app concerning the above tips can be found here,
it is independent from py-game, thus make sure to do a $ sudo port install py26-game:
http://wiki.unknown-horizons.org/w/MacOS_build_notes
Moreover all steps should run with Python2.7 or upper versions instead, just make sure to use the same prefix when installing the ports.


Good luck and have fun!

Enno





Am 17.02.2012 um 23:41 schrieb Andrew Godfroy:

> Hey, Try this: http://cs.simpson.edu/?q=make_an_installer_for_your_python_program
> 
> I use it for all my programs when ready for distribution. What it does it converts your .Py to an exe file which can be run like any normal program. Its the only Compilation/Exe creation program that I have found that is still being supported.
> 
> -----Original Message----- From: Zack Baker
> Sent: Friday, February 17, 2012 4:44 PM
> To: pygame-users@xxxxxxxx
> Cc: pygame-users@xxxxxxxx
> Subject: Re: [pygame] Compilation
> 
> So could you just resend an email with the command exactly how it would as oppear because that looks a littled funky. Let's assume that the game is called helloworld.py  and put it in the trunk folder or wherever. Thank you!
> 
> -Zack
> 
> On Feb 17, 2012, at 4:17 PM, Sam Bull <sam.hacking@xxxxxxxx> wrote:
> 
>> On Thu, 2012-02-16 at 18:52 -0700, Ian Mallett wrote:
>> 
>>> I am unaware of any other binary distribution techniques for Python on
>>> Mac other than py2app.
>> 
>> [Sent from wrong address, so re-posting]
>> 
>> Pyinstaller? It claims to be cross-platform. It's also the only one that
>> I've managed to get working without much hassle. I've only tested it on
>> Linux myself though.
>> 
>> To create a frozen binary on my system, all I need to run is:
>> python ~/.pyinstaller-1.5.1/pyinstaller.py --onefile -o pyinstaller
>> trunk/pacman.py
>> 
>> That's with pyinstaller installed in a hidden folder in my home
>> directory. The -o argument is the output directory. So this compiles my
>> game located at "trunk/pacman.py" into a single binary, saving it into
>> the "pyinstaller" folder.
>> 
>> I've not managed to have any success with alternatives like py2app or
>> py2exe.
>> 
>> Oh, and one caveat, the exit() function doesn't work with Pyinstaller,
>> use sys.exit() instead.
>> 
>> -- 
>> Sam Bull <sambull.org>
>> PGP: 9626CE2B