changeset 102:322cbc0a8cce

Mac build stuff.
author Jeremy Thurgood <firxen@gmail.com>
date Tue, 24 Aug 2010 11:33:32 +0200
parents 19d784fd3918
children 0f799b6f40bc
files gamelib/main.py gamelib/version.py scripts/build_unix.sh scripts/darwin-py2app.sh setup.py
diffstat 5 files changed, 234 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/main.py	Tue Aug 24 09:58:12 2010 +0200
+++ b/gamelib/main.py	Tue Aug 24 11:33:32 2010 +0200
@@ -4,6 +4,13 @@
 
 '''
 
+# Albow looks for stuff in os.path[0], which isn't always where it expects.
+# The following horribleness fixes this.
+import sys
+import os.path
+right_path = os.path.dirname(os.path.dirname(__file__))
+sys.path.insert(0, right_path)
+
 import pygame
 from pygame.locals import SWSURFACE
 from albow.dialogs import alert
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gamelib/version.py	Tue Aug 24 11:33:32 2010 +0200
@@ -0,0 +1,81 @@
+"""Suspended Sentence Version Information"""
+
+VERSION = (0, 1, 0, 'alpha', 1)
+BASE_VERSION_STR = '.'.join([str(x) for x in VERSION[:3]])
+VERSION_STR = {
+    'final': BASE_VERSION_STR,
+    'alpha': BASE_VERSION_STR + 'a' + str(VERSION[4]),
+    'rc': BASE_VERSION_STR + 'rc' + str(VERSION[4]),
+}[VERSION[3]]
+
+NAME = 'Suspended Sentence'
+DESCRIPTION = 'Point-and-click adventure game written using Pygame.'
+
+PEOPLE = {
+    'Simon': ('Simon Cross', 'hodgestar+rinkhals@gmail.com'),
+    'Neil': ('Neil Muller', 'drnmuller+rinkhals@gmail.com'),
+    'Adrianna': ('Adrianna Pinska', 'adrianna.pinska+rinkhals@gmail.com'),
+    'Jeremy': ('Jeremy Thurgood', 'firxen+rinkhals@gmail.com'),
+    'Stefano': ('Stefano Rivera', 'stefano@rivera.za.net'),
+}
+
+AUTHORS = [
+    PEOPLE['Simon'],
+    PEOPLE['Neil'],
+    PEOPLE['Adrianna'],
+    PEOPLE['Jeremy'],
+    PEOPLE['Stefano'],
+]
+
+AUTHOR_NAME = AUTHORS[0][0]
+AUTHOR_EMAIL = AUTHORS[0][1]
+
+MAINTAINERS = AUTHORS
+
+MAINTAINER_NAME = MAINTAINERS[0][0]
+MAINTAINER_EMAIL = MAINTAINERS[0][1]
+
+ARTISTS = [
+    PEOPLE['Adrianna'],
+]
+
+DOCUMENTERS = [
+    PEOPLE['Simon'],
+]
+
+# SOURCEFORGE_URL = 'http://sourceforge.net/projects/XXXX/'
+# PYPI_URL = 'http://pypi.python.org/pypi/XXXX/'
+
+LICENSE = 'GPL'
+# LICENSE_TEXT = resource_string(__name__, 'COPYING')
+
+CLASSIFIERS = [
+    'Development Status :: 4 - Beta',
+    'Environment :: MacOS X',
+    'Environment :: Win32 (MS Windows)',
+    'Environment :: X11 Applications',
+    'Intended Audience :: End Users/Desktop',
+    'License :: OSI Approved :: GNU General Public License (GPL)',
+    'Natural Language :: English',
+    'Operating System :: Microsoft :: Windows',
+    'Operating System :: POSIX',
+    'Operating System :: MacOS :: MacOS X',
+    'Programming Language :: Python :: 2.5',
+    'Programming Language :: Python :: 2.6',
+    'Topic :: Games/Entertainment :: Turn Based Strategy',
+]
+
+PLATFORMS = [
+    'Linux',
+    'Mac OS X',
+    'Windows',
+]
+
+INSTALL_REQUIRES = [
+]
+
+# Install these manually
+NON_EGG_REQUIREMENTS = [
+    'setuptools',
+    'pygame',
+]
--- a/scripts/build_unix.sh	Tue Aug 24 09:58:12 2010 +0200
+++ b/scripts/build_unix.sh	Tue Aug 24 11:33:32 2010 +0200
@@ -4,7 +4,7 @@
 
 mkdir -p build/${GAME_NAME} dist
 
-cp -r README.txt run_game.py gamelib Resources build/${GAME_NAME}
+cp -r COPYING README.txt run_game.py setup.py gamelib Resources build/${GAME_NAME}
 
 cd build
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/darwin-py2app.sh	Tue Aug 24 11:33:32 2010 +0200
@@ -0,0 +1,53 @@
+#!/bin/sh
+# Copyright 2009 Jeremy Thurgood <firxen+rinkhals@gmail.com>
+# GPL - see COPYING for details
+#
+# Usage: darwin-py2app
+
+SS_VERSION=`PYTHONPATH=. python -c "from gamelib import version; print version.VERSION_STR"`
+BUILD_NAME="suspended-sentence-${SS_VERSION}"
+BUILD_FOLDER="build/captured"
+DMG_NAME="${BUILD_NAME}.dmg"
+PY2APP_LOG="py2app.log"
+
+BASEDIR=`pwd`
+
+echo "=== Setting up build environment ==="
+
+./scripts/clean.sh
+./scripts/build_unix.sh
+
+cd ${BUILD_FOLDER}
+
+# find data -name '*.svg' -delete
+
+echo ""
+echo "=== Running python setup.py ==="
+echo "  Suspended Sentence version: ${SS_VERSION}"
+echo "  Writing log to ${PY2APP_LOG}"
+
+python setup.py py2app >${PY2APP_LOG} 2>&1
+
+echo ""
+echo "=== Removing useless cruft that just takes up space ==="
+echo ""
+
+for dir in docs examples tests; do
+    find "dist/" -path "*/Resources/lib/*/pygame/${dir}/*" -delete
+done
+
+echo "=== Building DMG ==="
+echo ""
+
+cd ${BASEDIR}
+
+pwd
+rm dist/${DMG_NAME} > /dev/null
+hdiutil create -srcfolder ${BUILD_FOLDER}/dist/*.app/ dist/${DMG_NAME}
+
+echo ""
+echo "=== Done ==="
+echo ""
+du -sh dist/* | sed 's/^/   /'
+echo ""
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/setup.py	Tue Aug 24 11:33:32 2010 +0200
@@ -0,0 +1,92 @@
+# setup.py
+# -*- coding: utf8 -*-
+# vim:fileencoding=utf8 ai ts=4 sts=4 et sw=4
+
+"""Setuptools setup.py file for Suspended Sentence."""
+
+from setuptools import setup, find_packages
+from gamelib import version
+
+try:
+    import py2exe
+except ImportError:
+    pass
+
+setup   (   # Metadata
+            name = version.NAME,
+            version = version.VERSION_STR,
+            description = version.DESCRIPTION,
+
+            author = version.AUTHOR_NAME,
+            author_email = version.AUTHOR_EMAIL,
+
+            maintainer = version.MAINTAINER_NAME,
+            maintainer_email = version.MAINTAINER_EMAIL,
+
+            # url = version.SOURCEFORGE_URL,
+            # download_url = version.PYPI_URL,
+
+            # license = version.LICENSE,
+
+            # classifiers = version.CLASSIFIERS,
+
+            # platforms = version.PLATFORMS,
+
+            # Dependencies
+            install_requires = version.INSTALL_REQUIRES,
+
+            # Files
+            packages = find_packages(),
+            scripts = ['run_game.py'],
+
+            # py2exe
+            # console = ['scripts/testconsole.py'],
+            # windows = [{
+            #     'script': 'scripts/foxassault.py',
+            #     'icon_resources': [(0, "data/icons/foxassault.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',
+            #     ],
+            # },
+            'py2app': {
+                'argv_emulation': 1,
+                # 'iconfile': 'data/icons/foxassault.icns',
+#                 'dist_dir': 'dist/foxassault-%s' % version.VERSION_STR,
+#                 'bdist_base': 'build/bdist',
+                'packages': [
+                    'logging', 'encodings', 'pygame', 'albow', 'gamelib', 'Resources',
+                ],
+                'excludes': ['numpy'],
+            }},
+            data_files = [
+                # 'COPYRIGHT',
+                'COPYING',
+                'README.txt',
+            ],
+        )