diff options
author | Yunhua Feng <yunhuax.feng@intel.com> | 2018-10-11 11:20:59 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-10-13 09:54:07 +0800 |
commit | 86e6cf98a8493574878286522078050ac4dd505d (patch) | |
tree | ca47729eab67c9f90e0dac5a14dc5ca14ef22ef1 /BaseTools/Source/Python/BPDG | |
parent | a09f4c91f785e36f0987aa3a6d7656ba51e6aeda (diff) | |
download | edk2-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/BPDG')
-rw-r--r-- | BaseTools/Source/Python/BPDG/GenVpd.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py b/BaseTools/Source/Python/BPDG/GenVpd.py index bd2c05d782..28bfde1151 100644 --- a/BaseTools/Source/Python/BPDG/GenVpd.py +++ b/BaseTools/Source/Python/BPDG/GenVpd.py @@ -185,7 +185,7 @@ class PcdEntry: EdkLogger.error("BPDG", BuildToolError.RESOURCE_OVERFLOW,
"PCD value string %s is exceed to size %d(File: %s Line: %s)" % (ValueString, Size, self.FileName, self.Lineno))
try:
- self.PcdValue = pack('%ds' % Size, ValueString)
+ self.PcdValue = pack('%ds' % Size, bytes(ValueString, 'utf-8'))
except:
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
"Invalid size or value for PCD %s to pack(File: %s Line: %s)." % (self.PcdCName, self.FileName, self.Lineno))
@@ -656,7 +656,7 @@ class GenVPD : EdkLogger.error("BPDG", BuildToolError.FILE_OPEN_FAILURE, "File open failed for %s" % self.MapFileName, None)
# Use a instance of BytesIO to cache data
- fStringIO = BytesIO('')
+ fStringIO = BytesIO()
# Write the header of map file.
try :
@@ -674,8 +674,7 @@ class GenVPD : # Write Vpd binary file
fStringIO.seek (eachPcd.PcdBinOffset)
if isinstance(eachPcd.PcdValue, list):
- ValueList = [chr(Item) for Item in eachPcd.PcdValue]
- fStringIO.write(''.join(ValueList))
+ fStringIO.write(bytes(eachPcd.PcdValue))
else:
fStringIO.write (eachPcd.PcdValue)
|