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/BPDG/GenVpd.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/BPDG/GenVpd.py')
-rw-r--r-- | BaseTools/Source/Python/BPDG/GenVpd.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py b/BaseTools/Source/Python/BPDG/GenVpd.py index b4a2dd25a2..09712be386 100644 --- a/BaseTools/Source/Python/BPDG/GenVpd.py +++ b/BaseTools/Source/Python/BPDG/GenVpd.py @@ -186,7 +186,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, ValueString.encode('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))
@@ -306,7 +306,7 @@ class GenVPD : self.PcdFixedOffsetSizeList = []
self.PcdUnknownOffsetList = []
try:
- fInputfile = open(InputFileName, "r", 0)
+ fInputfile = open(InputFileName, "r")
try:
self.FileLinesList = fInputfile.readlines()
except:
@@ -645,7 +645,7 @@ class GenVPD : #Open an VPD file to process
try:
- fVpdFile = open(BinFileName, "wb", 0)
+ fVpdFile = open(BinFileName, "wb")
except:
# Open failed
EdkLogger.error("BPDG", BuildToolError.FILE_OPEN_FAILURE, "File open failed for %s" % self.VpdFileName, None)
@@ -657,7 +657,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 :
|