diff options
author | Feng, Bob C <bob.c.feng@intel.com> | 2019-01-23 10:16:00 +0800 |
---|---|---|
committer | Feng, Bob C <bob.c.feng@intel.com> | 2019-02-01 11:09:24 +0800 |
commit | d943b0c339fe3d35ffdf9f580ccb7a55915c6854 (patch) | |
tree | f48623041095431d49c3cb8ce7f1a8dab953f26e /BaseTools/Source/Python/Common/VpdInfoFile.py | |
parent | f8d11e5a4aaa90bf63b4789f3993dd6d16c60787 (diff) | |
download | edk2-d943b0c339fe3d35ffdf9f580ccb7a55915c6854.tar.gz edk2-d943b0c339fe3d35ffdf9f580ccb7a55915c6854.tar.bz2 edk2-d943b0c339fe3d35ffdf9f580ccb7a55915c6854.zip |
BaseTools: Handle the bytes and str difference
Deal with bytes and str is different, remove the unicode(),
correct open file parameter.
Using utcfromtimestamp instead of fromtimestamp.
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Common/VpdInfoFile.py')
-rw-r--r-- | BaseTools/Source/Python/Common/VpdInfoFile.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Source/Python/Common/VpdInfoFile.py index cebc1f7187..e6cc768ee1 100644 --- a/BaseTools/Source/Python/Common/VpdInfoFile.py +++ b/BaseTools/Source/Python/Common/VpdInfoFile.py @@ -92,18 +92,18 @@ class VpdInfoFile: if (Vpd is None):
EdkLogger.error("VpdInfoFile", BuildToolError.ATTRIBUTE_UNKNOWN_ERROR, "Invalid VPD PCD entry.")
- if not (Offset >= 0 or Offset == TAB_STAR):
+ if not (Offset >= "0" or Offset == TAB_STAR):
EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID, "Invalid offset parameter: %s." % Offset)
if Vpd.DatumType == TAB_VOID:
- if Vpd.MaxDatumSize <= 0:
+ if Vpd.MaxDatumSize <= "0":
EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID,
"Invalid max datum size for VPD PCD %s.%s" % (Vpd.TokenSpaceGuidCName, Vpd.TokenCName))
elif Vpd.DatumType in TAB_PCD_NUMERIC_TYPES:
if not Vpd.MaxDatumSize:
Vpd.MaxDatumSize = MAX_SIZE_TYPE[Vpd.DatumType]
else:
- if Vpd.MaxDatumSize <= 0:
+ if Vpd.MaxDatumSize <= "0":
EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID,
"Invalid max datum size for VPD PCD %s.%s" % (Vpd.TokenSpaceGuidCName, Vpd.TokenCName))
@@ -127,7 +127,7 @@ class VpdInfoFile: "Invalid parameter FilePath: %s." % FilePath)
Content = FILE_COMMENT_TEMPLATE
- Pcds = sorted(self._VpdArray.keys())
+ Pcds = sorted(self._VpdArray.keys(), key=lambda x: x.TokenCName)
for Pcd in Pcds:
i = 0
PcdTokenCName = Pcd.TokenCName
@@ -249,7 +249,7 @@ def CallExtenalBPDGTool(ToolPath, VpdFileName): except Exception as X:
EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, ExtraData=str(X))
(out, error) = PopenObject.communicate()
- print(out)
+ print(out.decode(encoding='utf-8', errors='ignore'))
while PopenObject.returncode is None :
PopenObject.wait()
|