BaseTools/Source/Python/AutoGen/GenMake.py | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-)
This reverts commit bc9e4194cf3edaf9524c83098ba3f72008c70190.
This change causes the dependent header files are missing in Makefile.
It makes the incremental build not work. So, revert this change.
Cc: Bob Feng<bob.c.feng@Intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
BaseTools/Source/Python/AutoGen/GenMake.py | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
index 940136248f..2fe0e78bec 100755
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -1696,25 +1696,22 @@ def GetDependencyList(AutoGenObject, FileCache, File, ForceList, SearchPathList)
CurrentFileDependencyList = DepDb[F]
else:
try:
- with open(F.Path, 'rb') as Fd:
- FileContent = Fd.read(1)
- Fd.seek(0)
- if not FileContent:
- continue
- if FileContent[0] == 0xff or FileContent[0] == 0xfe:
- FileContent2 = Fd.read()
- FileContent2 = FileContent2.decode('utf-16')
- IncludedFileList = gIncludePattern.findall(FileContent2)
- else:
- FileLines = Fd.readlines()
- FileContent2 = [line for line in FileLines if str(line).lstrip("#\t ")[:8] == "include "]
- simpleFileContent="".join(FileContent2)
-
- IncludedFileList = gIncludePattern.findall(simpleFileContent)
+ 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))
- if not FileContent:
+ if len(FileContent) == 0:
+ continue
+ try:
+ if FileContent[0] == 0xff or FileContent[0] == 0xfe:
+ FileContent = FileContent.decode('utf-16')
+ else:
+ FileContent = FileContent.decode()
+ except:
+ # The file is not txt file. for example .mcb file
continue
+ IncludedFileList = gIncludePattern.findall(FileContent)
for Inc in IncludedFileList:
Inc = Inc.strip()
--
2.13.0.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#47702): https://edk2.groups.io/g/devel/message/47702
Mute This Topic: https://groups.io/mt/34227614/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
I agree. Reviewed-by: Bob Feng<bob.c.feng@Intel.com> -----Original Message----- From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Liming Gao Sent: Friday, September 20, 2019 2:00 PM To: devel@edk2.groups.io Cc: Feng, Bob C <bob.c.feng@intel.com> Subject: [edk2-devel] [Patch] Revert "BaseTools: Improve GetDependencyList function" This reverts commit bc9e4194cf3edaf9524c83098ba3f72008c70190. This change causes the dependent header files are missing in Makefile. It makes the incremental build not work. So, revert this change. Cc: Bob Feng<bob.c.feng@Intel.com> Signed-off-by: Liming Gao <liming.gao@intel.com> --- BaseTools/Source/Python/AutoGen/GenMake.py | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 940136248f..2fe0e78bec 100755 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -1696,25 +1696,22 @@ def GetDependencyList(AutoGenObject, FileCache, File, ForceList, SearchPathList) CurrentFileDependencyList = DepDb[F] else: try: - with open(F.Path, 'rb') as Fd: - FileContent = Fd.read(1) - Fd.seek(0) - if not FileContent: - continue - if FileContent[0] == 0xff or FileContent[0] == 0xfe: - FileContent2 = Fd.read() - FileContent2 = FileContent2.decode('utf-16') - IncludedFileList = gIncludePattern.findall(FileContent2) - else: - FileLines = Fd.readlines() - FileContent2 = [line for line in FileLines if str(line).lstrip("#\t ")[:8] == "include "] - simpleFileContent="".join(FileContent2) - - IncludedFileList = gIncludePattern.findall(simpleFileContent) + 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)) - if not FileContent: + if len(FileContent) == 0: + continue + try: + if FileContent[0] == 0xff or FileContent[0] == 0xfe: + FileContent = FileContent.decode('utf-16') + else: + FileContent = FileContent.decode() + except: + # The file is not txt file. for example .mcb file continue + IncludedFileList = gIncludePattern.findall(FileContent) for Inc in IncludedFileList: Inc = Inc.strip() -- 2.13.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#47714): https://edk2.groups.io/g/devel/message/47714 Mute This Topic: https://groups.io/mt/34227614/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2024 Red Hat, Inc.