diff options
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/GenMake.py')
-rw-r--r-- | BaseTools/Source/Python/AutoGen/GenMake.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index c42053eb4c..dc4cd688f4 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -1038,17 +1038,21 @@ cleanlib: CurrentFileDependencyList = DepDb[F]
else:
try:
- Fd = open(F.Path, 'r')
+ Fd = open(F.Path, 'rb')
+ FileContent = Fd.read()
+ Fd.close()
except BaseException as X:
EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=F.Path + "\n\t" + str(X))
-
- FileContent = Fd.read()
- Fd.close()
if len(FileContent) == 0:
continue
if FileContent[0] == 0xff or FileContent[0] == 0xfe:
- FileContent = unicode(FileContent, "utf-16")
+ FileContent = FileContent.decode('utf-16')
+ else:
+ try:
+ FileContent = str(FileContent)
+ except:
+ pass
IncludedFileList = gIncludePattern.findall(FileContent)
for Inc in IncludedFileList:
|