summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Common/VpdInfoFile.py
diff options
context:
space:
mode:
authorYunhua Feng <yunhuax.feng@intel.com>2018-10-11 11:20:59 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-10-13 09:54:07 +0800
commit86e6cf98a8493574878286522078050ac4dd505d (patch)
treeca47729eab67c9f90e0dac5a14dc5ca14ef22ef1 /BaseTools/Source/Python/Common/VpdInfoFile.py
parenta09f4c91f785e36f0987aa3a6d7656ba51e6aeda (diff)
downloadedk2-86e6cf98a8493574878286522078050ac4dd505d.tar.gz
edk2-86e6cf98a8493574878286522078050ac4dd505d.tar.bz2
edk2-86e6cf98a8493574878286522078050ac4dd505d.zip
BaseTools: Handle the bytes and str difference
Deal with bytes and str is different, remove the unicode() Using utcfromtimestamp instead of fromtimestamp. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Common/VpdInfoFile.py')
-rw-r--r--BaseTools/Source/Python/Common/VpdInfoFile.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Source/Python/Common/VpdInfoFile.py
index bae184f040..3fadd693ea 100644
--- a/BaseTools/Source/Python/Common/VpdInfoFile.py
+++ b/BaseTools/Source/Python/Common/VpdInfoFile.py
@@ -91,18 +91,18 @@ class VpdInfoFile:
if (Vpd is None):
EdkLogger.error("VpdInfoFile", BuildToolError.ATTRIBUTE_UNKNOWN_ERROR, "Invalid VPD PCD entry.")
- if not (Offset >= 0 or Offset == "*"):
+ if not (Offset >= "0" or Offset == "*"):
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))
@@ -126,7 +126,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
@@ -248,7 +248,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()