From 5adfa5973564bec0638d661339240c1df61f41d5 Mon Sep 17 00:00:00 2001 From: Colin Noga Date: Fri, 30 Dec 2011 04:23:40 -0600 Subject: Tried for a windows build, failed. Added some icons. --- windows_build.py | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 windows_build.py (limited to 'windows_build.py') diff --git a/windows_build.py b/windows_build.py new file mode 100755 index 0000000..5b9d33c --- /dev/null +++ b/windows_build.py @@ -0,0 +1,75 @@ +from distutils.core import setup +from py2exe.build_exe import py2exe +import os, os.path, shutil, sys + +upxFlag = False +if '-upx' in sys.argv: + sys.argv.remove('-upx') + upxFlag = True + +dir = 'distrib/windows' + +print '[[ Running Koopatlas Through py2exe! ]]' +print '>> Destination directory: %s' % dir +sys.argv.append('py2exe') + +if os.path.isdir(dir): shutil.rmtree(dir) +os.makedirs(dir) + +# exclude QtWebKit to save space, plus Python stuff we don't use +excludes = ['encodings', 'doctest', 'pdb', 'unittest', 'difflib', 'inspect', + 'os2emxpath', 'posixpath', 'optpath', 'locale', 'calendar', + 'threading', 'select', 'socket', 'hashlib', 'multiprocessing', 'ssl', + 'PyQt4.QtWebKit', 'PyQt4.QtNetwork'] + +# set it up +setup( + name='Koopatlas', + version='0.2', + description="Koopatlas - Newer's Fantastic World Map Editor", + windows=[ + {'script': 'koopatlas.py', + } + ], + options={'py2exe':{ + 'includes': ['sip', 'encodings', 'encodings.hex_codec', 'encodings.utf_8', 'hashlib'], + 'compressed': 1, + 'optimize': 2, + 'excludes': excludes, + 'bundle_files': 3, + 'dist_dir': dir + }} +) + +print '>> Built frozen executable!' + +# now that it's built, configure everything +os.unlink(dir + '/w9xpopen.exe') # not needed + +if upxFlag: + if os.path.isfile('upx.exe'): + print '>> Found UPX, using it to compress the executables!' + files = os.listdir(dir) + upx = [] + for f in files: + if f.endswith('.exe') or f.endswith('.dll') or f.endswith('.pyd'): + upx.append('"%s/%s"' % (dir,f)) + os.system('upx -9 ' + ' '.join(upx)) + print '>> Compression complete.' + else: + print '>> UPX not found, binaries can\'t be compressed.' + print '>> In order to build Koopuzzle! with UPX, place the upx.exe file into '\ + 'this folder.' + + +print '>> Attempting to copy VC++2008 libraries...' +if os.path.isdir('Microsoft.VC90.CRT'): + shutil.copytree('Microsoft.VC90.CRT', dir + '/Microsoft.VC90.CRT') + print '>> Copied libraries!' +else: + print '>> Libraries not found! The frozen executable will require the '\ + 'Visual C++ 2008 runtimes to be installed in order to work.' + print '>> In order to automatically include the runtimes, place the '\ + 'Microsoft.VC90.CRT folder into this folder.' + +print '>> Koopatlas has been frozen to %s!' % dir -- cgit v1.2.3