changeset 186:f15c4f7c24e6

Windows builder (works under Wine).
author Simon Cross <simon@simonx>
date Wed, 25 Aug 2010 16:24:55 +0200
parents ce12e56ed434
children fbfd8e748ac0
files .bzrignore scripts/suspended.py scripts/testconsole.py scripts/wine-py2exe setup.py
diffstat 5 files changed, 142 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/.bzrignore	Wed Aug 25 16:23:12 2010 +0200
+++ b/.bzrignore	Wed Aug 25 16:24:55 2010 +0200
@@ -2,3 +2,4 @@
 deps/Albow-2.1.0
 build
 dist
+py2exe.log
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/suspended.py	Wed Aug 25 16:24:55 2010 +0200
@@ -0,0 +1,6 @@
+#! /usr/bin/env python
+# testconsole.py
+# Copyright Boomslang team, 2010 (see COPYING File)
+
+from gamelib import main
+main.main()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/testconsole.py	Wed Aug 25 16:24:55 2010 +0200
@@ -0,0 +1,17 @@
+#! /usr/bin/env python
+# testconsole.py
+# Copyright Simon Cross, Neil Muller, 2009 (see COPYING File)
+
+
+"""This module launches an interactive console.
+
+   Its purpose is to provide an easy means to
+   test the environment created by a py2exe build.
+   """
+
+if __name__ == "__main__":
+    import code
+    # pylint: disable-msg=C0103
+    # pylint thinks this should be a constant
+    console = code.InteractiveConsole()
+    console.interact()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/wine-py2exe	Wed Aug 25 16:24:55 2010 +0200
@@ -0,0 +1,81 @@
+#!/bin/sh
+# wine-py2exe
+# Copyright Simon Cross, Neil Muller, 2009 (see COPYING File)
+#
+# Usage: wine-py2exe
+
+OFA_VERSION=`PYTHONPATH=. python -c "from gamelib import version; print version.VERSION_STR"`
+BUILD_FOLDER="suspended-sentence-${OFA_VERSION}"
+ZIP_NAME="${BUILD_FOLDER}.zip"
+PY2EXE_LOG="py2exe.log"
+
+WINE_PYTHON=`winepath "C:/Python25"`
+WINE_SYS32=`winepath "C:/windows/system32"`
+
+#
+# Run py2exe build under wine
+#
+
+echo "=== Running wine python setup.py ==="
+echo ""
+echo "  Suspended Sentence version: ${OFA_VERSION}"
+echo "  Writing log to ${PY2EXE_LOG}."
+echo "  ---"
+echo "  Please make sure you have patched your py2exe run.exe"
+echo "  and run_w.exe with PETools (they need to have their"
+echo "  executable size correctly set)."
+echo ""
+
+rm -rf "dist/${BUILD_FOLDER}"
+mkdir -p "dist/${BUILD_FOLDER}"
+rm -rf "dist/${ZIP_NAME}"
+
+wine python setup.py py2exe >${PY2EXE_LOG} 2>&1
+
+#
+# Copy dependencies py2exe missed
+#
+
+echo "=== Copying dependencies that py2exe missed ==="
+echo ""
+
+DEST="dist/${BUILD_FOLDER}"
+
+cp -v "${WINE_SYS32}/python25.dll" "${DEST}"
+cp -v "${WINE_SYS32}/msvcr71.dll" "${DEST}"
+
+#echo "'${WINE_PYTHON}/share/pgu/themes/default' -> '${DEST}/share/pgu/themes/'"
+#mkdir -p "${DEST}/share/pgu/themes"
+#cp -R "${WINE_PYTHON}/share/pgu/themes/default" "${DEST}/share/pgu/themes/"
+
+echo "'Resources' -> '${DEST}/Resources'"
+bzr export -q "${DEST}/Resources" "Resources"
+#find "${DEST}/data" -name '*.svg' -delete
+
+echo "'${WINE_PYTHON}/Lib/site-packages/pygame' -> '${DEST}'"
+rm -rf "${DEST}/pygame"
+cp -R "${WINE_PYTHON}/Lib/site-packages/pygame" "${DEST}"
+rm -rf "${DEST}/pygame/examples" "${DEST}/pygame/tests" "${DEST}/pygame/docs"
+
+echo ""
+
+#
+# create zip file
+#
+
+echo "=== Creating zip of patched py2exe dist folder ==="
+echo ""
+echo "  Zip file: dist/${ZIP_NAME}"
+echo "  Build folder: dist/${BUILD_FOLDER}"
+echo ""
+
+cd dist
+rm -f "$ZIP_NAME"
+zip -r -q "$ZIP_NAME" "$BUILD_FOLDER"
+cd ..
+
+echo "=== Done ==="
+echo ""
+echo -n "  "; du -sh dist/${ZIP_NAME}
+echo -n "  "; du -sh dist/${BUILD_FOLDER}
+echo ""
--- a/setup.py	Wed Aug 25 16:23:12 2010 +0200
+++ b/setup.py	Wed Aug 25 16:24:55 2010 +0200
@@ -26,11 +26,11 @@
             # url = version.SOURCEFORGE_URL,
             # download_url = version.PYPI_URL,
 
