The Artima Developer Community
Sponsored Link

Python Buzz Forum
use py2exe and Bob is your uncle

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Rod Hyde

Posts: 23
Nickname: rodhyde
Registered: Aug, 2004

Rod Hyde is a UNIX sysadmin who has had a Road to Damascus experience with Python
use py2exe and Bob is your uncle Posted: Aug 17, 2004 4:42 AM
Reply to this message Reply

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.
Latest Python Buzz Posts
Latest Python Buzz Posts by Rod Hyde
Latest Posts From The landscape.

Advertisement
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)]


bitmapfiles = filenames('bitmaps')
fontfiles = filenames('fonts')
musicfiles = filenames('music')
soundfiles = filenames('sounds')


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)]
....)

Read: use py2exe and Bob is your uncle

Topic: Chocolatl Previous Topic   Next Topic Topic: wxPython 2.5.2.7

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use