BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1540

This issue in introduced by commit
d943b0c339fe3d35ffdf9f580ccb7a55915c6854

To convert bytes to string, we need to use bytes.decode()
instead of using str(bytes)

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.f...@intel.com>
Cc: Liming Gao <liming....@intel.com>
---
 BaseTools/Source/Python/AutoGen/GenMake.py        | 2 +-
 BaseTools/Source/Python/Workspace/DscBuildData.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py 
b/BaseTools/Source/Python/AutoGen/GenMake.py
index 53c5b8577d..641ed8305f 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -1048,11 +1048,11 @@ cleanlib:
 
                 if FileContent[0] == 0xff or FileContent[0] == 0xfe:
                     FileContent = FileContent.decode('utf-16')
                 else:
                     try:
-                        FileContent = str(FileContent)
+                        FileContent = FileContent.decode()
                     except:
                         pass
                 IncludedFileList = gIncludePattern.findall(FileContent)
 
                 for Inc in IncludedFileList:
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 1ffefe6e7e..74bc333144 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -158,11 +158,11 @@ def GetDependencyList(FileStack, SearchPathList):
             if FileContent[0] == 0xff or FileContent[0] == 0xfe:
                 FileContent = FileContent.decode('utf-16')
                 IncludedFileList = gIncludePattern.findall(FileContent)
             else:
                 try:
-                    FileContent = str(FileContent)
+                    FileContent = FileContent.decode()
                     IncludedFileList = gIncludePattern.findall(FileContent)
                 except:
                     pass
             IncludedFileList = gIncludePattern.findall(FileContent)
 
-- 
2.20.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to