X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FPatchPcdValue%2FPatchPcdValue.py;h=882da81930da267e02ba412fe9c4a69feb5b2bd8;hp=1b3a0ec93d62c1b503e1020082519bb31ff96c88;hb=47fea6afd74af76c7e2a2b03d319b7ac035ac26a;hpb=9913dce8aeb8c154ccea23be0835b2c50a8613b4 diff --git a/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py b/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py index 1b3a0ec93d..882da81930 100644 --- a/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py +++ b/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py @@ -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.")