[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Pygame to Mac App Store (in progress)



Been meaning to post this for a while, but kept getting distracted. Here is the script we use to create a build of The Witch's Yarn for the Mac App Store. Note: I have yet to successfully post the game to the story, because I screwed up the original certs. Then the whole Lion disappointment popped up, and now I'm just waiting for the SDL fix. Then I try another crack at it. Until then here's what been working for us to make the bundle:



# Python script for building AppStore-friendly app bundle

import sys
import os
import subprocess

# build parameters
python = '/Library/Frameworks/Python.framework/Versions/2.5/bin/python'
codesign_cmd = '/usr/bin/codesign'
productbuild_cmd = '/usr/bin/productbuild'
projectname = "The Witch's Yarn"
appname = projectname+".app"
pkgname = projectname+".pkg"
app_signing_identity = "3rd Party Mac Developer Application: Mousechief"
pkg_signing_identity = "3rd Party Mac Developer Installer: Mousechief"

def bundlebuild(project_path):
    print "Building "+projectname+" application bundle..."
    args = [python,'Setup.py','py2app']
    os.chdir(project_path)
    p = subprocess.call(args)
    return p

def codesign(bundle_path):
    print "Codesigning "+projectname+" application bundle..."
    args = [codesign_cmd, '-s', app_signing_identity, bundle_path]
    p = subprocess.call(args)
    return p

def productbuild(bundle_path):
    print "Building "+projectname+" installer package..."
    installdir = '/Applications'
    args = [productbuild_cmd, '--component', bundle_path, installdir, '--sign', pkg_signing_identity, pkgname]
    p = subprocess.call(args)
    return p

def main():
    root_path = os.path.split(os.path.abspath(sys.argv[0]))[0]
    project_path = os.path.join(root_path,"project")
    bundlebuild(project_path)
    bundle_path = os.path.join(project_path,"dist/"+projectname+".app")
    codesign(bundle_path)
    #productbuild(bundle_path)

main()