]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / GenFdsGlobalVariable.py
index c2e82de891d3594cc08cfbcd769f476200455762..eeb3ec2197a8f9f468f848851f02fa7ab65f62d4 100644 (file)
@@ -15,6 +15,7 @@
 ##\r
 # Import Modules\r
 #\r
+from __future__ import print_function\r
 import Common.LongFilePathOs as os\r
 import sys\r
 import subprocess\r
@@ -64,7 +65,7 @@ class GenFdsGlobalVariable:
     FdfFileTimeStamp = 0\r
     FixedLoadAddress = False\r
     PlatformName = ''\r
-    \r
+\r
     BuildRuleFamily = "MSFT"\r
     ToolChainFamily = "MSFT"\r
     __BuildRuleDatabase = None\r
@@ -74,7 +75,7 @@ class GenFdsGlobalVariable:
     CopyList   = []\r
     ModuleFile = ''\r
     EnableGenfdsMultiThread = False\r
-    \r
+\r
     #\r
     # The list whose element are flags to indicate if large FFS or SECTION files exist in FV.\r
     # At the beginning of each generation of FV, false flag is appended to the list,\r
@@ -89,7 +90,7 @@ class GenFdsGlobalVariable:
     LARGE_FILE_SIZE = 0x1000000\r
 \r
     SectionHeader = struct.Struct("3B 1B")\r
-    \r
+\r
     ## LoadBuildRule\r
     #\r
     @staticmethod\r
@@ -116,7 +117,7 @@ class GenFdsGlobalVariable:
                    and GenFdsGlobalVariable.ToolChainTag in ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY] \\r
                    and ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY][GenFdsGlobalVariable.ToolChainTag]:\r
                     GenFdsGlobalVariable.BuildRuleFamily = ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY][GenFdsGlobalVariable.ToolChainTag]\r
-                    \r
+\r
                 if DataType.TAB_TOD_DEFINES_FAMILY in ToolDefinition \\r
                    and GenFdsGlobalVariable.ToolChainTag in ToolDefinition[DataType.TAB_TOD_DEFINES_FAMILY] \\r
                    and ToolDefinition[DataType.TAB_TOD_DEFINES_FAMILY][GenFdsGlobalVariable.ToolChainTag]:\r
@@ -228,11 +229,11 @@ class GenFdsGlobalVariable:
             while Index < len(SourceList):\r
                 Source = SourceList[Index]\r
                 Index = Index + 1\r
-    \r
+\r
                 if File.IsBinary and File == Source and Inf.Binaries is not None and File in Inf.Binaries:\r
                     # Skip all files that are not binary libraries\r
                     if not Inf.LibraryClass:\r
-                        continue            \r
+                        continue\r
                     RuleObject = BuildRules[DataType.TAB_DEFAULT_BINARY_FILE]\r
                 elif FileType in BuildRules:\r
                     RuleObject = BuildRules[FileType]\r
@@ -243,15 +244,15 @@ class GenFdsGlobalVariable:
                     if LastTarget:\r
                         TargetList.add(str(LastTarget))\r
                     break\r
-    \r
+\r
                 FileType = RuleObject.SourceFileType\r
-    \r
+\r
                 # stop at STATIC_LIBRARY for library\r
                 if Inf.LibraryClass and FileType == DataType.TAB_STATIC_LIBRARY:\r
                     if LastTarget:\r
                         TargetList.add(str(LastTarget))\r
                     break\r
-    \r
+\r
                 Target = RuleObject.Apply(Source)\r
                 if not Target:\r
                     if LastTarget:\r
@@ -260,11 +261,11 @@ class GenFdsGlobalVariable:
                 elif not Target.Outputs:\r
                     # Only do build for target with outputs\r
                     TargetList.add(str(Target))\r
-    \r
+\r
                 # to avoid cyclic rule\r
                 if FileType in RuleChain:\r
                     break\r
-    \r
+\r
                 RuleChain.append(FileType)\r
                 SourceList.extend(Target.Outputs)\r
                 LastTarget = Target\r
