summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Workspace/DscBuildData.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/Workspace/DscBuildData.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/Workspace/DscBuildData.py')
-rw-r--r--BaseTools/Source/Python/Workspace/DscBuildData.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 26d2c166fa..9f99aeaa21 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -130,7 +130,14 @@ def GetDependencyList(FileStack, SearchPathList):
continue
if FileContent[0] == 0xff or FileContent[0] == 0xfe:
- FileContent = unicode(FileContent, "utf-16")
+ FileContent = str(FileContent, "utf-16")
+ IncludedFileList = gIncludePattern.findall(FileContent)
+ else:
+ try:
+ FileContent = str(FileContent, "utf-8")
+ IncludedFileList = gIncludePattern.findall(FileContent)
+ except:
+ pass
IncludedFileList = gIncludePattern.findall(FileContent)
for Inc in IncludedFileList:
@@ -1655,7 +1662,7 @@ class DscBuildData(PlatformBuildClassObject):
except:
EdkLogger.error('Build', COMMAND_FAILURE, 'Can not execute command: %s' % Command)
Result = Process.communicate()
- return Process.returncode, Result[0], Result[1]
+ return Process.returncode, Result[0].decode(encoding='utf-8', errors='ignore'), Result[1].decode(encoding='utf-8', errors='ignore')
@staticmethod
def IntToCString(Value, ValueSize):
@@ -2684,7 +2691,7 @@ class DscBuildData(PlatformBuildClassObject):
Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName] = {}
Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName][DefaultStore] = DefaultValue
for pcd in Pcds.values():
- SkuInfoObj = pcd.SkuInfoList.values()[0]
+ SkuInfoObj = list(pcd.SkuInfoList.values())[0]
pcdDecObject = self._DecPcds[pcd.TokenCName, pcd.TokenSpaceGuidCName]
pcd.DatumType = pcdDecObject.DatumType
# Only fix the value while no value provided in DSC file.