* [PATCH v1 1/1] BaseTools: AutoGen - change class variable to funciton variable [not found] <cover.1532023032.git.jaben.carsey@intel.com> @ 2018-07-19 17:57 ` Jaben Carsey 2018-07-24 7:24 ` Zhu, Yonghong 0 siblings, 1 reply; 2+ messages in thread From: Jaben Carsey @ 2018-07-19 17:57 UTC (permalink / raw) To: edk2-devel; +Cc: Liming Gao, Yonghong Zhu This variable is only used in one function, make it local there. Also when iterating on the variable, use dict.items() to get value instead of re-looking up the value multiple times. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> --- BaseTools/Source/Python/AutoGen/GenMake.py | 25 ++++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 992de5490dff..f1fe5514f3f2 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -435,7 +435,6 @@ cleanlib: self.ListFileMacros = {} self.FileCache = {} - self.FileDependency = [] self.LibraryBuildCommandList = [] self.LibraryFileList = [] self.LibraryMakefileList = [] @@ -890,26 +889,26 @@ cleanlib: if Item in SourceFileList: SourceFileList.remove(Item) - self.FileDependency = self.GetFileDependency( + FileDependencyDict = self.GetFileDependency( SourceFileList, ForceIncludedFile, self._AutoGenObject.IncludePathList + self._AutoGenObject.BuildOptionIncPathList ) DepSet = None - for File in self.FileDependency: - if not self.FileDependency[File]: - self.FileDependency[File] = ['$(FORCE_REBUILD)'] + for File,Dependency in FileDependencyDict.items(): + if not Dependency: + FileDependencyDict[File] = ['$(FORCE_REBUILD)'] continue - self._AutoGenObject.AutoGenDepSet |= set(self.FileDependency[File]) + self._AutoGenObject.AutoGenDepSet |= set(Dependency) # skip non-C files if File.Ext not in [".c", ".C"] or File.Name == "AutoGen.c": continue elif DepSet is None: - DepSet = set(self.FileDependency[File]) + DepSet = set(Dependency) else: - DepSet &= set(self.FileDependency[File]) + DepSet &= set(Dependency) # in case nothing in SourceFileList if DepSet is None: DepSet = set() @@ -919,13 +918,13 @@ cleanlib: for File in DepSet: self.CommonFileDependency.append(self.PlaceMacro(File.Path, self.Macros)) - for File in self.FileDependency: + for File in FileDependencyDict: # skip non-C files if File.Ext not in [".c", ".C"] or File.Name == "AutoGen.c": continue - NewDepSet = set(self.FileDependency[File]) + NewDepSet = set(FileDependencyDict[File]) NewDepSet -= DepSet - self.FileDependency[File] = ["$(COMMON_DEPS)"] + list(NewDepSet) + FileDependencyDict[File] = ["$(COMMON_DEPS)"] + list(NewDepSet) # Convert target description object to target string in makefile for Type in self._AutoGenObject.Targets: @@ -943,8 +942,8 @@ cleanlib: for Dep in T.Dependencies: Deps.append(self.PlaceMacro(str(Dep), self.Macros)) # Add inclusion-dependencies - if len(T.Inputs) == 1 and T.Inputs[0] in self.FileDependency: - for F in self.FileDependency[T.Inputs[0]]: + if len(T.Inputs) == 1 and T.Inputs[0] in FileDependencyDict: + for F in FileDependencyDict[T.Inputs[0]]: Deps.append(self.PlaceMacro(str(F), self.Macros)) # Add source-dependencies for F in T.Inputs: -- 2.16.2.windows.1 ^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1 1/1] BaseTools: AutoGen - change class variable to funciton variable 2018-07-19 17:57 ` [PATCH v1 1/1] BaseTools: AutoGen - change class variable to funciton variable Jaben Carsey @ 2018-07-24 7:24 ` Zhu, Yonghong 0 siblings, 0 replies; 2+ messages in thread From: Zhu, Yonghong @ 2018-07-24 7:24 UTC (permalink / raw) To: Carsey, Jaben, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> Best Regards, Zhu Yonghong -----Original Message----- From: Carsey, Jaben Sent: Friday, July 20, 2018 1:58 AM To: edk2-devel@lists.01.org Cc: Gao, Liming <liming.gao@intel.com>; Zhu, Yonghong <yonghong.zhu@intel.com> Subject: [PATCH v1 1/1] BaseTools: AutoGen - change class variable to funciton variable This variable is only used in one function, make it local there. Also when iterating on the variable, use dict.items() to get value instead of re-looking up the value multiple times. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> --- BaseTools/Source/Python/AutoGen/GenMake.py | 25 ++++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 992de5490dff..f1fe5514f3f2 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -435,7 +435,6 @@ cleanlib: self.ListFileMacros = {} self.FileCache = {} - self.FileDependency = [] self.LibraryBuildCommandList = [] self.LibraryFileList = [] self.LibraryMakefileList = [] @@ -890,26 +889,26 @@ cleanlib: if Item in SourceFileList: SourceFileList.remove(Item) - self.FileDependency = self.GetFileDependency( + FileDependencyDict = self.GetFileDependency( SourceFileList, ForceIncludedFile, self._AutoGenObject.IncludePathList + self._AutoGenObject.BuildOptionIncPathList ) DepSet = None - for File in self.FileDependency: - if not self.FileDependency[File]: - self.FileDependency[File] = ['$(FORCE_REBUILD)'] + for File,Dependency in FileDependencyDict.items(): + if not Dependency: + FileDependencyDict[File] = ['$(FORCE_REBUILD)'] continue - self._AutoGenObject.AutoGenDepSet |= set(self.FileDependency[File]) + self._AutoGenObject.AutoGenDepSet |= set(Dependency) # skip non-C files if File.Ext not in [".c", ".C"] or File.Name == "AutoGen.c": continue elif DepSet is None: - DepSet = set(self.FileDependency[File]) + DepSet = set(Dependency) else: - DepSet &= set(self.FileDependency[File]) + DepSet &= set(Dependency) # in case nothing in SourceFileList if DepSet is None: DepSet = set() @@ -919,13 +918,13 @@ cleanlib: for File in DepSet: self.CommonFileDependency.append(self.PlaceMacro(File.Path, self.Macros)) - for File in self.FileDependency: + for File in FileDependencyDict: # skip non-C files if File.Ext not in [".c", ".C"] or File.Name == "AutoGen.c": continue - NewDepSet = set(self.FileDependency[File]) + NewDepSet = set(FileDependencyDict[File]) NewDepSet -= DepSet - self.FileDependency[File] = ["$(COMMON_DEPS)"] + list(NewDepSet) + FileDependencyDict[File] = ["$(COMMON_DEPS)"] + + list(NewDepSet) # Convert target description object to target string in makefile for Type in self._AutoGenObject.Targets: @@ -943,8 +942,8 @@ cleanlib: for Dep in T.Dependencies: Deps.append(self.PlaceMacro(str(Dep), self.Macros)) # Add inclusion-dependencies - if len(T.Inputs) == 1 and T.Inputs[0] in self.FileDependency: - for F in self.FileDependency[T.Inputs[0]]: + if len(T.Inputs) == 1 and T.Inputs[0] in FileDependencyDict: + for F in FileDependencyDict[T.Inputs[0]]: Deps.append(self.PlaceMacro(str(F), self.Macros)) # Add source-dependencies for F in T.Inputs: -- 2.16.2.windows.1 ^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-24 7:24 UTC | newest] Thread overview: 2+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <cover.1532023032.git.jaben.carsey@intel.com> 2018-07-19 17:57 ` [PATCH v1 1/1] BaseTools: AutoGen - change class variable to funciton variable Jaben Carsey 2018-07-24 7:24 ` Zhu, Yonghong
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox