From nobody Fri Nov 1 03:37:52 2024 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 1522789418088417.3824242810749; Tue, 3 Apr 2018 14:03:38 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7C3E6226085C4; Tue, 3 Apr 2018 14:03:15 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 6ACDB221467D2 for ; Tue, 3 Apr 2018 14:03:12 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 14:03:11 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga002.jf.intel.com with ESMTP; 03 Apr 2018 14:03:11 -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.31; helo=mga06.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,402,1517904000"; d="scan'208";a="47710182" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 3 Apr 2018 14:03:10 -0700 Message-Id: <38530efaecb65ea10842f19e46d531bf86a3e835.1522789210.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 10/10] BaseTools: Remove unused code from Misc 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" remove the functions and classes remove any imports of these Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Common/Misc.py | 280 +------------------- BaseTools/Source/Python/Eot/Eot.py | 1 - 2 files changed, 1 insertion(+), 280 deletions(-) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index d1752d8a624e..5e9a104305c2 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -287,32 +287,6 @@ def ClearDuplicatedInf(): if os.path.exists(File): os.remove(File) =20 -## callback routine for processing variable option -# -# This function can be used to process variable number of option values. T= he -# typical usage of it is specify architecure list on command line. -# (e.g. -a IA32 X64 IPF) -# -# @param Option Standard callback function parameter -# @param OptionString Standard callback function parameter -# @param Value Standard callback function parameter -# @param Parser Standard callback function parameter -# -# @retval -# -def ProcessVariableArgument(Option, OptionString, Value, Parser): - assert Value is None - Value =3D [] - RawArgs =3D Parser.rargs - while RawArgs: - Arg =3D RawArgs[0] - if (Arg[:2] =3D=3D "--" and len(Arg) > 2) or \ - (Arg[:1] =3D=3D "-" and len(Arg) > 1 and Arg[1] !=3D "-"): - break - Value.append(Arg) - del RawArgs[0] - setattr(Parser.values, Option.dest, Value) - ## Convert GUID string in xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx style to C = structure style # # @param Guid The GUID string @@ -450,32 +424,6 @@ def RemoveDirectory(Directory, Recursively=3DFalse): os.chdir(CurrentDirectory) os.rmdir(Directory) =20 -## Check if given file is changed or not -# -# This method is used to check if a file is changed or not between two bu= ild -# actions. It makes use a cache to store files timestamp. -# -# @param File The path of file -# -# @retval True If the given file is changed, doesn't exist, or ca= n't be -# found in timestamp cache -# @retval False If the given file is changed -# -def IsChanged(File): - if not os.path.exists(File): - return True - - FileState =3D os.stat(File) - TimeStamp =3D FileState[-2] - - if File in gFileTimeStampCache and TimeStamp =3D=3D gFileTimeStampCach= e[File]: - FileChanged =3D False - else: - FileChanged =3D True - gFileTimeStampCache[File] =3D TimeStamp - - return FileChanged - ## Store content in file # # This method is used to save file only when its content is changed. This= is @@ -635,47 +583,6 @@ class DirCache: return os.path.join(self._Root, self._UPPER_CACHE_[UpperPath]) return None =20 -## Get all files of a directory -# -# @param Root: Root dir -# @param SkipList : The files need be skipped -# -# @retval A list of all files -# -def GetFiles(Root, SkipList=3DNone, FullPath=3DTrue): - OriPath =3D Root - FileList =3D [] - for Root, Dirs, Files in os.walk(Root): - if SkipList: - for Item in SkipList: - if Item in Dirs: - Dirs.remove(Item) - - for File in Files: - File =3D os.path.normpath(os.path.join(Root, File)) - if not FullPath: - File =3D File[len(OriPath) + 1:] - FileList.append(File) - - return FileList - -## Check if gvien file exists or not -# -# @param File File name or path to be checked -# @param Dir The directory the file is relative to -# -# @retval True if file exists -# @retval False if file doesn't exists -# -def ValidFile(File, Ext=3DNone): - if Ext is not None: - Dummy, FileExt =3D os.path.splitext(File) - if FileExt.lower() !=3D Ext.lower(): - return False - if not os.path.exists(File): - return False - return True - def RealPath(File, Dir=3D'', OverrideDir=3D''): NewFile =3D os.path.normpath(os.path.join(Dir, File)) NewFile =3D GlobalData.gAllFiles[NewFile] @@ -710,115 +617,6 @@ def RealPath2(File, Dir=3D'', OverrideDir=3D''): =20 return None, None =20 -## Check if gvien file exists or not -# -# -def ValidFile2(AllFiles, File, Ext=3DNone, Workspace=3D'', EfiSource=3D'',= EdkSource=3D'', Dir=3D'.', OverrideDir=3D''): - NewFile =3D File - if Ext is not None: - Dummy, FileExt =3D os.path.splitext(File) - if FileExt.lower() !=3D Ext.lower(): - return False, File - - # Replace the Edk macros - if OverrideDir !=3D '' and OverrideDir is not None: - if OverrideDir.find('$(EFI_SOURCE)') > -1: - OverrideDir =3D OverrideDir.replace('$(EFI_SOURCE)', EfiSource) - if OverrideDir.find('$(EDK_SOURCE)') > -1: - OverrideDir =3D OverrideDir.replace('$(EDK_SOURCE)', EdkSource) - - # Replace the default dir to current dir - if Dir =3D=3D '.': - Dir =3D os.getcwd() - Dir =3D Dir[len(Workspace) + 1:] - - # First check if File has Edk definition itself - if File.find('$(EFI_SOURCE)') > -1 or File.find('$(EDK_SOURCE)') > -1: - NewFile =3D File.replace('$(EFI_SOURCE)', EfiSource) - NewFile =3D NewFile.replace('$(EDK_SOURCE)', EdkSource) - NewFile =3D AllFiles[os.path.normpath(NewFile)] - if NewFile is not None: - return True, NewFile - - # Second check the path with override value - if OverrideDir !=3D '' and OverrideDir is not None: - NewFile =3D AllFiles[os.path.normpath(os.path.join(OverrideDir, Fi= le))] - if NewFile is not None: - return True, NewFile - - # Last check the path with normal definitions - File =3D os.path.join(Dir, File) - NewFile =3D AllFiles[os.path.normpath(File)] - if NewFile is not None: - return True, NewFile - - return False, File - -## Check if gvien file exists or not -# -# -def ValidFile3(AllFiles, File, Workspace=3D'', EfiSource=3D'', EdkSource= =3D'', Dir=3D'.', OverrideDir=3D''): - # Replace the Edk macros - if OverrideDir !=3D '' and OverrideDir is not None: - if OverrideDir.find('$(EFI_SOURCE)') > -1: - OverrideDir =3D OverrideDir.replace('$(EFI_SOURCE)', EfiSource) - if OverrideDir.find('$(EDK_SOURCE)') > -1: - OverrideDir =3D OverrideDir.replace('$(EDK_SOURCE)', EdkSource) - - # Replace the default dir to current dir - # Dir is current module dir related to workspace - if Dir =3D=3D '.': - Dir =3D os.getcwd() - Dir =3D Dir[len(Workspace) + 1:] - - NewFile =3D File - RelaPath =3D AllFiles[os.path.normpath(Dir)] - NewRelaPath =3D RelaPath - - while(True): - # First check if File has Edk definition itself - if File.find('$(EFI_SOURCE)') > -1 or File.find('$(EDK_SOURCE)') >= -1: - File =3D File.replace('$(EFI_SOURCE)', EfiSource) - File =3D File.replace('$(EDK_SOURCE)', EdkSource) - NewFile =3D AllFiles[os.path.normpath(File)] - if NewFile is not None: - NewRelaPath =3D os.path.dirname(NewFile) - File =3D os.path.basename(NewFile) - #NewRelaPath =3D NewFile[:len(NewFile) - len(File.replace(= "..\\", '').replace("../", '')) - 1] - break - - # Second check the path with override value - if OverrideDir !=3D '' and OverrideDir is not None: - NewFile =3D AllFiles[os.path.normpath(os.path.join(OverrideDir= , File))] - if NewFile is not None: - #NewRelaPath =3D os.path.dirname(NewFile) - NewRelaPath =3D NewFile[:len(NewFile) - len(File.replace("= ..\\", '').replace("../", '')) - 1] - break - - # Last check the path with normal definitions - NewFile =3D AllFiles[os.path.normpath(os.path.join(Dir, File))] - if NewFile is not None: - break - - # No file found - break - - return NewRelaPath, RelaPath, File - - -def GetRelPath(Path1, Path2): - FileName =3D os.path.basename(Path2) - L1 =3D os.path.normpath(Path1).split(os.path.normpath('/')) - L2 =3D os.path.normpath(Path2).split(os.path.normpath('/')) - for Index in range(0, len(L1)): - if L1[Index] !=3D L2[Index]: - FileName =3D '../' * (len(L1) - Index) - for Index2 in range(Index, len(L2)): - FileName =3D os.path.join(FileName, L2[Index2]) - break - return os.path.normpath(FileName) - - ## Get GUID value from given packages # # @param CName The CName of the GUID @@ -1411,36 +1209,6 @@ class tdict: keys |=3D self.data[Key].GetKeys(KeyIndex - 1) return keys =20 -## Boolean chain list -# -class Blist(UserList): - def __init__(self, initlist=3DNone): - UserList.__init__(self, initlist) - def __setitem__(self, i, item): - if item not in [True, False]: - if item =3D=3D 0: - item =3D False - else: - item =3D True - self.data[i] =3D item - def _GetResult(self): - Value =3D True - for item in self.data: - Value &=3D item - return Value - Result =3D property(_GetResult) - -def ParseConsoleLog(Filename): - Opr =3D open(os.path.normpath(Filename), 'r') - Opw =3D open(os.path.normpath(Filename + '.New'), 'w+') - for Line in Opr.readlines(): - if Line.find('.efi') > -1: - Line =3D Line[Line.rfind(' ') : Line.rfind('.efi')].strip() - Opw.write('%s\n' % Line) - - Opr.close() - Opw.close() - def IsFieldValueAnArray (Value): Value =3D Value.strip() if Value.startswith('GUID') and Value.endswith(')'): @@ -1649,7 +1417,7 @@ def ParseFieldValue (Value): ## AnalyzeDscPcd # # Analyze DSC PCD value, since there is no data type info in DSC -# This fuction is used to match functions (AnalyzePcdData, AnalyzeHiiPcdD= ata, AnalyzeVpdPcdData) used for retrieving PCD value from database +# This fuction is used to match functions (AnalyzePcdData) used for retri= eving PCD value from database # 1. Feature flag: TokenSpace.PcdCName|PcdValue # 2. Fix and Patch:TokenSpace.PcdCName|PcdValue[|MaxSize] # 3. Dynamic default: @@ -1785,52 +1553,6 @@ def AnalyzePcdData(Setting): =20 return ValueList =20 =20 -## AnalyzeHiiPcdData -# -# Analyze the pcd Value, variable name, variable Guid and variable offset. -# Used to avoid split issue while the value string contain "|" character -# -# @param[in] Setting: A String contain VariableName, VariableGuid, Varia= bleOffset, DefaultValue information; -# =20 -# @retval ValueList: A List contaian VariableName, VariableGuid, Variab= leOffset, DefaultValue.=20 -# -def AnalyzeHiiPcdData(Setting): - ValueList =3D ['', '', '', ''] - - TokenList =3D GetSplitValueList(Setting) - ValueList[0:len(TokenList)] =3D TokenList - - return ValueList - -## AnalyzeVpdPcdData -# -# Analyze the vpd pcd VpdOffset, MaxDatumSize and InitialValue. -# Used to avoid split issue while the value string contain "|" character -# -# @param[in] Setting: A String contain VpdOffset/MaxDatumSize/InitialVal= ue information; -# =20 -# @retval ValueList: A List contain VpdOffset, MaxDatumSize and Initial= Value.=20 -# -def AnalyzeVpdPcdData(Setting): - ValueList =3D ['', '', ''] - - ValueRe =3D re.compile(r'\s*L?\".*\|.*\"\s*$') - PtrValue =3D ValueRe.findall(Setting) - =20 - ValueUpdateFlag =3D False - =20 - if len(PtrValue) >=3D 1: - Setting =3D re.sub(ValueRe, '', Setting) - ValueUpdateFlag =3D True - - TokenList =3D Setting.split(TAB_VALUE_SPLIT) - ValueList[0:len(TokenList)] =3D TokenList - =20 - if ValueUpdateFlag: - ValueList[2] =3D PtrValue[0] - =20 - return ValueList =20 - ## check format of PCD value against its the datum type # # For PCD value setting diff --git a/BaseTools/Source/Python/Eot/Eot.py b/BaseTools/Source/Python/E= ot/Eot.py index 45c97bb258f2..96c339613476 100644 --- a/BaseTools/Source/Python/Eot/Eot.py +++ b/BaseTools/Source/Python/Eot/Eot.py @@ -27,7 +27,6 @@ import Database from FvImage import * from array import array from Report import Report -from Common.Misc import ParseConsoleLog from Common.BuildVersion import gBUILD_VERSION from Parser import ConvertGuid from Common.LongFilePathSupport import OpenLongFilePath as open --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel