BaseTools: Clean some coding style issues
This patch clean some coding style issues, majorly for space character. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19080 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -48,7 +48,7 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
|
||||
#
|
||||
# Length of Binary File
|
||||
#
|
||||
FileHandle = open (FileName, 'rb')
|
||||
FileHandle = open(FileName, 'rb')
|
||||
FileHandle.seek (0, 2)
|
||||
FileLength = FileHandle.tell()
|
||||
FileHandle.close()
|
||||
@ -75,7 +75,7 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
|
||||
return OPTION_MISSING, "PcdMaxSize is not specified for VOID* type PCD."
|
||||
ValueLength = int(MaxSize)
|
||||
else:
|
||||
return PARAMETER_INVALID, "PCD type %s is not valid." %(CommandOptions.PcdTypeName)
|
||||
return PARAMETER_INVALID, "PCD type %s is not valid." % (CommandOptions.PcdTypeName)
|
||||
#
|
||||
# Check PcdValue is in the input binary file.
|
||||
#
|
||||
@ -84,7 +84,7 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
|
||||
#
|
||||
# Read binary file into array
|
||||
#
|
||||
FileHandle = open (FileName, 'rb')
|
||||
FileHandle = open(FileName, 'rb')
|
||||
ByteArray = array.array('B')
|
||||
ByteArray.fromfile(FileHandle, FileLength)
|
||||
FileHandle.close()
|
||||
@ -117,7 +117,7 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
|
||||
if ValueNumber != 0:
|
||||
ValueNumber = 1
|
||||
except:
|
||||
return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string." %(ValueString)
|
||||
return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string." % (ValueString)
|
||||
#
|
||||
# Set PCD value into binary data
|
||||
#
|
||||
@ -132,7 +132,7 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
|
||||
else:
|
||||
ValueNumber = int (ValueString)
|
||||
except:
|
||||
return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string." %(ValueString)
|
||||
return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string." % (ValueString)
|
||||
#
|
||||
# Set PCD value into binary data
|
||||
#
|
||||
@ -174,7 +174,7 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
|
||||
if Index >= ValueLength:
|
||||
break
|
||||
except:
|
||||
return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string array." %(ValueString)
|
||||
return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string array." % (ValueString)
|
||||
else:
|
||||
#
|
||||
# Patch ascii string
|
||||
@ -197,10 +197,10 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
|
||||
if ByteList != OrigByteList:
|
||||
ByteArray = array.array('B')
|
||||
ByteArray.fromlist(ByteList)
|
||||
FileHandle = open (FileName, 'wb')
|
||||
FileHandle = open(FileName, 'wb')
|
||||
ByteArray.tofile(FileHandle)
|
||||
FileHandle.close()
|
||||
return 0, "Patch Value into File %s successfully." %(FileName)
|
||||
return 0, "Patch Value into File %s successfully." % (FileName)
|
||||
|
||||
## Parse command line options
|
||||
#
|
||||
@ -270,7 +270,7 @@ def Main():
|
||||
EdkLogger.error("PatchPcdValue", OPTION_MISSING, ExtraData="PcdOffset or PcdValue of PcdTypeName is not specified.")
|
||||
return 1
|
||||
if CommandOptions.PcdTypeName.upper() not in ["BOOLEAN", "UINT8", "UINT16", "UINT32", "UINT64", "VOID*"]:
|
||||
EdkLogger.error("PatchPcdValue", PARAMETER_INVALID, ExtraData="PCD type %s is not valid." %(CommandOptions.PcdTypeName))
|
||||
EdkLogger.error("PatchPcdValue", PARAMETER_INVALID, ExtraData="PCD type %s is not valid." % (CommandOptions.PcdTypeName))
|
||||
return 1
|
||||
if CommandOptions.PcdTypeName.upper() == "VOID*" and CommandOptions.PcdMaxSize == None:
|
||||
EdkLogger.error("PatchPcdValue", OPTION_MISSING, ExtraData="PcdMaxSize is not specified for VOID* type PCD.")
|
||||
|
Reference in New Issue
Block a user