BaseTools: Clean up source files
1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
@ -86,13 +86,13 @@ class TargetTool():
|
||||
if isinstance(self.TargetTxtDictionary[Key], type([])):
|
||||
print("%-30s = %s" % (Key, ''.join(elem + ' ' for elem in self.TargetTxtDictionary[Key])))
|
||||
elif self.TargetTxtDictionary[Key] is None:
|
||||
errMsg += " Missing %s configuration information, please use TargetTool to set value!" % Key + os.linesep
|
||||
errMsg += " Missing %s configuration information, please use TargetTool to set value!" % Key + os.linesep
|
||||
else:
|
||||
print("%-30s = %s" % (Key, self.TargetTxtDictionary[Key]))
|
||||
|
||||
|
||||
if errMsg != '':
|
||||
print(os.linesep + 'Warning:' + os.linesep + errMsg)
|
||||
|
||||
|
||||
def RWFile(self, CommentCharacter, KeySplitCharacter, Num):
|
||||
try:
|
||||
fr = open(self.FileName, 'r')
|
||||
@ -111,7 +111,7 @@ class TargetTool():
|
||||
existKeys.append(Key)
|
||||
else:
|
||||
print("Warning: Found duplicate key item in original configuration files!")
|
||||
|
||||
|
||||
if Num == 0:
|
||||
Line = "%-30s = \n" % Key
|
||||
else:
|
||||
@ -126,12 +126,12 @@ class TargetTool():
|
||||
if Line is None:
|
||||
Line = "%-30s = " % key
|
||||
fw.write(Line)
|
||||
|
||||
|
||||
fr.close()
|
||||
fw.close()
|
||||
os.remove(self.FileName)
|
||||
os.rename(os.path.normpath(os.path.join(self.WorkSpace, 'Conf\\targetnew.txt')), self.FileName)
|
||||
|
||||
|
||||
except:
|
||||
last_type, last_value, last_tb = sys.exc_info()
|
||||
traceback.print_exception(last_type, last_value, last_tb)
|
||||
@ -143,20 +143,20 @@ def GetConfigureKeyValue(self, Key):
|
||||
if os.path.exists(dscFullPath):
|
||||
Line = "%-30s = %s\n" % (Key, self.Opt.DSCFILE)
|
||||
else:
|
||||
EdkLogger.error("TagetTool", BuildToolError.FILE_NOT_FOUND,
|
||||
EdkLogger.error("TagetTool", BuildToolError.FILE_NOT_FOUND,
|
||||
"DSC file %s does not exist!" % self.Opt.DSCFILE, RaiseError=False)
|
||||
elif Key == TAB_TAT_DEFINES_TOOL_CHAIN_CONF and self.Opt.TOOL_DEFINITION_FILE is not None:
|
||||
tooldefFullPath = os.path.join(self.WorkSpace, self.Opt.TOOL_DEFINITION_FILE)
|
||||
if os.path.exists(tooldefFullPath):
|
||||
Line = "%-30s = %s\n" % (Key, self.Opt.TOOL_DEFINITION_FILE)
|
||||
else:
|
||||
EdkLogger.error("TagetTool", BuildToolError.FILE_NOT_FOUND,
|
||||
EdkLogger.error("TagetTool", BuildToolError.FILE_NOT_FOUND,
|
||||
"Tooldef file %s does not exist!" % self.Opt.TOOL_DEFINITION_FILE, RaiseError=False)
|
||||
|
||||
elif self.Opt.NUM >= 2:
|
||||
Line = "%-30s = %s\n" % (Key, 'Enable')
|
||||
elif self.Opt.NUM <= 1:
|
||||
Line = "%-30s = %s\n" % (Key, 'Disable')
|
||||
Line = "%-30s = %s\n" % (Key, 'Disable')
|
||||
elif Key == TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER and self.Opt.NUM is not None:
|
||||
Line = "%-30s = %s\n" % (Key, str(self.Opt.NUM))
|
||||
elif Key == TAB_TAT_DEFINES_TARGET and self.Opt.TARGET is not None:
|
||||
@ -170,13 +170,13 @@ def GetConfigureKeyValue(self, Key):
|
||||
if os.path.exists(buildruleFullPath):
|
||||
Line = "%-30s = %s\n" % (Key, self.Opt.BUILD_RULE_FILE)
|
||||
else:
|
||||
EdkLogger.error("TagetTool", BuildToolError.FILE_NOT_FOUND,
|
||||
EdkLogger.error("TagetTool", BuildToolError.FILE_NOT_FOUND,
|
||||
"Build rule file %s does not exist!" % self.Opt.BUILD_RULE_FILE, RaiseError=False)
|
||||
return Line
|
||||
|
||||
VersionNumber = ("0.01" + " " + gBUILD_VERSION)
|
||||
__version__ = "%prog Version " + VersionNumber
|
||||
__copyright__ = "Copyright (c) 2007 - 2010, Intel Corporation All rights reserved."
|
||||
__copyright__ = "Copyright (c) 2007 - 2018, Intel Corporation All rights reserved."
|
||||
__usage__ = "%prog [options] {args} \
|
||||
\nArgs: \
|
||||
\n Clean clean the all default configuration of target.txt. \
|
||||
@ -200,7 +200,7 @@ def RangeCheckCallback(option, opt_str, value, parser):
|
||||
setattr(parser.values, option.dest, value)
|
||||
else:
|
||||
parser.error("Option %s only allows one instance in command line!" % option)
|
||||
|
||||
|
||||
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', 'AARCH64', '0'], dest="TARGET_ARCH",
|
||||
@ -226,7 +226,7 @@ if __name__ == '__main__':
|
||||
if os.getenv('WORKSPACE') is None:
|
||||
print("ERROR: WORKSPACE should be specified or edksetup script should be executed before run TargetTool")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
(opt, args) = MyOptionParser()
|
||||
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.")
|
||||
|
Reference in New Issue
Block a user