-            # license = version.LICENSE,
+            license = version.LICENSE,
 
-            # classifiers = version.CLASSIFIERS,
+            classifiers = version.CLASSIFIERS,
 
-            # platforms = version.PLATFORMS,
+            platforms = version.PLATFORMS,
 
             # Dependencies
             install_requires = version.INSTALL_REQUIRES,
@@ -40,44 +40,44 @@
             scripts = ['run_game.py'],
 
             # py2exe
-            # console = ['scripts/testconsole.py'],
-            # windows = [{
-            #     'script': 'scripts/foxassault.py',
-            #     'icon_resources': [(0, "data/icons/foxassault.ico")],
-            # }],
+            console = ['scripts/testconsole.py'],
+            windows = [{
+                'script': 'scripts/suspended.py',
+            #     'icon_resources': [(0, "Resources/icons/suspended.ico")],
+            }],
             app = ['run_game.py'],
             options = {
-            # 'py2exe': {
-            #     'skip_archive': 1,
-            #     'dist_dir': 'dist/foxassault-%s' % version.VERSION_STR,
-            #     'packages': [
-            #         'logging', 'encodings',
-            #     ],
-            #     'includes': [
-            #         # pygame
-            #         'pygame', 'pgu',
-            #     ],
-            #     'excludes': [
-            #         'numpy',
-            #     ],
-            #     'ignores': [
-            #         # all database modules
-            #         'pgdb', 'Sybase', 'adodbapi',
-            #         'kinterbasdb', 'psycopg', 'psycopg2', 'pymssql',
-            #         'sapdb', 'pysqlite2', 'sqlite', 'sqlite3',
-            #         'MySQLdb', 'MySQLdb.connections',
-            #         'MySQLdb.constants.CR', 'MySQLdb.constants.ER',
-            #         # old datetime equivalents
-            #         'DateTime', 'DateTime.ISO',
-            #         'mx', 'mx.DateTime', 'mx.DateTime.ISO',
-            #         # email modules
-            #         'email.Generator', 'email.Iterators', 'email.Utils',
-            #     ],
-            # },
+            'py2exe': {
+                'skip_archive': 1,
+                'dist_dir': 'dist/suspended-sentence-%s' % version.VERSION_STR,
+                'packages': [
+                    'logging', 'encodings', 'gamelib',
+                ],
+                'includes': [
+                    # pygame
+                    'pygame', 'albow',
+                ],
+                'excludes': [
+                    'numpy',
+                ],
+                'ignores': [
+                    # all database modules
+                    'pgdb', 'Sybase', 'adodbapi',
+                    'kinterbasdb', 'psycopg', 'psycopg2', 'pymssql',
+                    'sapdb', 'pysqlite2', 'sqlite', 'sqlite3',
+                    'MySQLdb', 'MySQLdb.connections',
+                    'MySQLdb.constants.CR', 'MySQLdb.constants.ER',
+                    # old datetime equivalents
+                    'DateTime', 'DateTime.ISO',
+                    'mx', 'mx.DateTime', 'mx.DateTime.ISO',
+                    # email modules
+                    'email.Generator', 'email.Iterators', 'email.Utils',
+                ],
+            },
             'py2app': {
                 'argv_emulation': 1,
-                # 'iconfile': 'data/icons/foxassault.icns',
-#                 'dist_dir': 'dist/foxassault-%s' % version.VERSION_STR,
+                # 'iconfile': 'Resources/icons/suspended.icns',
+#                 'dist_dir': 'dist/suspended-sentence-%s' % version.VERSION_STR,
 #                 'bdist_base': 'build/bdist',
                 'packages': [
                     'logging', 'encodings', 'pygame', 'albow', 'gamelib', 'Resources',