From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 52457226CD623 for ; Sun, 22 Apr 2018 20:13:23 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Apr 2018 20:13:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,315,1520924400"; d="scan'208";a="34488820" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga008.fm.intel.com with ESMTP; 22 Apr 2018 20:13:22 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 22 Apr 2018 20:13:22 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.210]) by shsmsx102.ccr.corp.intel.com ([169.254.2.79]) with mapi id 14.03.0319.002; Mon, 23 Apr 2018 11:13:20 +0800 From: "Zhu, Yonghong" To: "Carsey, Jaben" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [PATCH v2 1/1] BaseTools: remove EdkIIWorkspace as its not used. Thread-Index: AQHT1/Dym6nT7jlqL0qMCdhBvL0ZnaQNsiqQ Date: Mon, 23 Apr 2018 03:13:20 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v2 1/1] BaseTools: remove EdkIIWorkspace as its not used. 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: , X-List-Received-Date: Mon, 23 Apr 2018 03:13:23 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu =20 Best Regards, Zhu Yonghong -----Original Message----- From: Carsey, Jaben=20 Sent: Thursday, April 19, 2018 11:13 PM To: edk2-devel@lists.01.org Cc: Gao, Liming ; Zhu, Yonghong Subject: [PATCH v2 1/1] BaseTools: remove EdkIIWorkspace as its not used. v2 - update makefile too. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Common/EdkIIWorkspace.py | 317 -------------------= - BaseTools/Source/Python/Makefile | 1 - 2 files changed, 318 deletions(-) diff --git a/BaseTools/Source/Python/Common/EdkIIWorkspace.py b/BaseTools/S= ource/Python/Common/EdkIIWorkspace.py deleted file mode 100644 index d75b9f8025b3..000000000000 --- a/BaseTools/Source/Python/Common/EdkIIWorkspace.py +++ /dev/null @@ -1,317 +0,0 @@ -## @file -# This is the base class for applications that operate on an EDK II Worksp= ace -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved= .
-# This program and the accompanying materials -# are licensed and ma= de available under the terms and conditions of the BSD License -# which acc= ompanies this distribution. The full text of the license may be found at -= # http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -#= WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLI= ED. -# - -## -# Import Modules -# -import Common.LongFilePathOs as os, sys, time -from DataType import * -fro= m Common.LongFilePathSupport import OpenLongFilePath as open -from Common.M= ultipleWorkspace import MultipleWorkspace as mws - -## EdkIIWorkspace -# -# Collect WorkspaceDir from the environment, the Verbose command line flag= , and detect an icon bitmap file. -#=20 -# @var StartTime: Time of build system starting -# @var PrintRunTime: Printable time of build system running -# @var PrintRunStatus: Printable status of build system running -# @var RunStatus: Status of build system running -# -class EdkIIWorkspace: - def __init__(self): - self.StartTime =3D time.time() - self.PrintRunTime =3D False - self.PrintRunStatus =3D False - self.RunStatus =3D '' - =20 - # - # Check environment valiable 'WORKSPACE' - # - if os.environ.get('WORKSPACE') is None: - print 'ERROR: WORKSPACE not defined. Please run EdkSetup fr= om the EDK II install directory.' - return False - - self.CurrentWorkingDir =3D os.getcwd() - =20 - self.WorkspaceDir =3D os.path.realpath(os.environ.get('WORKSPACE')= ) - (Drive, Path) =3D os.path.splitdrive(self.WorkspaceDir) - if Drive =3D=3D '': - (Drive, CwdPath) =3D os.path.splitdrive(self.CurrentWorkingDir= ) - if Drive !=3D '': - self.WorkspaceDir =3D Drive + Path - else: - self.WorkspaceDir =3D Drive.upper() + Path - - self.WorkspaceRelativeWorkingDir =3D self.WorkspaceRelativePath (s= elf.CurrentWorkingDir) - =20 - try: - # - # Load TianoCoreOrgLogo, used for GUI tool - # - self.Icon =3D wx.Icon(self.WorkspaceFile('tools/Python/TianoCo= reOrgLogo.gif'), wx.BITMAP_TYPE_GIF) - except: - self.Icon =3D None - =20 - self.Verbose =3D False - for Arg in sys.argv: - if Arg.lower() =3D=3D '-v': - self.Verbose =3D True - =20 - ## Close build system - # - # Close build system and print running time and status - # - def Close(self): - if self.PrintRunTime: - Seconds =3D int(time.time() - self.StartTime) - if Seconds < 60: - print 'Run Time: %d seconds' % (Seconds) - else: - Minutes =3D Seconds / 60 - Seconds =3D Seconds % 60 - if Minutes < 60: - print 'Run Time: %d minutes %d seconds' % (Minutes, Se= conds) - else: - Hours =3D Minutes / 60 - Minutes =3D Minutes % 60 - print 'Run Time: %d hours %d minutes %d seconds' % (Ho= urs, Minutes, Seconds) - if self.RunStatus !=3D '': - print self.RunStatus - - ## Convert to a workspace relative filename - # - # Convert a full path filename to a workspace relative filename. - # - # @param FileName: The filename to be Converted - # - # @retval None Workspace dir is not found in the full path - # @retval string The relative filename - # - def WorkspaceRelativePath(self, FileName): - FileName =3D os.path.realpath(FileName) - if FileName.find(self.WorkspaceDir) !=3D 0: - return None - return FileName.replace (self.WorkspaceDir, '').strip('\\').strip(= '/') - - ## Convert to a full path filename - # - # Convert a workspace relative filename to a full path filename. - # - # @param FileName: The filename to be Converted - # - # @retval string The full path filename - # - def WorkspaceFile(self, FileName): - return os.path.realpath(mws.join(self.WorkspaceDir,FileName)) - - ## Convert to a real path filename - # - # Convert ${WORKSPACE} to real path - # - # @param FileName: The filename to be Converted - # - # @retval string The full path filename - # - def WorkspacePathConvert(self, FileName): - return os.path.realpath(FileName.replace(TAB_WORKSPACE, self.Works= paceDir)) - - ## Convert XML into a DOM - # - # Parse an XML file into a DOM and return the DOM. - # - # @param FileName: The filename to be parsed - # - # @retval XmlParseFile (self.WorkspaceFile(FileName)) - # - def XmlParseFile (self, FileName): - if self.Verbose: - print FileName - return XmlParseFile (self.WorkspaceFile(FileName)) - - ## Convert a XML section - # - # Parse a section of an XML file into a DOM(Document Object Model) and= return the DOM. - # - # @param FileName: The filename to be parsed - # @param SectionTag: The tag name of the section to be parsed - # - # @retval XmlParseFileSection (self.WorkspaceFile(FileName), SectionTa= g) - # - def XmlParseFileSection (self, FileName, SectionTag): - if self.Verbose: - print FileName - return XmlParseFileSection (self.WorkspaceFile(FileName), SectionT= ag) - - ## Save a XML file - # - # Save a DOM(Document Object Model) into an XML file. - # - # @param Dom: The Dom to be saved - # @param FileName: The filename - # - # @retval XmlSaveFile (Dom, self.WorkspaceFile(FileName)) - # - def XmlSaveFile (self, Dom, FileName): - if self.Verbose: - print FileName - return XmlSaveFile (Dom, self.WorkspaceFile(FileName)) - - ## Convert Text File To Dictionary - # - # Convert a workspace relative text file to a dictionary of (name:valu= e) pairs. - # - # @param FileName: Text filename - # @param Dictionary: Dictionary to store data - # @param CommentCharacter: Comment char, be used to ignore comment= content - # @param KeySplitCharacter: Key split char, between key name and ke= y value. Key1 =3D Value1, '=3D' is the key split char - # @param ValueSplitFlag: Value split flag, be used to decide if = has multiple values - # @param ValueSplitCharacter: Value split char, be used to split mult= iple values. Key1 =3D Value1|Value2, '|' is the value split char - # - # @retval ConvertTextFileToDictionary(self.WorkspaceFile(FileName), Di= ctionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCh= aracter) - # - def ConvertTextFileToDictionary(self, FileName, Dictionary, CommentCha= racter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter): - if self.Verbose: - print FileName - return ConvertTextFileToDictionary(self.WorkspaceFile(FileName), D= ictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitC= haracter) - - ## Convert Dictionary To Text File - # - # Convert a dictionary of (name:value) pairs to a workspace relative t= ext file. - # - # @param FileName: Text filename - # @param Dictionary: Dictionary to store data - # @param CommentCharacter: Comment char, be used to ignore comment= content - # @param KeySplitCharacter: Key split char, between key name and ke= y value. Key1 =3D Value1, '=3D' is the key split char - # @param ValueSplitFlag: Value split flag, be used to decide if = has multiple values - # @param ValueSplitCharacter: Value split char, be used to split mult= iple values. Key1 =3D Value1|Value2, '|' is the value split char - # - # @retval ConvertDictionaryToTextFile(self.WorkspaceFile(FileName), Di= ctionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCh= aracter) - # - def ConvertDictionaryToTextFile(self, FileName, Dictionary, CommentCha= racter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter): - if self.Verbose: - print FileName - return ConvertDictionaryToTextFile(self.WorkspaceFile(FileName), D= ictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitC= haracter) - -## Convert Text File To Dictionary -# -# Convert a text file to a dictionary of (name:value) pairs. -# -# @param FileName: Text filename -# @param Dictionary: Dictionary to store data -# @param CommentCharacter: Comment char, be used to ignore comment con= tent -# @param KeySplitCharacter: Key split char, between key name and key va= lue. Key1 =3D Value1, '=3D' is the key split char -# @param ValueSplitFlag: Value split flag, be used to decide if has = multiple values -# @param ValueSplitCharacter: Value split char, be used to split multiple= values. Key1 =3D Value1|Value2, '|' is the value split char -# -# @retval = True Convert successfully -# @retval False Open file failed -# -def Conver= tTextFileToDictionary(FileName, Dictionary, CommentCharacter, KeySplitChara= cter, ValueSplitFlag, ValueSplitCharacter): - try: - F =3D open(FileName, 'r') - except: - return False - Keys =3D [] - for Line in F: - LineList =3D Line.split(KeySplitCharacter, 1) - if len(LineList) >=3D 2: - Key =3D LineList[0].split() - if len(Key) =3D=3D 1 and Key[0][0] !=3D CommentCharacter and K= ey[0] not in Keys: - if ValueSplitFlag: - Dictionary[Key[0]] =3D LineList[1].replace('\\', '/').= split(ValueSplitCharacter) - else: - Dictionary[Key[0]] =3D LineList[1].strip().replace('\\= ', '/') - Keys +=3D [Key[0]] - F.close() - return True - -## Convert Dictionary To Text File -# -# Convert a dictionary of (name:value) pairs to a text file. -# -# @param FileName: Text filename -# @param Dictionary: Dictionary to store data -# @param CommentCharacter: Comment char, be used to ignore comment con= tent -# @param KeySplitCharacter: Key split char, between key name and key va= lue. Key1 =3D Value1, '=3D' is the key split char -# @param ValueSplitFlag: Value split flag, be used to decide if has = multiple values -# @param ValueSplitCharacter: Value split char, be used to split multiple= values. Key1 =3D Value1|Value2, '|' is the value split char -# -# @retval = True Convert successfully -# @retval False Open file failed -# -def Conver= tDictionaryToTextFile(FileName, Dictionary, CommentCharacter, KeySplitChara= cter, ValueSplitFlag, ValueSplitCharacter): - try: - F =3D open(FileName, 'r') - Lines =3D [] - Lines =3D F.readlines() - F.close() - except: - Lines =3D [] - Keys =3D Dictionary.keys() - MaxLength =3D max(map(len,Keys)) - Index =3D 0 - for Line in Lines: - LineList =3D Line.split(KeySplitCharacter, 1) - if len(LineList) >=3D 2: - Key =3D LineList[0].split() - if len(Key) =3D=3D 1 and Key[0][0] !=3D CommentCharacter and K= ey[0] in Dictionary: - if ValueSplitFlag: - Line =3D '%-*s %c %s\n' % (MaxLength, Key[0], KeySplit= Character, ' '.join(Dictionary[Key[0]])) - else: - Line =3D '%-*s %c %s\n' % (MaxLength, Key[0], KeySplit= Character, Dictionary[Key[0]]) - Lines.pop(Index) - if Key[0] in Keys: - Lines.insert(Index, Line) - Keys.remove(Key[0]) - Index +=3D 1 - for RemainingKey in Keys: - if ValueSplitFlag: - Line =3D '%-*s %c %s\n' % (MaxLength, RemainingKey, KeySplitCh= aracter, ' '.join(Dictionary[RemainingKey])) - else: - Line =3D '%-*s %c %s\n' % (MaxLength, RemainingKey, KeySplitCh= aracter, Dictionary[RemainingKey]) - Lines.append(Line) - try: - F =3D open(FileName, 'w') - except: - return False - F.writelines(Lines) - F.close() - return True - -## Create a new directory -# -# @param Directory: Directory to be created -# -def CreateDirectory(Directory): - if not os.access(Directory, os.F_OK): - os.makedirs (Directory) - -## Create a new file -# -# @param Directory: Directory to be created -# @param FileName: Filename to be created -# @param Mode: The mode of open file, defautl is 'w' -# -def CreateFile(Directory, FileName, Mode=3D'w'): - CreateDirectory (Directory) - return open(os.path.join(Directory, FileName), Mode) - -## -# -# This acts like the main() function for the script, unless it is 'import'= ed into another -# script. -# -if __name__ =3D=3D '__main__': - # Nothing to do here. Could do some unit tests - pass \ No newline at end of file diff --git a/BaseTools/Source/Python/Makefile b/BaseTools/Source/Python/Mak= efile index a51207d3d831..4fda6d7e0c84 100644 --- a/BaseTools/Source/Python/Makefile +++ b/BaseTools/Source/Python/Makefile @@ -37,7 +37,6 @@ APPLICATIONS=3D$(BIN_DIR)\build.exe $(BIN_DIR)\GenFds.exe= $(BIN_DIR)\Trim.exe $(BI COMMON_PYTHON=3D$(BASE_TOOLS_PATH)\Source\Python= \Common\BuildToolError.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\Database.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\DataType.py \ - $(BASE_TOOLS_PATH)\Source\Python\Common\EdkIIWorkspace.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\EdkLogger.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\Expression.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\GlobalData.py \ -- 2.16.2.windows.1