#\r
# Length of Binary File\r
#\r
- FileHandle = open (FileName, 'rb')\r
+ FileHandle = open(FileName, 'rb')\r
FileHandle.seek (0, 2)\r
FileLength = FileHandle.tell()\r
FileHandle.close()\r
return OPTION_MISSING, "PcdMaxSize is not specified for VOID* type PCD."\r
ValueLength = int(MaxSize)\r
else:\r
- return PARAMETER_INVALID, "PCD type %s is not valid." %(CommandOptions.PcdTypeName)\r
+ return PARAMETER_INVALID, "PCD type %s is not valid." % (CommandOptions.PcdTypeName)\r
#\r
# Check PcdValue is in the input binary file.\r
#\r
#\r
# Read binary file into array\r
#\r
- FileHandle = open (FileName, 'rb')\r
+ FileHandle = open(FileName, 'rb')\r
ByteArray = array.array('B')\r
ByteArray.fromfile(FileHandle, FileLength)\r
FileHandle.close()\r
if ValueNumber != 0:\r
ValueNumber = 1\r
except:\r
- return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string." %(ValueString)\r
+ return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string." % (ValueString)\r
#\r
# Set PCD value into binary data\r
#\r
else:\r
ValueNumber = int (ValueString)\r
except:\r
- return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string." %(ValueString)\r
+ return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string." % (ValueString)\r
#\r
# Set PCD value into binary data\r
#\r
if Index >= ValueLength:\r
break\r
except:\r
- return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string array." %(ValueString)\r
+ return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string array." % (ValueString)\r
else:\r
#\r
# Patch ascii string \r
if ByteList != OrigByteList:\r
ByteArray = array.array('B')\r
ByteArray.fromlist(ByteList)\r
- FileHandle = open (FileName, 'wb')\r
+ FileHandle = open(FileName, 'wb')\r
ByteArray.tofile(FileHandle)\r
FileHandle.close()\r
- return 0, "Patch Value into File %s successfully." %(FileName)\r
+ return 0, "Patch Value into File %s successfully." % (FileName)\r
\r
## Parse command line options\r
#\r
EdkLogger.error("PatchPcdValue", OPTION_MISSING, ExtraData="PcdOffset or PcdValue of PcdTypeName is not specified.")\r
return 1\r
if CommandOptions.PcdTypeName.upper() not in ["BOOLEAN", "UINT8", "UINT16", "UINT32", "UINT64", "VOID*"]:\r
- EdkLogger.error("PatchPcdValue", PARAMETER_INVALID, ExtraData="PCD type %s is not valid." %(CommandOptions.PcdTypeName))\r
+ EdkLogger.error("PatchPcdValue", PARAMETER_INVALID, ExtraData="PCD type %s is not valid." % (CommandOptions.PcdTypeName))\r
return 1\r
if CommandOptions.PcdTypeName.upper() == "VOID*" and CommandOptions.PcdMaxSize == None:\r
EdkLogger.error("PatchPcdValue", OPTION_MISSING, ExtraData="PcdMaxSize is not specified for VOID* type PCD.")\r