changeset 48:518f2a5466b1

exe building
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Mon, 28 Apr 2014 18:51:55 +0200
parents cb6b868cd5ec
children 99e0f1f916f0
files MANIFEST.in Makefile setup.py
diffstat 3 files changed, 84 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MANIFEST.in	Mon Apr 28 18:51:55 2014 +0200
@@ -0,0 +1,4 @@
+recursive-include undermine *.py
+recursive-include undermine *.png
+recursive-include undermine *.ogg
+recursive-include undermine *.wav
--- a/Makefile	Mon Apr 28 18:43:33 2014 +0200
+++ b/Makefile	Mon Apr 28 18:51:55 2014 +0200
@@ -4,3 +4,10 @@
 	cat undermine.zip >> undermine.zip.py
 	rm undermine.zip
 	chmod +x undermine.zip.py
+exe:
+	setup.py py2exe
+
+clean:
+	rm -f undermine.zip.py
+	rm -rf build
+	rm -rf dist
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/setup.py	Mon Apr 28 18:51:55 2014 +0200
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from setuptools import setup
+import os
+import glob
+try:
+    import py2exe
+except ImportError:
+    pass
+else:
+    origIsSystemDLL = py2exe.build_exe.isSystemDLL
+    def isSystemDLL(pathname):
+        if os.path.basename(pathname).lower() in (
+                "libfreetype-6.dll", "sdl_ttf.dll", "libogg-0.dll"):
+                return 0
+        return origIsSystemDLL(pathname)
+    py2exe.build_exe.isSystemDLL = isSystemDLL
+
+    orig_byte_compile = py2exe.build_exe.byte_compile
+    def byte_compile(*args, **kwargs):
+        files = orig_byte_compile(*args, **kwargs)
+        files.extend(os.path.abspath(d) for d in glob.glob("undermine/*.png"))
+        files.extend(os.path.abspath(d) for d in glob.glob("undermine/*.ogg"))
+        files.extend(os.path.abspath(d) for d in glob.glob("undermine/*.wav"))
+        return files
+    py2exe.build_exe.byte_compile = byte_compile
+
+setup(
+    name='undermine',
+    version='4.0',
+    author='Radomir Dopieralski',
+    packages=['undermine'],
+    include_package_data=True,
+    zip_safe=True,
+    install_requires=['pygame'],
+    platforms='any',
+    options = {
+        'py2exe': {
+            'bundle_files': 1,
+            'packages': 'undermine',
+            'compressed': True,
+            'ascii': False,
+            'excludes': [
+                'doctest',
+                'pdb',
+                'unittest',
+                'difflib',
+                'inspect',
+                'locale',
+                'pyreadline',
+                'optparse',
+                'calendar',
+                'pickle',
+                'email',
+                '_ssl',
+            ]
+        },
+    },
+    data_files = [
+        ("undermine",
+             glob.glob("undermine/*.png") +
+             glob.glob("undermine/*.ogg") +
+             glob.glob("undermine/*.wav")
+        ),
+    ],
+    windows = [
+        {
+            'script': "__main__.py",
+        }
+    ],
+    zipfile = None,
+)