This post originated from an RSS feed registered with Python Buzz
by Rod Hyde.
Original Post: use py2exe and Bob is your uncle
Feed Title: The landscape.
Feed URL: http://www.bloglines.com/blog/RodHyde/rss
Feed Description: The technical landscape through the eyes of an occasional indie games programmer who now uses Python as his language of choice.
I am in shock at how easy it is to use py2exe. Last night, I was making a short to do list for next time I worked on Corvids, before turning in for the night. On the list was "look at py2exe". On a whim I decided to have a quick look at the examples so that I could gauge the magnitude of the task. Not more than 20 minutes later, I had packaged Corvids. I copied the setup.py from the examples, modified it a little to include the data files, ran it, and Bob was my uncle.
Nothing could have been simpler.
Here's my setup.py (note: I had to use dots to show the indentation as it seems to get lost otherwise)
And, yes, I am a sucker for list comprehension.
from distutils.core import setup import py2exe
def filenames(dir): ....import os ....return [dir + '/' + file for file in os.listdir(dir)]
setup( ....# The first three parameters are not required, if at least a ....# 'version' is given, then a versioninfo resource is built from ....# them and added to the executables. ....version = "0.5.0", ....description = "py2exe corvids game", ....name = "py2exe corvids", ....# targets to build ....windows = ["corvids.py"], ....data_files = [('fonts', fontfiles), ..................('bitmaps', bitmapfiles), .............
1000
.....('music', musicfiles), ..................('sounds', soundfiles)] ....)