本文整理汇总了Python中Engine.replaceKeywords方法的典型用法代码示例。如果您正苦于以下问题:Python Engine.replaceKeywords方法的具体用法?Python Engine.replaceKeywords怎么用?Python Engine.replaceKeywords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Engine
的用法示例。
在下文中一共展示了Engine.replaceKeywords方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import Engine [as 别名]
# 或者: from Engine import replaceKeywords [as 别名]
#.........这里部分代码省略.........
if 'outputfilename' not in projectDict:
projectDict['outputfilename'] = '$(ProjectName)'
outputfile = '$(TargetName)$(TargetExt)'
outputext = CONFIGTYPE_TABLE_EXT[generalDict['type']]
if 'outputfile' in projectDict:
outputfile = os.path.normpath(projectDict['outputfile'])
outputdir = os.path.dirname(outputfile)
projectDict['outputfolder'] = outputdir + '\\'
projectDict['outputfilename'] = os.path.splitext(os.path.basename(outputfile))[0]
outputext = os.path.splitext(outputfile)[1]
for configType in Engine.CONFIGURATION_NAMES__NAKED:
configOutputfolder = configType.lower() + 'outputfolder'
if configOutputfolder not in projectDict:
projectDict[configOutputfolder] = projectDict['outputfolder']
# the output file needs to use the outdir
configOutputfile = configType.lower() + 'outputfile'
configOutputfilename = configType.lower() + 'outputfilename'
projectDict[configOutputfile] = '$(OutDir)\\' + os.path.basename(outputfile)
projectDict[configOutputfilename] = projectDict['outputfilename']
# We also need to set the extension, otherwise msbuild will complain if we change the extension to something non-standard
# (e.g. think maya .mll files for regular .dll file)
configOutputExt = configType.lower() + 'outputext'
projectDict[configOutputExt] = outputext
# Ensure that we have a debuginformation format
if 'debuginformationformat' not in projectDict:
projectDict['debuginformationformat'] = '3'
projectDict['debuginformationformat_debug'] = '3'
if 'debuginformationformat_debug' not in projectDict:
projectDict['debuginformationformat_debug'] = projectDict['debuginformationformat']
projectDict['debuginformationformat'] = transformToVS2010(projectDict['debuginformationformat'])
projectDict['debuginformationformat_debug'] = transformToVS2010(projectDict['debuginformationformat_debug'])
# Make sure that we have something for the OpenMP key.
if 'openmp' not in projectDict:
projectDict['openmp'] = 'false'
# read the template
template = readTemplate(generalDict, projectDict)
if len(template) == 0:
logging.debug('No template found for this platform')
return 0
template = template.replace('{{{DEBUGNAME}}}', Engine.CONFIGURATION_NAMES__NAKED[0].upper())
template = template.replace('{{{RELEASENAME}}}', Engine.CONFIGURATION_NAMES__NAKED[1].upper())
template = template.replace('{{{PROFILENAME}}}', Engine.CONFIGURATION_NAMES__NAKED[2].upper())
template = template.replace('{{{FINALNAME}}}', Engine.CONFIGURATION_NAMES__NAKED[3].upper())
template = template.replace('{{{PRECOMPILEDUSAGE}}}', getGlobalPCHString(sourceFiles, projectDict))
fileSection = generateFiles( os.path.dirname(targetName), sourceFiles, projectDict )
template = template.replace('{{{FILESECTION}}}', fileSection )
referenceSection = generateReferences(basePath, platformName, solutionDict)
template = template.replace('{{{REFERENCESSECTION}}}', referenceSection )
#
# Now we can override the postbuild and prelink commands for each configuration...
#
def setConfigKey(keyname):
candidate = ''
if keyname in projectDict.keys():
candidate = projectDict[keyname]
for config in Engine.CONFIGURATION_NAMES__NAKED:
name = config.lower() + keyname
if name in projectDict.keys():
continue
projectDict[name] = candidate
#print 'KEY: %32s = %s' % (name, candidate)
setConfigKey('postbuildcommand')
setConfigKey('prelinkcommand')
#
# Some of the keywords needs some special attention before they can be inserted into the xml file.
# Set the rules before calling the substiution engine.
fixupRules = {}
fixupRules['uuid'] = [addBraces, string.upper]
fixupRules['includepaths'] = [lambda x: Engine.ensureLeadingSeparator(x,';')]
fixupRules['defines'] = [lambda x: Engine.ensureLeadingSeparator(x,';')]
fixupRules['disabledvcwarnings'] = [lambda x: Engine.ensureLeadingSeparator(x,';')]
fixupRules['libraries'] = [lambda x: convertSpaceToSemicolon(x)]
project = Engine.replaceKeywords(basePath, template, projectDict, fixupRules)
# All is now done, try to write the target file to disk...
Engine.writeConfigFile( targetName, project )
# VS2010 has a user defined filters file on the side...
filters = generateFilters(os.path.dirname(targetName), sourceFiles, generalDict['name'] + platformName)
Engine.writeConfigFile( targetName + '.filters', filters )
except SyntaxError, e:
logging.error( str(e) )
return 1