From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: liming.gao@intel.com) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by groups.io with SMTP; Thu, 19 Sep 2019 23:00:24 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Sep 2019 23:00:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,527,1559545200"; d="scan'208";a="387513218" Received: from lgao4-mobl1.ccr.corp.intel.com ([10.249.172.70]) by fmsmga005.fm.intel.com with ESMTP; 19 Sep 2019 23:00:20 -0700 From: "Liming Gao" To: devel@edk2.groups.io Cc: Bob Feng Subject: [Patch] Revert "BaseTools: Improve GetDependencyList function" Date: Fri, 20 Sep 2019 14:00:12 +0800 Message-Id: <20190920060012.16248-1-liming.gao@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 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 Signed-off-by: Liming Gao --- 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