Source

pygame / symbian / BuildPygameRelease.py

""" Full build configuration for pygame 
For SVN support, install pysvn.
"""

import sys
import time
import os
import shutil

import build_config as config

from glob import glob
from scons_symbian.config.constants import CAPS_SELF_SIGNED
from scons_symbian.arguments import COMPILER, RELEASE


BASE_CMD = "scons dosis=true"

UID_PACKAGE   = 0xE0006020
__uid = UID_PACKAGE 
def getuid(): 
    global __uid
    __uid += 1
    return __uid  

UID_PYGAMEAPP = getuid()
UID_SDL       = getuid()
UID_JPEG      = getuid()

#: Base uid for PyS60 CE scripts
UID_BASE = getuid()

#: Capability configuration
CAPABILITIES = CAPS_SELF_SIGNED[:]
CAPABILITIES.remove("UserEnvironment") # Missing from sdl.dll
CAPABILITIES = "+".join(CAPABILITIES)

def dobuild(args):    
    cmd = ""
    for x in args:
        cmd += "%s=%s " % ( x, str(args[x]) )
    
    cmd = " ".join( [BASE_CMD, cmd] )
    cmd = " ".join( [cmd] + sys.argv[1:] )

    print cmd
    if os.system( cmd ): 
        raise SystemExit( "Error: Build failed" )
    

def build():

    version = list(time.gmtime()[:3])    
    version = [ str(x).zfill(2) for x in version ]
    version = "".join( version )
        
    sisname = "python_for_pygame_%s.sis" % version
    
    args = { "applications" : "",
             "capabilities" : CAPABILITIES,
             "builtin"      : "sysinfo,socket",
             #"pyds"         : "gles",
             "basename"     : "pygame_python",            
             "uidbase"      : hex(UID_BASE).replace("L",""),             
             "sisappname"   : '"Python for Pygame"',
             # Convert to int or may be converted to octal due to zero at beginning
             'sisversion'   : '"(1,%d,%d%s)"' % ( int(version[2:4]), int( version[4:6]),version[6:]),
             'pythonsis'    : sisname,
             'libpath'      : "data/pygame/libs",
             'pycompiler'   : "d:\\python22\\python.exe"
             }
    
    # Add certificate stuff
    if config.cert is not None:
        args['cert'] = config.cert        
        args['privkey'] = config.privkey
        args['passphrase'] = config.passphrase
        
    # Build PyS60 CE
    sisname   = ""  
    if config.build_python:
        curdir = os.getcwd()
        os.chdir(config.pys60_ce_src)   
        a = args.copy()
        a["gcce_options"] = '"-O2 -fno-unit-at-a-time"'             
        dobuild(a)    
        os.chdir(curdir)
    
        sisname = "python_for_pygame_%s_signed.sisx" % version
        pys60_sis = os.path.join( config.pys60_ce_src, sisname )
                
        # Copy the sis to current directory
        if os.path.exists(pys60_sis):
            import shutil
            shutil.copyfile(pys60_sis, sisname)
        
        args['pythondll'] =  args['basename']
         
    else:
        sisname = config.pys60_sis
        if config.pythondll is not None:
            args['pythondll'] = config.pythondll
     
    # Build pygame
    args["pythonsis"]  = sisname
    args["pythonsis"]  = sisname
    args["sisappname"] = '"pygame for S60"' 
    args['sisversion'] = '1,%d,%d%s' % ( int(version[2:4]), int( version[4:6]),version[6:])
    args['sisuid'] = hex(UID_PACKAGE).replace("L","")
    args['appuid'] = hex(UID_PYGAMEAPP).replace("L","")
    args['sdluid'] = hex(UID_SDL).replace("L","")
    args['jpeguid']= hex(UID_JPEG).replace("L","")
    args['pythoninclude'] = config.pythoninclude
    args['defines'] = "STDERR_TO_STDOUT"
    args['winscw_options'] = "-nostderr" # Don't show the stdioserver output
    dobuild(args)
    
    
if __name__ == "__main__":
    build() 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.