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

Re: [pygame] Please help!



Here are some criticisms of the py2exe build script posted, for those who care...


shutil.copyfile('freesansbold.ttf', 'dist/freesansbold.ttf')
 
Aside from the fact this line doesn't actually help the default font problem (it only helps if you explicitly construct fonts using "freesansbold.ttf", it does not help if you construct fonts from None), it's also a bad way to do dependencies for your py2exe scripts, because it's out of band of the rest of the build process, which means if it fails, then the rest of the py2exe build process still succeeds, and it looks like things worked. The right way to add assets like this is the "data_files" option to py2exe, which copies stuff to the dist directory, and fails the process if the file doesn't exist, and looks like it failed.


setup(
windows=["start.py"],
 
You don't need to use such a generic boring name for your main script there - the instructions said "rename netrek-client-pygame to start.py" - instead you should just name the starting file for py2exe, so:
----
  windows=["netrek-client-pygame"]


import py2exe, pygame

importing pygame from your build script is not needed or useful. py2exe figures out the dependencies.
 
 
data_files = [('images',
['C:\\Users\\Administrator\\Desktop\\python\\netrek-client-pygame-0.6\\images\\activity-stop.png',

You shouldn't use absolute source paths in your data files, relative paths from your build script will do