#
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
import os
import sys
import traceback
# To Do 1.set clean, 2. add item, if the line is disabled.
class TargetTool():
# VBox - begin
# VBox - end
TAB_TAT_DEFINES_ACTIVE_PLATFORM : None,
TAB_TAT_DEFINES_TOOL_CHAIN_CONF : None,
TAB_TAT_DEFINES_TARGET : None,
TAB_TAT_DEFINES_TOOL_CHAIN_TAG : None,
TAB_TAT_DEFINES_TARGET_ARCH : None,
TAB_TAT_DEFINES_BUILD_RULE_CONF : None,
}
else:
raise ParseError('LoadTargetTxtFile() : No Target.txt file exists.')
return 1
#
# Convert a text file to a dictionary
#
"""Convert a text file to a dictionary of (name:value) pairs."""
try:
for Line in f:
continue
or Key == TAB_TAT_DEFINES_ACTIVE_MODULE:
f.close()
return 0
except:
errMsg = ''
errMsg += " Missing %s configuration information, please use TargetTool to set value!" % Key + os.linesep
else:
if errMsg != '':
try:
existKeys = []
else:
else:
print "Warning: Found duplicate key item in original configuration files!"
if Num == 0:
else:
if ret != None:
print "Warning: %s does not exist in original configuration file" % key
if Line == None:
except:
Line = None
else:
else:
else:
return Line
__usage__ = "%prog [options] {args} \
\nArgs: \
gParamCheck = []
if option not in gParamCheck:
else:
if option not in gParamCheck:
else:
else:
def MyOptionParser():
parser = OptionParser(version=__version__,prog="TargetTool.exe",usage=__usage__,description=__copyright__)
parser.add_option("-a", "--arch", action="append", type="choice", choices=['IA32','X64','IPF','EBC', 'ARM','0'], dest="TARGET_ARCH",
help="ARCHS is one of list: IA32, X64, IPF, ARM or EBC, which replaces target.txt's TARGET_ARCH definition. To specify more archs, please repeat this option. 0 will clear this setting in target.txt and can't combine with other value.")
parser.add_option("-p", "--platform", action="callback", type="string", dest="DSCFILE", callback=SingleCheckCallback,
help="Specify a DSC file, which replace target.txt's ACTIVE_PLATFORM definition. 0 will clear this setting in target.txt and can't combine with other value.")
parser.add_option("-c", "--tooldef", action="callback", type="string", dest="TOOL_DEFINITION_FILE", callback=SingleCheckCallback,
help="Specify the WORKSPACE relative path of tool_def.txt file, which replace target.txt's TOOL_CHAIN_CONF definition. 0 will clear this setting in target.txt and can't combine with other value.")
parser.add_option("-t", "--target", action="append", type="choice", choices=['DEBUG','RELEASE','0'], dest="TARGET",
help="TARGET is one of list: DEBUG, RELEASE, which replaces target.txt's TARGET definition. To specify more TARGET, please repeat this option. 0 will clear this setting in target.txt and can't combine with other value.")
parser.add_option("-n", "--tagname", action="callback", type="string", dest="TOOL_CHAIN_TAG", callback=SingleCheckCallback,
help="Specify the Tool Chain Tagname, which replaces target.txt's TOOL_CHAIN_TAG definition. 0 will clear this setting in target.txt and can't combine with other value.")
parser.add_option("-r", "--buildrule", action="callback", type="string", dest="BUILD_RULE_FILE", callback=SingleCheckCallback,
help="Specify the build rule configure file, which replaces target.txt's BUILD_RULE_CONF definition. If not specified, the default value Conf/build_rule.txt will be set.")
parser.add_option("-m", "--multithreadnum", action="callback", type="int", dest="NUM", callback=RangeCheckCallback,
help="Specify the multi-thread number which replace target.txt's MAX_CONCURRENT_THREAD_NUMBER. If the value is less than 2, MULTIPLE_THREAD will be disabled. If the value is larger than 1, MULTIPLE_THREAD will be enabled.")
if __name__ == '__main__':
print "ERROR: WORKSPACE should be specified or edksetup script should be executed before run TargetTool"
if len(args) != 1 or (args[0].lower() != 'print' and args[0].lower() != 'clean' and args[0].lower() != 'set'):
print "The number of args isn't 1 or the value of args is invalid."
print "The MAX_CONCURRENT_THREAD_NUMBER must be larger than 0."
if elem == '0':
print "0 will clear the TARGET setting in target.txt and can't combine with other value."
if elem == '0':
print "0 will clear the TARGET_ARCH setting in target.txt and can't combine with other value."
try:
else:
except Exception, e: