[edk2] [PATCH v2 18/20] BaseTools: Move OverrideAttribs to OptRomInfStatement.py

Gary Lin posted 20 patches 6 years, 10 months ago
There is a newer version of this series
[edk2] [PATCH v2 18/20] BaseTools: Move OverrideAttribs to OptRomInfStatement.py
Posted by Gary Lin 6 years, 10 months ago
Move "class OverrideAttribs" to OptRomInfStatement.py to remove
"import OptionRom" which may form a circular import:
GenFds.OptionRom => GenFds.OptRomInfStatement => GenFds.OptionRom

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
---
 BaseTools/Source/Python/GenFds/FdfParser.py          |  2 +-
 BaseTools/Source/Python/GenFds/OptRomInfStatement.py | 18 ++++++++++++++++--
 BaseTools/Source/Python/GenFds/OptionRom.py          | 14 --------------
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index 4e07d04c08df..52e4727e38a6 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -4481,7 +4481,7 @@ class FdfParser:
     #
     def __GetOptRomOverrides(self, Obj):
         if self.__IsToken('{'):
-            Overrides = OptionRom.OverrideAttribs()
+            Overrides = OptRomInfStatement.OverrideAttribs()
             while True:
                 if self.__IsKeyword( "PCI_VENDOR_ID"):
                     if not self.__IsToken( "="):
diff --git a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py
index 5de0cac2a374..a12230fe21ee 100644
--- a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py
@@ -45,9 +45,8 @@ class OptRomInfStatement (FfsInfStatement):
     #   @param  self        The object pointer
     #
     def __GetOptRomParams(self):
-        from . import OptionRom
         if self.OverrideAttribs == None:
-            self.OverrideAttribs = OptionRom.OverrideAttribs()
+            self.OverrideAttribs = OverrideAttribs()
 
         if self.OverrideAttribs.NeedCompress == None:
             self.OverrideAttribs.NeedCompress = self.OptRomDefs.get ('PCI_COMPRESS')
@@ -151,3 +150,18 @@ class OptRomInfStatement (FfsInfStatement):
                     OutputFileList.extend(FileList)    
         
         return OutputFileList
+
+## 
+#
+#
+class OverrideAttribs:
+    ## The constructor
+    #
+    #   @param  self        The object pointer
+    #
+    def __init__(self):
+        self.PciVendorId = None
+        self.PciClassCode = None
+        self.PciDeviceId = None
+        self.PciRevision = None
+        self.NeedCompress = None
diff --git a/BaseTools/Source/Python/GenFds/OptionRom.py b/BaseTools/Source/Python/GenFds/OptionRom.py
index a7a63e80845c..01846eb01440 100644
--- a/BaseTools/Source/Python/GenFds/OptionRom.py
+++ b/BaseTools/Source/Python/GenFds/OptionRom.py
@@ -123,17 +123,3 @@ class OPTIONROM (OptionRomClassObject):
         GenFdsGlobalVariable.SharpCounter = 0
         
         return OutputFile
-
-class OverrideAttribs:
-        
-    ## The constructor
-    #
-    #   @param  self        The object pointer
-    #
-    def __init__(self):
-        
-        self.PciVendorId = None
-        self.PciClassCode = None
-        self.PciDeviceId = None
-        self.PciRevision = None
-        self.NeedCompress = None
-- 
2.16.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel