summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Workspace
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/Source/Python/Workspace')
-rw-r--r--BaseTools/Source/Python/Workspace/DscBuildData.py13
-rw-r--r--BaseTools/Source/Python/Workspace/MetaFileParser.py4
2 files changed, 12 insertions, 5 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.
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 9f2a3bcb5a..470cfed5b6 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -1931,10 +1931,10 @@ class DecParser(MetaFileParser):
return
if self._include_flag:
- self._ValueList[1] = "<HeaderFiles>_" + md5(self._CurrentLine).hexdigest()
+ self._ValueList[1] = "<HeaderFiles>_" + md5(self._CurrentLine.encode('utf-8')).hexdigest()
self._ValueList[2] = self._CurrentLine
if self._package_flag and "}" != self._CurrentLine:
- self._ValueList[1] = "<Packages>_" + md5(self._CurrentLine).hexdigest()
+ self._ValueList[1] = "<Packages>_" + md5(self._CurrentLine.encode('utf-8')).hexdigest()
self._ValueList[2] = self._CurrentLine
if self._CurrentLine == "}":
self._package_flag = False