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

📄 macuber.py

📁 linux下的一款播放器
💻 PY
📖 第 1 页 / 共 2 页
字号:
                        uber_template = string.replace(template2, tag3, tag3 + '\n' + uber_text_3, 1)                                # if we found any uber.xml files, generate the master uber.xml file                if len(success_list) > 0:                                outmsg.send("Extracted uber-project XML from %s" % (string.join(success_list, ", ")))                                # insert the Make All subtarget list                make_all_dependencies_section_xml = MakeDependenciesSubtargetListXML(all_module_targetnames_list)                uber_template = string.replace(uber_template, tag4, make_all_dependencies_section_xml, 1)                                # remove the placeholder tags from the template                uber_template = string.replace(uber_template, tag1, "", 1)                uber_template = string.replace(uber_template, tag2, "", 1)                uber_template = string.replace(uber_template, tag3, "", 1)                                outmsg.send("Writing %s" % (uberxml_output_name))                                # write out the file into an uber directory in the source directory                try:                        if not os.path.isdir(uber_dir):                                os.mkdir(uber_dir)                                                os.chdir(uber_dir)                                                # delete any old xml file with the same name as our uber                        if os.path.isfile(uberxml_output_name):                                os.remove(uberxml_output_name)                                                uber_template_outfile = open(uberxml_output_name, 'w')                        uber_template_outfile.write(uber_template)                        uber_template_outfile.close()                except IOError:                        outmsg.send( "*** Failed to write file %s" % (uberxml_output_name) )                if len(failure_list) > 0:                outmsg.send("Failed to find uber-project XML from %s" % (string.join(failure_list, ", ")))                os.chdir(old_dir)        returndef MakeDependenciesSubtargetListXML(subtarget_list):        # given a list of modules, make a <SUBTARGETLIST> XML section                subtarget_list = [ MakeDependencySubtargetEntry(x) for x in subtarget_list ]        subtarget_list_string = string.join(subtarget_list, '\n')                full_string = '<SUBTARGETLIST>' + subtarget_list_string + '</SUBTARGETLIST>'        return full_stringdef MakeDependencySubtargetEntry(module_name):        # given a module name, make a single <SUBTARGET><TARGETNAME> entry for the module name                dependencies_entry = '<SUBTARGET><TARGETNAME>' + module_name + '</TARGETNAME></SUBTARGET>\n'        return dependencies_entrydef GetUberTemplate():        # this returns the outermost XML template for the uber project XML        return """<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><?codewarrior exportversion="1.0.1" ideversion="4.2" ?><PROJECT>    <TARGETLIST>#TARGET#    <TARGET><NAME>Make All</NAME>#MAKE_ALL_SUBTARGETS#</TARGET>    </TARGETLIST>    <TARGETORDER>#TARGETORDER#      <ORDEREDTARGET><NAME>Make All</NAME></ORDEREDTARGET>    </TARGETORDER>    <GROUPLIST>#GROUP#    </GROUPLIST></PROJECT>"""def build_uberproject(uber_xml_path, uber_project_path, script_path):                outmsg.send("Creating %s" % (os.path.basename(script_path)))                script = ascript.CreateAppleScript()                # this needs better handling/reporting of build errors        script.Append(                'tell application %s' % (os.environ["BUILD_SW"]),                '  with timeout of 99999 seconds',                '    try',                '      make new (project document) as "%s" with data ("%s")' % (uber_project_path, uber_xml_path),                '      set cwErrorList to Make Project with ExternalEditor',                '      Close Project',                '    on error errText number errnum',                '      return errText & return',                '    end try',                '  end timeout',                'end tell')        script.CompileAndSave(script_path)                if 0: # set to 1 to actually make the uber project                script.CompileAndExecute()def generate_ubersyms(build_list, uberxml_output_name, uber_dir):                sym_folder_name = uberxml_output_name + " xSYMs"        old_dir = os.getcwd()                # make a list of the module names we're building; we'll exclude        # any dependencies that are not in the list                modules_built_id_list = [ x.name for x in build_list ]                # look for sym files in the debug directory of each module                sym_file_paths = []        outmsg.send("Looking for sym files in %s" % (string.join(modules_built_id_list, ", ")))        for module_name in modules_built_id_list:                                module_dir = os.path.join(old_dir, module_name)                module_debug_dir = os.path.join(module_dir, "debug")                if os.path.isdir(module_debug_dir):                        os.chdir(module_debug_dir)                                                # find all sym files, and add the paths to those files to our sym_file_paths list                        sym_file_names = glob.glob("*.xSYM")                        sym_file_paths = sym_file_paths + [ os.path.join(module_debug_dir, x) for x in sym_file_names ]                if len(sym_file_paths) < 1:                outmsg.send("No xSYM files found")                os.chdir(old_dir)                return                # now make a folder containing aliases to the found sym files                   if not os.path.isdir(uber_dir):                os.mkdir(uber_dir)                syms_dir = os.path.join(uber_dir, sym_folder_name)        if not os.path.isdir(syms_dir):                os.mkdir(syms_dir)                os.chdir(syms_dir)                script = ascript.CreateAppleScript()                for alias_target_path in sym_file_paths:                                (target_dir, target_name) = os.path.split(alias_target_path)                alias_full_path = os.path.join(syms_dir, target_name)                                script.Append(                        'tell application "Finder"',                        '  try',                        '    if not (file "%s" exists) then' % (alias_full_path),                        '       make new alias file to (file "%s") at (folder "%s") with properties {name:"%s"}'                                         % (alias_target_path, syms_dir, target_name),                        '    end if',                        '   on error',                        '  end try',                        'end tell')                script_path = os.path.join(syms_dir, "Make Symfile Aliases Script")        script.CompileAndExecute()                os.chdir(old_dir)

⌨️ 快捷键说明

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