changeset 228:8f4cd1c01d22

Add basic cx_Freeze support in order to freeze to a windows executable.
author Thibaut Girka <thib@sitedethib.com>
date Tue, 20 Dec 2011 21:17:34 +0100
parents 31460b2ec530
children 5afc75f71fed 9d4d52793eca
files setup.py
diffstat 1 files changed, 23 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,6 @@ from distutils.command.build_scripts imp
 from distutils.dep_util import newer
 from distutils import log
 
-
 # Cython is needed
 try:
     from Cython.Distutils import build_ext
@@ -17,6 +16,12 @@ except ImportError:
     sys.exit(1)
 
 
+packages = []
+extension_names = []
+extensions = []
+
+
+
 # The installed script shouldn't call pyximport, strip references to it
 class BuildScripts(build_scripts):
     def copy_scripts(self):
@@ -34,8 +39,6 @@ class BuildScripts(build_scripts):
         build_scripts.copy_scripts(self)
 
 
-packages = []
-extensions = []
 
 for directory, _, files in os.walk('pytouhou'):
     package = directory.replace(os.path.sep, '.')
@@ -43,12 +46,27 @@ for directory, _, files in os.walk('pyto
     for filename in files:
         if filename.endswith('.pyx'):
             extension_name = '%s.%s' % (package, os.path.splitext(filename)[0])
+            extension_names.append(extension_name)
             extensions.append(Extension(extension_name,
                                         [os.path.join(directory, filename)]))
 
 
 
+# TODO: find a less-intrusive, cleaner way to do this...
+try:
+    from cx_Freeze import setup, Executable
+except ImportError:
+    extra = {}
+else:
+    extra = {
+             'options': {'build_exe': {'includes': extension_names}},
+             'executables': [Executable(script='scripts/eosd', base='Win32GUI')]
+            }
+
+
+
 setup(name='PyTouhou',
+      version="0.1",
       author='Thibaut Girka',
       author_email='thib@sitedethib.com',
       url='http://hg.sitedethib.com/touhou/',
@@ -57,6 +75,7 @@ setup(name='PyTouhou',
       ext_modules=extensions,
       scripts=['scripts/eosd'],
       cmdclass={'build_ext': build_ext,
-                'build_scripts': BuildScripts}
+                'build_scripts': BuildScripts},
+      **extra
      )