]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/AutoGen/BuildEngine.py
BaseTools: Remove the old python "not-equal"
[mirror_edk2.git] / BaseTools / Source / Python / AutoGen / BuildEngine.py
index bbd1a4d5b2573dfd1d13210e3cf272335ca2f7f7..cab4c993dc4485e61bb4555dcd2cb3eeb168e725 100644 (file)
@@ -14,6 +14,7 @@
 ##\r
 # Import Modules\r
 #\r
+from __future__ import print_function\r
 import Common.LongFilePathOs as os\r
 import re\r
 import copy\r
@@ -23,7 +24,7 @@ from Common.LongFilePathSupport import OpenLongFilePath as open
 from Common.GlobalData import *\r
 from Common.BuildToolError import *\r
 from Common.Misc import tdict, PathClass\r
-from Common.String import NormPath\r
+from Common.StringUtils import NormPath\r
 from Common.DataType import *\r
 \r
 import Common.EdkLogger as EdkLogger\r
@@ -47,21 +48,10 @@ def ListFileMacro(FileType):
     return "%s_LIST" % FileListMacro(FileType)\r
 \r
 class TargetDescBlock(object):\r
-    _Cache_ = {}    # {TargetFile : TargetDescBlock object}\r
-\r
-    # Factory method\r
-    def __new__(Class, Inputs, Outputs, Commands, Dependencies):\r
-        if Outputs[0] in Class._Cache_:\r
-            Tdb = Class._Cache_[Outputs[0]]\r
-            for File in Inputs:\r
-                Tdb.AddInput(File)\r
-        else:\r
-            Tdb = super(TargetDescBlock, Class).__new__(Class)\r
-            Tdb._Init(Inputs, Outputs, Commands, Dependencies)\r
-            #Class._Cache_[Outputs[0]] = Tdb\r
-        return Tdb\r
+    def __init__(self, Inputs, Outputs, Commands, Dependencies):\r
+        self.InitWorker(Inputs, Outputs, Commands, Dependencies)\r
 \r
-    def _Init(self, Inputs, Outputs, Commands, Dependencies):\r
+    def InitWorker(self, Inputs, Outputs, Commands, Dependencies):\r
         self.Inputs = Inputs\r
         self.Outputs = Outputs\r
         self.Commands = Commands\r
@@ -90,10 +80,6 @@ class TargetDescBlock(object):
     def IsMultipleInput(self):\r
         return len(self.Inputs) > 1\r
 \r
-    @staticmethod\r
-    def Renew():\r
-        TargetDescBlock._Cache_ = {}\r
-\r
 ## Class for one build rule\r
 #\r
 # This represents a build rule which can give out corresponding command list for\r
@@ -278,7 +264,7 @@ class FileBuildRule:
                         # Command line should be regenerated since some macros are different\r
                         #\r
                         CommandList = self._BuildCommand(BuildRulePlaceholderDict)\r
-                        TargetDesc._Init([SourceFile], DstFile, CommandList, self.ExtraSourceFileList)\r
+                        TargetDesc.InitWorker([SourceFile], DstFile, CommandList, self.ExtraSourceFileList)\r
                         break\r
             else:\r
                 TargetDesc.AddInput(SourceFile)\r
@@ -376,8 +362,8 @@ class BuildRule:
             self.RuleContent[Index] = Line\r
             \r
             # find the build_rule_version\r
-            if Line and Line[0] == "#" and Line.find(TAB_BUILD_RULE_VERSION) <> -1:\r
-                if Line.find("=") <> -1 and Line.find("=") < (len(Line) - 1) and (Line[(Line.find("=") + 1):]).split():\r
+            if Line and Line[0] == "#" and Line.find(TAB_BUILD_RULE_VERSION) != -1:\r
+                if Line.find("=") != -1 and Line.find("=") < (len(Line) - 1) and (Line[(Line.find("=") + 1):]).split():\r
                     self._FileVersion = (Line[(Line.find("=") + 1):]).split()[0]\r
             # skip empty or comment line\r
             if Line == "" or Line[0] == "#":\r
@@ -612,19 +598,19 @@ if __name__ == '__main__':
     EdkLogger.Initialize()\r
     if len(sys.argv) > 1:\r
         Br = BuildRule(sys.argv[1])\r
-        print str(Br[".c", "DXE_DRIVER", "IA32", "MSFT"][1])\r
-        print\r
-        print str(Br[".c", "DXE_DRIVER", "IA32", "INTEL"][1])\r
-        print\r
-        print str(Br[".c", "DXE_DRIVER", "IA32", "GCC"][1])\r
-        print\r
-        print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1])\r
-        print\r
-        print str(Br[".h", "ACPI_TABLE", "IA32", "INTEL"][1])\r
-        print\r
-        print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1])\r
-        print\r
-        print str(Br[".s", "SEC", "IPF", "COMMON"][1])\r
-        print\r
-        print str(Br[".s", "SEC"][1])\r
+        print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "MSFT"][1]))\r
+        print()\r
+        print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "INTEL"][1]))\r
+        print()\r
+        print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "GCC"][1]))\r
+        print()\r
+        print(str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1]))\r
+        print()\r
+        print(str(Br[".h", "ACPI_TABLE", "IA32", "INTEL"][1]))\r
+        print()\r
+        print(str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1]))\r
+        print()\r
+        print(str(Br[".s", SUP_MODULE_SEC, "IPF", "COMMON"][1]))\r
+        print()\r
+        print(str(Br[".s", SUP_MODULE_SEC][1]))\r
 \r