⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 umake_cwxml_ascript.py

📁 linux下的一款播放器
💻 PY
📖 第 1 页 / 共 3 页
字号:
        ## listed sources        ##        use_export_file = 0                for source in mprj.source_list:            if string.lower(source[-4:]) == ".exp":                use_export_file = 1                break        if use_export_file:            ppc_pef["MWPEF_exports"] = "PragmaAndFile"        else:            ppc_pef["MWPEF_exports"] = "Pragma"    ## tweak the PPC Linker settings    ppc_linker = mprj.preferences["PPC Linker"]    if mprj.target_type == "lib" or mprj.target_type == "dll":        if not ppc_linker.has_key("MWLinker_PPC_initname"):            ppc_linker["MWLinker_PPC_initname"] = "__initialize"        if not ppc_linker.has_key("MWLinker_PPC_termname"):            ppc_linker["MWLinker_PPC_termname"] = "__terminate"        if not ppc_linker.has_key("MWLinker_PPC_mainname"):            ppc_linker["MWLinker_PPC_mainname"] = ""    elif mprj.target_type == "exe":        if not ppc_linker.has_key("MWLinker_PPC_initname"):            ppc_linker["MWLinker_PPC_initname"] = ""        if not ppc_linker.has_key("MWLinker_PPC_termname"):            ppc_linker["MWLinker_PPC_termname"] = ""        if not ppc_linker.has_key("MWLinker_PPC_mainname"):            ppc_linker["MWLinker_PPC_mainname"] = "__start"    return mprj            ## replace the text between <VALUE> and </VALUE>, just after the key, with theValue## eg. <SETTING><NAME>MWProject_PPC_outfile</NAME><VALUE>pndebug.lib</VALUE></SETTING>def SetPreferenceValue(theText, theKey, newValue):    d = "<SETTING><NAME>" + theKey + "</NAME><VALUE>"    start = string.index(theText, d)    end = string.index(theText, "</VALUE>", start + len(d))    return theText[:start+len(d)]+newValue+theText[end:]    ## this function is used to set file list items, user access paths, group## list items, etc.', replaces an instance of theSearchString with an XML## block for each value in theValues', theTemplate describes the XML block;## THE_VALUE# in the template is replaced with each item in theValues',## theValuess is a comma delimited list of values like files,user access paths',def SetPreferenceBlock(theText, theValues, theTemplate, theSearchString):    formattedValues = SetPrefBlockValues(theTemplate, theValues)    return string.replace(theText, theSearchString, formattedValues)def SetPrefBlockValues(theTemplate, theValues):    ret = ""    for aValue in string.split(theValues,","):        ret = ret + string.replace(theTemplate,"#THE_VALUE#", aValue)    return retdef SetAccessPathBlock(theText, paths, recursives, origins, theSearchString):    gAccessPathBlockString="""                   <SETTING>                       <SETTING><NAME>SearchPath</NAME>                           <SETTING><NAME>Path</NAME><VALUE>#PATH#</VALUE></SETTING>                           <SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>                           <SETTING><NAME>PathRoot</NAME><VALUE>#PathRoot#</VALUE></SETTING>                       </SETTING>                       <SETTING><NAME>Recursive</NAME><VALUE>#Recursive#</VALUE></SETTING>                       <SETTING><NAME>FrameworkPath</NAME><VALUE>#Framework#</VALUE></SETTING>                       <SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>                   </SETTING>"""    formattedValues = ""    i = 0;    for path in paths:        tmp=gAccessPathBlockString        if os.path.isabs(path) and path[0] != '#':            tmp=string.replace(tmp, "#PathRoot#", "Absolute")            ## Required ugly KLUGE            if os.environ.get("FAKE_MAC","NO") == "YES":                import posixpath                path=posixpath.normpath(path)                tmp=string.replace(tmp, "MacOS", "Unix")                # set the path            tmp=string.replace(tmp, "#PATH#", path)        # set the path root        if theSearchString == "#USER_SEARCH_PATHS#":            # to be safe and compatible -- ignore recursive and origin flags            tmp=string.replace(tmp, "#PathRoot#", "Project")            tmp=string.replace(tmp, "#Recursive#", "false")            tmp=string.replace(tmp, "#Framework#", "false")        else:            # to be safe and compatible -- ignore recursive and origin flags UNLESS we have a System origin            if ((len(recursives) == len(paths)) and (len(origins) == len(paths)) and (string.find(origins[i], "system") >= 0)):                # system framework... honor the origin, and recursive                tmp=string.replace(tmp, "#PathRoot#", "OS X Volume")                tmp=string.replace(tmp, "#Framework#", "true")                if (string.find(recursives[i], "true") >= 0):                    tmp=string.replace(tmp, "#Recursive#", "true")                else:                    tmp=string.replace(tmp, "#Recursive#", "false")            else:                # not a system framework... business as usual                tmp=string.replace(tmp, "#PathRoot#", "CodeWarrior")                tmp=string.replace(tmp, "#Recursive#", "true")                tmp=string.replace(tmp, "#Framework#", "false")               formattedValues = formattedValues + tmp        i = i+1            return string.replace(theText, theSearchString, formattedValues)def SetFileListBlock(theText, theValues, theSearchString, projectType, fileTypes):    gFileBlockString = """                <FILE>                    <PATHTYPE>Name</PATHTYPE>                    <PATH>#THE_VALUE#</PATH>                    <PATHFORMAT>MacOS</PATHFORMAT>                    <FILEKIND>#FileKind#</FILEKIND>                    <FILEFLAGS>#FileFlags#</FILEFLAGS>                </FILE>"""    formattedValues=SetPrefBlockValues(gFileBlockString, theValues)    formattedValues=string.replace(formattedValues, "#FileKind#", projectType)    formattedValues=string.replace(formattedValues, "#FileFlags#", fileTypes)    return string.replace(theText, theSearchString, formattedValues)def SetGroupBlock(theText, theValues, theSearchString, targetName):    gGroupBlockString= """               <FILEREF>               <TARGETNAME>#target#</TARGETNAME>               <PATHTYPE>Name</PATHTYPE>               <PATH>#THE_VALUE#</PATH>               <PATHFORMAT>MacOS</PATHFORMAT>               </FILEREF>"""    formattedValues=SetPrefBlockValues(gGroupBlockString, theValues)    formattedValues=string.replace(formattedValues, "#target#", targetName)    return string.replace(theText, theSearchString, formattedValues)def SetFrameworkBlock(theText, theValues, theSearchString):    gFrameworkBlockString="""                <FRAMEWORK>                    <FILEREF>                        <PATHTYPE>Name</PATHTYPE>                        <PATH>#THE_VALUE#.framework</PATH>                        <PATHFORMAT>MacOS</PATHFORMAT>                    </FILEREF>                    <DYNAMICLIBRARY>#THE_VALUE#</DYNAMICLIBRARY>                </FRAMEWORK>"""    formattedValues=SetPrefBlockValues(gFrameworkBlockString, theValues)    return string.replace(theText, theSearchString, formattedValues)def WriteProjectSettingsXML(mprj, templateName):    """ Writes out the Applescript which writes the <SETTINGS> section of    the CodeWarrior XML. This includes all the CW project preferences,    source file list and link order.  This function is used to write    out the settings for 'project.xml' and 'project_uber.xml' """    template_filename = os.path.join(os.environ['BUILD_ROOT'],"bin","mac", templateName)    template_text = open(template_filename,"r").read()                     ## set access paths    user_list = []    if templateName == "project_uber.xml":          # uber can't have local paths eg. ':', ':pub:'        # they must be like '::pndebug:', '::pndebug:pub:'        module_path = os.getcwd()        src_root_path = macpath.normpath(os.path.join(module_path,mprj.project.src_root_path))+":"                for (path, recursive, origin) in mprj.user_paths:            umake_lib.debug("USER_PATH: %s => (%s)" %                            (repr(path),                             repr(mprj.project.src_root_path)))            path = macpath.normpath(macpath.join(module_path, path))            if path[:len(src_root_path)] == src_root_path:                path = "#SRC_ROOT_PATH#" + path[len(src_root_path):]            umake_lib.debug("USER_PATH: => %s (%s)" %                            (repr(path),                             repr(src_root_path)))            user_list.append(path)    else:        for (path, recursive, origin) in mprj.user_paths:            path = macpath.normpath(path)            user_list.append(path)    ## Set CodeWarrior prefs    empty_list = []    template_text = SetAccessPathBlock(template_text,                                       user_list,                                       empty_list,                                       empty_list,                                       "#USER_SEARCH_PATHS#")    system_list = []    recursive_list = []    origin_list = []    for (path, recursive, origin) in mprj.system_paths:        system_list.append(path)        recursive_list.append(recursive)        origin_list.append(origin)    template_text = SetAccessPathBlock(template_text,                                       system_list,                                       recursive_list,                                       origin_list,                                       "#SYSTEM_SEARCH_PATHS#")    ## add files    file_list = string.join(mprj.source_list, ',')    source_dir,output_dir = macpath.split(mprj.output_dir_path)        target_type = ''    if output_dir == "debug":        target_type = "debug"    template_text = SetFileListBlock(template_text,                                     file_list,                                     "#TEXT_FILE_LIST#",                                     "Text",                                     target_type)    source_list = []    for file_name in mprj.source_list:        source_list.append(file_name)    if len(mprj.library_list):        library_list = string.join(mprj.library_list, ',')        template_text = SetFileListBlock(template_text,                                         library_list,                                         "#LIB_FILE_LIST#",                                         "Library",                                         "")        # add libs to source list since they need to be        # included with groups, link order iterms        for library in mprj.library_list:            lib_path, lib_name = os.path.split(library)            if lib_name not in mprj.source_list:                source_list.append(lib_name)    else:        template_text=string.replace(template_text, "#LIB_FILE_LIST#", "")            # link order    file_list = string.join(source_list, ',')    gLinkOrderBlockString="""                <FILEREF>                    <PATHTYPE>Name</PATHTYPE>                    <PATH>#THE_VALUE#</PATH>                    <PATHFORMAT>MacOS</PATHFORMAT>                </FILEREF>"""    template_text = SetPreferenceBlock(template_text,                                       file_list,                                       gLinkOrderBlockString,                                       "#LINK_ORDER_ITEMS#")        ## add frameworks    if len(mprj.project.sys_frameworks):        framework_string_list = string.join(mprj.project.sys_frameworks, ',')        template_text=SetFrameworkBlock(template_text,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -