BaseTool: Fixed incremental rebuild issue.
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1540
This issue in introduced by commit
d943b0c339
To convert bytes to string, we need to use bytes.decode()
instead of using str(bytes).
If the source file is not a txt file, ignore that file.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
@@ -1045,14 +1045,14 @@ cleanlib:
|
|||||||
EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=F.Path + "\n\t" + str(X))
|
EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=F.Path + "\n\t" + str(X))
|
||||||
if len(FileContent) == 0:
|
if len(FileContent) == 0:
|
||||||
continue
|
continue
|
||||||
|
try:
|
||||||
if FileContent[0] == 0xff or FileContent[0] == 0xfe:
|
if FileContent[0] == 0xff or FileContent[0] == 0xfe:
|
||||||
FileContent = FileContent.decode('utf-16')
|
FileContent = FileContent.decode('utf-16')
|
||||||
else:
|
else:
|
||||||
try:
|
FileContent = FileContent.decode()
|
||||||
FileContent = str(FileContent)
|
except:
|
||||||
except:
|
# The file is not txt file. for example .mcb file
|
||||||
pass
|
continue
|
||||||
IncludedFileList = gIncludePattern.findall(FileContent)
|
IncludedFileList = gIncludePattern.findall(FileContent)
|
||||||
|
|
||||||
for Inc in IncludedFileList:
|
for Inc in IncludedFileList:
|
||||||
|
@@ -155,15 +155,14 @@ def GetDependencyList(FileStack, SearchPathList):
|
|||||||
if len(FileContent) == 0:
|
if len(FileContent) == 0:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if FileContent[0] == 0xff or FileContent[0] == 0xfe:
|
try:
|
||||||
FileContent = FileContent.decode('utf-16')
|
if FileContent[0] == 0xff or FileContent[0] == 0xfe:
|
||||||
IncludedFileList = gIncludePattern.findall(FileContent)
|
FileContent = FileContent.decode('utf-16')
|
||||||
else:
|
else:
|
||||||
try:
|
FileContent = FileContent.decode()
|
||||||
FileContent = str(FileContent)
|
except:
|
||||||
IncludedFileList = gIncludePattern.findall(FileContent)
|
# The file is not txt file. for example .mcb file
|
||||||
except:
|
continue
|
||||||
pass
|
|
||||||
IncludedFileList = gIncludePattern.findall(FileContent)
|
IncludedFileList = gIncludePattern.findall(FileContent)
|
||||||
|
|
||||||
for Inc in IncludedFileList:
|
for Inc in IncludedFileList:
|
||||||
|
Reference in New Issue
Block a user