当前位置: 首页>>代码示例>>Python>>正文


Python Engine.generateUUID方法代码示例

本文整理汇总了Python中Engine.generateUUID方法的典型用法代码示例。如果您正苦于以下问题:Python Engine.generateUUID方法的具体用法?Python Engine.generateUUID怎么用?Python Engine.generateUUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Engine的用法示例。


在下文中一共展示了Engine.generateUUID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: generateFilters

# 需要导入模块: import Engine [as 别名]
# 或者: from Engine import generateUUID [as 别名]
def generateFilters( baseDir, sourceFiles_, uuidBase ):
    result  = '<?xml version="1.0" encoding="utf-8"?>\n'
    result += '<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\n'
    
    sourceFiles = copy.deepcopy(sourceFiles_)
    worklist = []
    
    # Generate the folder structure
    result += '\t<ItemGroup>\n'
    folderComponents = set()
    for folder in [x.folderPath for x in sourceFiles]:
        if len(folder) == 0:
            continue
        #print folder
        candidate = []
        for i in xrange(len(folder)):
            folderComponents.add( '\\'.join(folder[0:i+1]) )
    
    for folder in sorted(folderComponents):
        if len(folder) == 0:
            continue
        uuid = Engine.generateUUID(uuidBase, folder)
        result += '\t\t<Filter Include="%s">\n' % folder
        result += '\t\t\t<UniqueIdentifier>{%s}</UniqueIdentifier>\n' % uuid
        result += '\t\t</Filter>\n'
    result += '\t</ItemGroup>\n'
    
    # Insert references to the actual files
    for rule, exts in FILTER_GROUPS:
        result += '\t<ItemGroup>\n'
        for item in sorted(sourceFiles, FileItem.sortOnFileName):
            if item.ext in exts:
                folder = '\\'.join(item.folderPath)
                relative = PathHelp.relative(baseDir, item.fullpath)
                if len(folder) == 0:
                    result += '\t\t<%s Include="%s" />\n' % (rule, relative)
                else:
                    result += '\t\t<%s Include="%s">\n' % (rule, relative)
                    result += '\t\t\t<Filter>%s</Filter>\n' % folder
                    result += '\t\t</%s>\n' % rule
            else:
                worklist.append(item)
        sourceFiles = worklist
        worklist = []
            
        result += '\t</ItemGroup>\n'

    result += '\t<ItemGroup>\n'
    for item in sorted(sourceFiles, FileItem.sortOnFileName):
        folder = '\\'.join(item.folderPath)
        relative = PathHelp.relative(baseDir, item.fullpath)
        rule = 'None'
        if 'customrule' in item.options.keys():
            rule = 'CustomBuild'
        if 'customvcbuild' in item.options.keys():
            rule = 'CustomBuild'
        if len(folder) == 0:
            result += '\t\t<%s Include="%s" />\n' % (rule, relative)
        else:
            result += '\t\t<%s Include="%s">\n' % (rule, relative)
            result += '\t\t\t<Filter>%s</Filter>\n' % folder
            result += '\t\t</%s>\n' % rule
    result += '\t</ItemGroup>\n'

    result += '</Project>\n'
    return result
开发者ID:funhatch,项目名称:badgerconfig,代码行数:68,代码来源:GenerateProject.py


注:本文中的Engine.generateUUID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。