OS X build.
authorJeremy Thurgood <firxen@gmail.com>
Sat, 17 May 2014 18:30:29 +0000 (20:30 +0200)
committerJeremy Thurgood <firxen@gmail.com>
Sat, 17 May 2014 18:30:29 +0000 (20:30 +0200)
packaging/darwin-py2app.sh [new file with mode: 0755]
setup.py

diff --git a/packaging/darwin-py2app.sh b/packaging/darwin-py2app.sh
new file mode 100755 (executable)
index 0000000..8af8829
--- /dev/null
@@ -0,0 +1,63 @@
+#!/bin/sh
+# Copyright 2009 Jeremy Thurgood <firxen@gmail.com>
+# GPL - see COPYING for details
+#
+# Usage: darwin-py2app
+
+GAME_NAME=`sed -ne 's/NAME_STR = "\(.*\)"/\1/p' setup.py`
+GAME_VERSION=`sed -ne 's/VERSION_STR = "\(.*\)"/\1/p' setup.py`
+BUILD_NAME="${GAME_NAME}-${GAME_VERSION}"
+BUILD_FOLDER="build/${BUILD_NAME}"
+DMG_NAME="${BUILD_NAME}.dmg"
+PY2APP_LOG="py2app.log"
+
+BASEDIR=`pwd`
+
+echo "=== Setting up build environment ==="
+
+python setup.py sdist > /dev/null
+mkdir build
+(cd build; tar xzf ../dist/${BUILD_NAME}.tar.gz)
+
+echo "[${BUILD_FOLDER}]"
+cd ${BUILD_FOLDER}
+echo "$PWD"
+
+echo ""
+echo "=== Running python setup.py ==="
+echo "  ${GAME_NAME} version: ${GAME_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 "=== Adding magic icon ==="
+echo ""
+
+cp data/icons/*.icns dist/${GAME_NAME}.app/Contents/Resources/
+
+echo "=== Building DMG ==="
+echo ""
+
+cd ${BASEDIR}
+
+pwd
+rm dist/${DMG_NAME} > /dev/null
+
+echo -e "For some reason the game starts without a foreground window. Click on the icon in the dock (or minimize and restore from the menu) to get it back.\n\nIf this doesn't work, please let me (<firxen@gmail.com>) know, especially if you have any ideas about how to fix it.\n\nYou should also be able to use the unix tarball available at the same place you got this dmg.\n\nThanks." > ${BUILD_FOLDER}/dist/IMPORTANT\ NOTE.txt
+
+hdiutil create -volname ${GAME_NAME} -srcfolder ${BUILD_FOLDER}/dist/*.app/ -srcfolder ${BUILD_FOLDER}/dist/IMPORTANT\ NOTE.txt dist/${DMG_NAME}
+
+echo ""
+echo "=== Done ==="
+echo ""
+du -sh dist/* | sed 's/^/   /'
+echo ""
+
index 49e8fffbda9d9f1acced73b9fd20c32bbf7621c4..abbfcb43079918e648ca7a7498191d5cdcfcdd31 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -16,8 +16,11 @@ try:
 except ImportError:
     pass
 
+
 # This should probably be pulled from constants.py
+# These two constants are used by darwin-py2app.sh.
 VERSION_STR = "0.1"
+NAME_STR = "robolock-II"
 
 
 class NajaSdist(sdist):
@@ -33,7 +36,7 @@ class NajaInstall(install):
 
 
 setup(
-    name="robolock-II",
+    name=NAME_STR,
     version=VERSION_STR,
     description="Robolock II - a puzzle game",
 
@@ -114,10 +117,10 @@ setup(
                 'pygame',
             ],
             'excludes': [
-                'numpy', 'pygame.sdlmain_osx', 'winreg', 'AppKit', 'Foundation',
-                'Numeric', 'OpenGL.GL', '_scproxy', '_sysconfigdata',
-                'copyreg', 'dummy.Process', 'pkg_resources', 'queue',
-                'win32evtlog', 'win32evtlogutil',
+                'numpy', 'pygame.sdlmain_osx', 'winreg', 'AppKit',
+                'Foundation', 'Numeric', 'OpenGL.GL', '_scproxy',
+                '_sysconfigdata', 'copyreg', 'dummy.Process', 'pkg_resources',
+                'queue', 'win32evtlog', 'win32evtlogutil',
             ],
             'ignores': [
                 # all database modules
@@ -136,7 +139,7 @@ setup(
         'py2app': {
             'app': ['run_game.py'],
             'argv_emulation': True,
-            'iconfile': 'data/icons/program/icon.icns',
+            'iconfile': 'data/icons/robolock.icns',
             'packages': [
                 'logging', 'encodings', 'pygame', 'naja', 'data',
             ],