Created
August 4, 2015 06:35
-
-
Save ryesalvador/82a5c284e3f8f8e6d119 to your computer and use it in GitHub Desktop.
A Py2exe setup.py hack for PyGame
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# setup.py | |
from distutils.core import setup | |
import py2exe, sys, os | |
from glob import glob | |
# The following code is a work around hack for excluded DLLs. | |
origIsSystemDLL = py2exe.build_exe.isSystemDLL | |
def isSystemDLL(pathname): | |
if os.path.basename(pathname).lower() in ["sdl_ttf.dll", | |
"kernel32.dll", | |
"libogg-0.dll", | |
"gdi32.dll", | |
"ws2_32.dll", | |
"advapi32.dll", | |
"winmm.dll", | |
"ole32.dll", | |
"shell32.dll", | |
"user32.dll", | |
"ntdll.dll", | |
"oleaut32.dll", | |
"shlwapi.dll", | |
"rpcrt4.dll", | |
"msvcrt.dll"]: | |
return 0 | |
return origIsSystemDLL(pathname) | |
py2exe.build_exe.isSystemDLL = isSystemDLL | |
# This is where to put additional noncode files that are needed by the project. | |
data_files = [(".", ["skier.png", "block.png", "tune.wav"], | |
"Microsoft.VC90.CRT", | |
glob(r'C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*'))] | |
setup( | |
windows = [{"script":"pyGameSkier.py"}], | |
# This tells py2exe to exclude the list. | |
options = {"py2exe": { "dll_excludes": ["AppKit", | |
"Foundation", | |
"Numeric", | |
"OpenGL.GL", | |
"_scproxy", | |
"_sysconfigdata", | |
"copyreg", | |
"dummy.Process", | |
"numpy", | |
"pkg_resources", | |
"queue", | |
"winreg", | |
"pygame.sdlmain_osx"]}}, | |
data_files = data_files | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment