From nobody Sat Jul 5 01:33:27 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 152365271467063.30516755381632; Fri, 13 Apr 2018 13:51:54 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A6F1B203C0058; Fri, 13 Apr 2018 13:51:43 -0700 (PDT) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C5F9A220E8CCF for ; Fri, 13 Apr 2018 13:51:41 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Apr 2018 13:51:41 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga001.jf.intel.com with ESMTP; 13 Apr 2018 13:51:40 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,446,1517904000"; d="scan'208";a="47729451" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 13 Apr 2018 13:51:35 -0700 Message-Id: <88f706cc2b907abdebee4396c4d6868bbc333d6b.1523652584.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 8/9] BaseTools: FdfParser - refactor functions to make static X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Jaben make functions that doesn't use self into @staticmethod Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/GenFds/FdfParser.py | 11 ++++++----- BaseTools/Source/Python/GenFds/FfsInfStatement.py | 10 +++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source= /Python/GenFds/FdfParser.py index 662c232c86e4..dce41701a510 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -1131,7 +1131,8 @@ class FdfParser: self.__UndoToken() return False =20 - def __Verify(self, Name, Value, Scope): + @staticmethod + def __Verify(Name, Value, Scope): if Scope in ['UINT64', 'UINT8']: ValueNumber =3D 0 try: @@ -3200,16 +3201,16 @@ class FdfParser: raise Warning("expected value of %s" % Name, self.File= Name, self.CurrentLineNumber) Value =3D self.__Token if Name =3D=3D 'IMAGE_HEADER_INIT_VERSION': - if self.__Verify(Name, Value, 'UINT8'): + if FdfParser.__Verify(Name, Value, 'UINT8'): FmpData.Version =3D Value elif Name =3D=3D 'IMAGE_INDEX': - if self.__Verify(Name, Value, 'UINT8'): + if FdfParser.__Verify(Name, Value, 'UINT8'): FmpData.ImageIndex =3D Value elif Name =3D=3D 'HARDWARE_INSTANCE': - if self.__Verify(Name, Value, 'UINT8'): + if FdfParser.__Verify(Name, Value, 'UINT8'): FmpData.HardwareInstance =3D Value elif Name =3D=3D 'MONOTONIC_COUNT': - if self.__Verify(Name, Value, 'UINT64'): + if FdfParser.__Verify(Name, Value, 'UINT64'): FmpData.MonotonicCount =3D Value if FmpData.MonotonicCount.upper().startswith('0X'): FmpData.MonotonicCount =3D (long)(FmpData.Mono= tonicCount, 16) diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/= Source/Python/GenFds/FfsInfStatement.py index 5364569b96d7..4f9936a97342 100644 --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py @@ -1011,7 +1011,7 @@ class FfsInfStatement(FfsInfStatementClassObject): if VfrUniOffsetList: UniVfrOffsetFileName =3D os.path.join(self.Out= putPath, self.BaseName + '.offset') UniVfrOffsetFileSection =3D os.path.join(self.= OutputPath, self.BaseName + 'Offset' + '.raw') - self.__GenUniVfrOffsetFile (VfrUniOffsetList, = UniVfrOffsetFileName) + FfsInfStatement.__GenUniVfrOffsetFile (VfrUniO= ffsetList, UniVfrOffsetFileName) UniVfrOffsetFileNameList =3D [] UniVfrOffsetFileNameList.append(UniVfrOffsetFi= leName) """Call GenSection""" @@ -1069,11 +1069,11 @@ class FfsInfStatement(FfsInfStatementClassObject): # # Create parameter string for GenFfs # - # @param self The object pointer # @param Rule The rule object used to generate section # @retval tuple (FileType, Fixed, CheckSum, Alignment) # - def __GetGenFfsCmdParameter__(self, Rule): + @staticmethod + def __GetGenFfsCmdParameter__(Rule): result =3D tuple() result +=3D ('-t', Ffs.Ffs.FdfFvFileTypeToFileType[Rule.FvFileType= ]) if Rule.Fixed !=3D False: @@ -1103,11 +1103,11 @@ class FfsInfStatement(FfsInfStatementClassObject): # # Generate the offset file for the module which contain VFR or UNI f= ile. # - # @param self The object pointer # @param VfrUniOffsetList A list contain the VFR/UNI offsets= in the EFI image file. # @param UniVfrOffsetFileName The output offset file name. # - def __GenUniVfrOffsetFile(self, VfrUniOffsetList, UniVfrOffsetFileName= ): + @staticmethod + def __GenUniVfrOffsetFile(VfrUniOffsetList, UniVfrOffsetFileName): =20 # Use a instance of StringIO to cache data fStringIO =3D StringIO.StringIO('') =20 --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel