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/Trim | |
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/Trim')
-rw-r--r-- | BaseTools/Source/Python/Trim/Trim.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/BaseTools/Source/Python/Trim/Trim.py b/BaseTools/Source/Python/Trim/Trim.py index b9ca83d6d8..4b7c2020b4 100644 --- a/BaseTools/Source/Python/Trim/Trim.py +++ b/BaseTools/Source/Python/Trim/Trim.py @@ -458,7 +458,7 @@ def GenerateVfrBinSec(ModuleName, DebugDir, OutputFile): EdkLogger.error("Trim", FILE_OPEN_FAILURE, "File open failed for %s" %OutputFile, None)
# Use a instance of BytesIO to cache data
- fStringIO = BytesIO('')
+ fStringIO = BytesIO()
for Item in VfrUniOffsetList:
if (Item[0].find("Strings") != -1):
@@ -468,8 +468,7 @@ def GenerateVfrBinSec(ModuleName, DebugDir, OutputFile): # { 0x8913c5e0, 0x33f6, 0x4d86, { 0x9b, 0xf1, 0x43, 0xef, 0x89, 0xfc, 0x6, 0x66 } }
#
UniGuid = [0xe0, 0xc5, 0x13, 0x89, 0xf6, 0x33, 0x86, 0x4d, 0x9b, 0xf1, 0x43, 0xef, 0x89, 0xfc, 0x6, 0x66]
- UniGuid = [chr(ItemGuid) for ItemGuid in UniGuid]
- fStringIO.write(''.join(UniGuid))
+ fStringIO.write(bytes(UniGuid))
UniValue = pack ('Q', int (Item[1], 16))
fStringIO.write (UniValue)
else:
@@ -479,9 +478,7 @@ def GenerateVfrBinSec(ModuleName, DebugDir, OutputFile): # { 0xd0bc7cb4, 0x6a47, 0x495f, { 0xaa, 0x11, 0x71, 0x7, 0x46, 0xda, 0x6, 0xa2 } };
#
VfrGuid = [0xb4, 0x7c, 0xbc, 0xd0, 0x47, 0x6a, 0x5f, 0x49, 0xaa, 0x11, 0x71, 0x7, 0x46, 0xda, 0x6, 0xa2]
- VfrGuid = [chr(ItemGuid) for ItemGuid in VfrGuid]
- fStringIO.write(''.join(VfrGuid))
- type (Item[1])
+ fStringIO.write(bytes(VfrGuid))
VfrValue = pack ('Q', int (Item[1], 16))
fStringIO.write (VfrValue)
|