]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: FdfParser - refactor functions to make static
authorCarsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben>
Fri, 13 Apr 2018 20:51:35 +0000 (04:51 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Tue, 17 Apr 2018 12:49:54 +0000 (20:49 +0800)
make functions that doesn't use self into @staticmethod

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>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Source/Python/GenFds/FdfParser.py
BaseTools/Source/Python/GenFds/FfsInfStatement.py

index 662c232c86e427f97a7be79284644547ab8c1e31..dce41701a510ff2af605a9b8601e6180fc6abf10 100644 (file)
@@ -1131,7 +1131,8 @@ class FdfParser:
             self.__UndoToken()\r
             return False\r
 \r
-    def __Verify(self, Name, Value, Scope):\r
+    @staticmethod\r
+    def __Verify(Name, Value, Scope):\r
         if Scope in ['UINT64', 'UINT8']:\r
             ValueNumber = 0\r
             try:\r
@@ -3200,16 +3201,16 @@ class FdfParser:
                     raise Warning("expected value of %s" % Name, self.FileName, self.CurrentLineNumber)\r
                 Value = self.__Token\r
                 if Name == 'IMAGE_HEADER_INIT_VERSION':\r
-                    if self.__Verify(Name, Value, 'UINT8'):\r
+                    if FdfParser.__Verify(Name, Value, 'UINT8'):\r
                         FmpData.Version = Value\r
                 elif Name == 'IMAGE_INDEX':\r
-                    if self.__Verify(Name, Value, 'UINT8'):\r
+                    if FdfParser.__Verify(Name, Value, 'UINT8'):\r
                         FmpData.ImageIndex = Value\r
                 elif Name == 'HARDWARE_INSTANCE':\r
-                    if self.__Verify(Name, Value, 'UINT8'):\r
+                    if FdfParser.__Verify(Name, Value, 'UINT8'):\r
                         FmpData.HardwareInstance = Value\r
                 elif Name == 'MONOTONIC_COUNT':\r
-                    if self.__Verify(Name, Value, 'UINT64'):\r
+                    if FdfParser.__Verify(Name, Value, 'UINT64'):\r
                         FmpData.MonotonicCount = Value\r
                         if FmpData.MonotonicCount.upper().startswith('0X'):\r
                             FmpData.MonotonicCount = (long)(FmpData.MonotonicCount, 16)\r
index 5364569b96d7725a99a7bdb1b9057747437a722a..4f9936a97342f2f0a32f04e6a866380bb4bc50e7 100644 (file)
@@ -1011,7 +1011,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
                         if VfrUniOffsetList:\r
                             UniVfrOffsetFileName = os.path.join(self.OutputPath, self.BaseName + '.offset')\r
                             UniVfrOffsetFileSection = os.path.join(self.OutputPath, self.BaseName + 'Offset' + '.raw')\r
-                            self.__GenUniVfrOffsetFile (VfrUniOffsetList, UniVfrOffsetFileName)\r
+                            FfsInfStatement.__GenUniVfrOffsetFile (VfrUniOffsetList, UniVfrOffsetFileName)\r
                             UniVfrOffsetFileNameList = []\r
                             UniVfrOffsetFileNameList.append(UniVfrOffsetFileName)\r
                             """Call GenSection"""\r
@@ -1069,11 +1069,11 @@ class FfsInfStatement(FfsInfStatementClassObject):
     #\r
     #   Create parameter string for GenFfs\r
     #\r
-    #   @param  self        The object pointer\r
     #   @param  Rule        The rule object used to generate section\r
     #   @retval tuple       (FileType, Fixed, CheckSum, Alignment)\r
     #\r
-    def __GetGenFfsCmdParameter__(self, Rule):\r
+    @staticmethod\r
+    def __GetGenFfsCmdParameter__(Rule):\r
         result = tuple()\r
         result += ('-t', Ffs.Ffs.FdfFvFileTypeToFileType[Rule.FvFileType])\r
         if Rule.Fixed != False:\r
@@ -1103,11 +1103,11 @@ class FfsInfStatement(FfsInfStatementClassObject):
     #\r
     #   Generate the offset file for the module which contain VFR or UNI file.\r
     #\r
-    #   @param  self                    The object pointer\r
     #   @param  VfrUniOffsetList        A list contain the VFR/UNI offsets in the EFI image file.\r
     #   @param  UniVfrOffsetFileName    The output offset file name.\r
     #\r
-    def __GenUniVfrOffsetFile(self, VfrUniOffsetList, UniVfrOffsetFileName):\r
+    @staticmethod\r
+    def __GenUniVfrOffsetFile(VfrUniOffsetList, UniVfrOffsetFileName):\r
 \r
         # Use a instance of StringIO to cache data\r
         fStringIO = StringIO.StringIO('')  \r