@@ -340,7 +341,7 @@ class GenFdsGlobalVariable:
         for Arch in ArchList:\r
             GenFdsGlobalVariable.OutputDirDict[Arch] = os.path.normpath(\r
                 os.path.join(GlobalData.gWorkspace,\r
-                             WorkSpace.Db.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch,GlobalData.gGlobalDefines['TARGET'],\r
+                             WorkSpace.Db.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GlobalData.gGlobalDefines['TARGET'],\r
                              GlobalData.gGlobalDefines['TOOLCHAIN']].OutputDirectory,\r
                              GlobalData.gGlobalDefines['TARGET'] +'_' + GlobalData.gGlobalDefines['TOOLCHAIN']))\r
             GenFdsGlobalVariable.OutputDirFromDscDict[Arch] = os.path.normpath(\r
@@ -546,7 +547,7 @@ class GenFdsGlobalVariable:
 \r
         GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))\r
         if MakefilePath:\r
-            if (tuple(Cmd),tuple(GenFdsGlobalVariable.SecCmdList),tuple(GenFdsGlobalVariable.CopyList)) not in GenFdsGlobalVariable.FfsCmdDict:\r
+            if (tuple(Cmd), tuple(GenFdsGlobalVariable.SecCmdList), tuple(GenFdsGlobalVariable.CopyList)) not in GenFdsGlobalVariable.FfsCmdDict:\r
                 GenFdsGlobalVariable.FfsCmdDict[tuple(Cmd), tuple(GenFdsGlobalVariable.SecCmdList), tuple(GenFdsGlobalVariable.CopyList)] = MakefilePath\r
             GenFdsGlobalVariable.SecCmdList = []\r
             GenFdsGlobalVariable.CopyList = []\r
@@ -644,19 +645,19 @@ class GenFdsGlobalVariable:
     @staticmethod\r
     def GenerateOptionRom(Output, EfiInput, BinaryInput, Compress=False, ClassCode=None,\r
                         Revision=None, DeviceId=None, VendorId=None, IsMakefile=False):\r
-        InputList = []   \r
+        InputList = []\r
         Cmd = ["EfiRom"]\r
         if len(EfiInput) > 0:\r
-            \r
+\r
             if Compress:\r
                 Cmd.append("-ec")\r
             else:\r
                 Cmd.append("-e")\r
-                \r
+\r
             for EfiFile in EfiInput:\r
                 Cmd.append(EfiFile)\r
                 InputList.append (EfiFile)\r
-        \r
+\r
         if len(BinaryInput) > 0:\r
             Cmd.append("-b")\r
             for BinFile in BinaryInput:\r
@@ -667,7 +668,7 @@ class GenFdsGlobalVariable:
         if not GenFdsGlobalVariable.NeedsUpdate(Output, InputList) and not IsMakefile:\r
             return\r
         GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, InputList))\r
-                        \r
+\r
         if ClassCode is not None:\r
             Cmd += ("-l", ClassCode)\r
         if Revision is not None:\r
@@ -721,7 +722,7 @@ class GenFdsGlobalVariable:
 \r
         try:\r
             PopenObject = subprocess.Popen(' '.join(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)\r
-        except Exception, X:\r
+        except Exception as X:\r
             EdkLogger.error("GenFds", COMMAND_FAILURE, ExtraData="%s: %s" % (str(X), cmd[0]))\r
         (out, error) = PopenObject.communicate()\r
 \r
@@ -736,7 +737,7 @@ class GenFdsGlobalVariable:
             GenFdsGlobalVariable.InfLogger (out)\r
             GenFdsGlobalVariable.InfLogger (error)\r
             if PopenObject.returncode != 0:\r
-                print "###", cmd\r
+                print("###", cmd)\r
                 EdkLogger.error("GenFds", COMMAND_FAILURE, errorMess)\r
 \r
     def VerboseLogger (msg):\r
@@ -810,7 +811,7 @@ class GenFdsGlobalVariable:
                         EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)\r
                     if PcdObj.DatumType != DataType.TAB_VOID:\r
                         EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)\r
-                        \r
+\r
                     PcdValue = PcdObj.DefaultValue\r
                     return PcdValue\r
 \r
@@ -826,7 +827,7 @@ class GenFdsGlobalVariable:
                             EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)\r
                         if PcdObj.DatumType != DataType.TAB_VOID:\r
                             EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)\r
-                            \r
+\r
                         PcdValue = PcdObj.DefaultValue\r
                         return PcdValue\r
 \r