def METHOD_NAME(env, bundledir, app,
               key, info_plist,
               typecode='BNDL', creator='SapP',
               icon_file='#macosx-install/sapphire-icon.icns',
               subst_dict=None,
               resources=[]):
    """Install a bundle into its dir, in the proper format"""
    # Substitute construction vars:
    for a in [bundledir, key, info_plist, icon_file, typecode, creator]:
        a = env.subst(a)
    if SCons.Util.is_List(app):
        app = app[0]
    if SCons.Util.is_String(app):
        app = env.subst(app)
        appbase = basename(app)
    else:
        appbase = basename(str(app))
    if not ('.' in bundledir):
        bundledir += '.$BUNDLEDIRSUFFIX'
    bundledir = env.subst(bundledir) # substitute again
    suffix=bundledir[string.rfind(bundledir,'.'):]
    if (suffix=='.app' and typecode != 'APPL' or
        suffix!='.app' and typecode == 'APPL'):
        raise Error("MakeBundle: inconsistent dir suffix %s and type code %s: app bundles should end with .app and type code APPL."%(suffix, typecode))
    if subst_dict is None:
        subst_dict={'%SHORTVERSION%': '$VERSION_NUM',
                    '%LONGVERSION%': '$VERSION_NAME',
                    '%YEAR%': '$COMPILE_YEAR',
                    '%BUNDLE_EXECUTABLE%': appbase,
                    '%ICONFILE%': basename(icon_file),
                    '%CREATOR%': creator,
                    '%TYPE%': typecode,
                    '%BUNDLE_KEY%': key}
    env.Install(bundledir+'/Contents/MacOS', app)
    f=env.SubstInFile(bundledir+'/Contents/Info.plist', info_plist,
                    SUBST_DICT=subst_dict)
    env.Depends(f,SCons.Node.Python.Value(key+creator+typecode+env['VERSION_NUM']+env['VERSION_NAME']))
    env.WriteVal(target=bundledir+'/Contents/PkgInfo',
                 source=SCons.Node.Python.Value(typecode+creator))
    resources.append(icon_file)
    for r in resources:
        if SCons.Util.is_List(r):
            env.InstallAs(join(bundledir+'/Contents/Resources',
                                       r[1]),
                          r[0])
        else:
            env.Install(bundledir+'/Contents/Resources', r)
    return [ SCons.Node.FS.default_fs.Dir(bundledir) ]