* [PATCH v2 1/1] BaseTools: remove EdkIIWorkspace as its not used. [not found] <cover.1524150605.git.jaben.carsey@intel.com> @ 2018-04-19 15:12 ` Jaben Carsey [not found] ` <cover.1524150680.git.jaben.carsey@intel.com> 2018-04-23 3:13 ` [PATCH v2 1/1] BaseTools: remove EdkIIWorkspace as its " Zhu, Yonghong 0 siblings, 2 replies; 4+ messages in thread From: Jaben Carsey @ 2018-04-19 15:12 UTC (permalink / raw) To: edk2-devel; +Cc: Liming Gao, Yonghong Zhu v2 - update makefile too. 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> --- 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/Source/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 Workspace -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies 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 IMPLIED. -# - -## -# Import Modules -# -import Common.LongFilePathOs as os, sys, time -from DataType import * -from Common.LongFilePathSupport import OpenLongFilePath as open -from Common.MultipleWorkspace import MultipleWorkspace as mws - -## EdkIIWorkspace -# -# Collect WorkspaceDir from the environment, the Verbose command line flag, and detect an icon bitmap file. -# -# @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 = time.time() - self.PrintRunTime = False - self.PrintRunStatus = False - self.RunStatus = '' - - # - # Check environment valiable 'WORKSPACE' - # - if os.environ.get('WORKSPACE') is None: - print 'ERROR: WORKSPACE not defined. Please run EdkSetup from the EDK II install directory.' - return False - - self.CurrentWorkingDir = os.getcwd() - - self.WorkspaceDir = os.path.realpath(os.environ.get('WORKSPACE')) - (Drive, Path) = os.path.splitdrive(self.WorkspaceDir) - if Drive == '': - (Drive, CwdPath) = os.path.splitdrive(self.CurrentWorkingDir) - if Drive != '': - self.WorkspaceDir = Drive + Path - else: - self.WorkspaceDir = Drive.upper() + Path - - self.WorkspaceRelativeWorkingDir = self.WorkspaceRelativePath (self.CurrentWorkingDir) - - try: - # - # Load TianoCoreOrgLogo, used for GUI tool - # - self.Icon = wx.Icon(self.WorkspaceFile('tools/Python/TianoCoreOrgLogo.gif'), wx.BITMAP_TYPE_GIF) - except: - self.Icon = None - - self.Verbose = False - for Arg in sys.argv: - if Arg.lower() == '-v': - self.Verbose = True - - ## Close build system - # - # Close build system and print running time and status - # - def Close(self): - if self.PrintRunTime: - Seconds = int(time.time() - self.StartTime) - if Seconds < 60: - print 'Run Time: %d seconds' % (Seconds) - else: - Minutes = Seconds / 60 - Seconds = Seconds % 60 - if Minutes < 60: - print 'Run Time: %d minutes %d seconds' % (Minutes, Seconds) - else: - Hours = Minutes / 60 - Minutes = Minutes % 60 - print 'Run Time: %d hours %d minutes %d seconds' % (Hours, Minutes, Seconds) - if self.RunStatus != '': - 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 = os.path.realpath(FileName) - if FileName.find(self.WorkspaceDir) != 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.WorkspaceDir)) - - ## 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), SectionTag) - # - def XmlParseFileSection (self, FileName, SectionTag): - if self.Verbose: - print FileName - return XmlParseFileSection (self.WorkspaceFile(FileName), SectionTag) - - ## 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:value) 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 key value. Key1 = Value1, '=' 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 = Value1|Value2, '|' is the value split char - # - # @retval ConvertTextFileToDictionary(self.WorkspaceFile(FileName), Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter) - # - def ConvertTextFileToDictionary(self, FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter): - if self.Verbose: - print FileName - return ConvertTextFileToDictionary(self.WorkspaceFile(FileName), Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter) - - ## Convert Dictionary To Text File - # - # Convert a dictionary of (name:value) pairs to a workspace relative text 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 key value. Key1 = Value1, '=' 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 = Value1|Value2, '|' is the value split char - # - # @retval ConvertDictionaryToTextFile(self.WorkspaceFile(FileName), Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter) - # - def ConvertDictionaryToTextFile(self, FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter): - if self.Verbose: - print FileName - return ConvertDictionaryToTextFile(self.WorkspaceFile(FileName), Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter) - -## 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 content -# @param KeySplitCharacter: Key split char, between key name and key value. Key1 = Value1, '=' 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 = Value1|Value2, '|' is the value split char -# -# @retval True Convert successfully -# @retval False Open file failed -# -def ConvertTextFileToDictionary(FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter): - try: - F = open(FileName, 'r') - except: - return False - Keys = [] - for Line in F: - LineList = Line.split(KeySplitCharacter, 1) - if len(LineList) >= 2: - Key = LineList[0].split() - if len(Key) == 1 and Key[0][0] != CommentCharacter and Key[0] not in Keys: - if ValueSplitFlag: - Dictionary[Key[0]] = LineList[1].replace('\\', '/').split(ValueSplitCharacter) - else: - Dictionary[Key[0]] = LineList[1].strip().replace('\\', '/') - Keys += [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 content -# @param KeySplitCharacter: Key split char, between key name and key value. Key1 = Value1, '=' 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 = Value1|Value2, '|' is the value split char -# -# @retval True Convert successfully -# @retval False Open file failed -# -def ConvertDictionaryToTextFile(FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter): - try: - F = open(FileName, 'r') - Lines = [] - Lines = F.readlines() - F.close() - except: - Lines = [] - Keys = Dictionary.keys() - MaxLength = max(map(len,Keys)) - Index = 0 - for Line in Lines: - LineList = Line.split(KeySplitCharacter, 1) - if len(LineList) >= 2: - Key = LineList[0].split() - if len(Key) == 1 and Key[0][0] != CommentCharacter and Key[0] in Dictionary: - if ValueSplitFlag: - Line = '%-*s %c %s\n' % (MaxLength, Key[0], KeySplitCharacter, ' '.join(Dictionary[Key[0]])) - else: - Line = '%-*s %c %s\n' % (MaxLength, Key[0], KeySplitCharacter, Dictionary[Key[0]]) - Lines.pop(Index) - if Key[0] in Keys: - Lines.insert(Index, Line) - Keys.remove(Key[0]) - Index += 1 - for RemainingKey in Keys: - if ValueSplitFlag: - Line = '%-*s %c %s\n' % (MaxLength, RemainingKey, KeySplitCharacter, ' '.join(Dictionary[RemainingKey])) - else: - Line = '%-*s %c %s\n' % (MaxLength, RemainingKey, KeySplitCharacter, Dictionary[RemainingKey]) - Lines.append(Line) - try: - F = 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='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__ == '__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/Makefile index a51207d3d831..4fda6d7e0c84 100644 --- a/BaseTools/Source/Python/Makefile +++ b/BaseTools/Source/Python/Makefile @@ -37,7 +37,6 @@ APPLICATIONS=$(BIN_DIR)\build.exe $(BIN_DIR)\GenFds.exe $(BIN_DIR)\Trim.exe $(BI COMMON_PYTHON=$(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 ^ permalink raw reply related [flat|nested] 4+ messages in thread
[parent not found: <cover.1524150680.git.jaben.carsey@intel.com>]
* [PATCH v2 1/1] BaseTools: remove PlatformClass as it's not used [not found] ` <cover.1524150680.git.jaben.carsey@intel.com> @ 2018-04-19 15:12 ` Jaben Carsey 2018-04-23 3:13 ` Zhu, Yonghong 0 siblings, 1 reply; 4+ messages in thread From: Jaben Carsey @ 2018-04-19 15:12 UTC (permalink / raw) To: edk2-devel; +Cc: Liming Gao, Yonghong Zhu v2 - update makefile too. 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> --- BaseTools/Source/Python/CommonDataClass/PlatformClass.py | 456 -------------------- BaseTools/Source/Python/Makefile | 1 - 2 files changed, 457 deletions(-) diff --git a/BaseTools/Source/Python/CommonDataClass/PlatformClass.py b/BaseTools/Source/Python/CommonDataClass/PlatformClass.py deleted file mode 100644 index a93d1ce2a1db..000000000000 --- a/BaseTools/Source/Python/CommonDataClass/PlatformClass.py +++ /dev/null @@ -1,456 +0,0 @@ -## @file -# This file is used to define a class object to describe a platform -# -# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR> -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies 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 IMPLIED. - -## -# Import Modules -# -from CommonClass import * - -## SkuInfoListClass -# -# This class defined sku info list item used in platform file -# -# @param IncludeStatementClass: Inherited from IncludeStatementClass class -# -# @var SkuInfoList: To store value for SkuInfoList, it is a set structure as -# { SkuName : SkuId } -# -class SkuInfoListClass(IncludeStatementClass): - def __init__(self): - IncludeStatementClass.__init__(self) - self.SkuInfoList = {} - -## PlatformHeaderClass -# -# This class defined header items used in Platform file -# -# @param IdentificationClass: Inherited from IdentificationClass class -# @param CommonHeaderClass: Inherited from CommonHeaderClass class -# @param DefineClass: Inherited from DefineClass class -# -# @var DscSpecification: To store value for DscSpecification -# @var SupArchList: To store value for SupArchList, selection scope is in below list -# EBC | IA32 | X64 | IPF | ARM | PPC | AARCH64 -# @var BuildTargets: To store value for BuildTargets, selection scope is in below list -# RELEASE | DEBUG -# @var IntermediateDirectories: To store value for IntermediateDirectories, selection scope is in below list -# MODULE | UNIFIED -# @var OutputDirectory: To store value for OutputDirectory -# @var ForceDebugTarget: To store value for ForceDebugTarget -# @var SkuIdName: To store value for SkuIdName -# @var BuildNumber: To store value for BuildNumber -# @var MakefileName: To store value for MakefileName -# @var ClonedFrom: To store value for ClonedFrom, it is a list structure as -# [ ClonedRecordClass, ... ] -# -class PlatformHeaderClass(IdentificationClass, CommonHeaderClass, DefineClass): - def __init__(self): - IdentificationClass.__init__(self) - CommonHeaderClass.__init__(self) - DefineClass.__init__(self) - self.DscSpecification = '' - self.SupArchList = [] - self.BuildTargets = [] - self.IntermediateDirectories = '' - self.OutputDirectory = '' - self.ForceDebugTarget = '' - self.SkuIdName = [] - self.BuildNumber = '' - self.MakefileName = '' - self.ClonedFrom = [] - -## PlatformFlashDefinitionFileClass -# -# This class defined FlashDefinitionFile item used in platform file -# -# @param object: Inherited from object class -# -# @var Id: To store value for Id -# @var UiName: To store value for UiName -# @var Preferred: To store value for Preferred -# @var FilePath: To store value for FilePath -# -class PlatformFlashDefinitionFileClass(object): - def __init__(self): - self.Id = '' - self.UiName = '' - self.Preferred = False - self.FilePath = '' - -## BuildScriptClass -# -# This class defined PREBUILD/POSTBUILD item used in platform file -# -# @param object: Inherited from object class -# -# @var Id: To store value for Id -# @var UiName: To store value for UiName -# @var Preferred: To store value for Preferred -# @var FilePath: To store value for FilePath -# -class BuildScriptClass(object): - def __init__(self): - self.Id = '' - self.UiName = '' - self.Preferred = False - self.FilePath = '' - -## PlatformFvImageOptionClass -# -# This class defined FvImageOption item used in platform file -# -# @param object: Inherited from object class -# -# @var FvImageOptionName: To store value for FvImageOptionName -# @var FvImageOptionValues: To store value for FvImageOptionValues -# -class PlatformFvImageOptionClass(object): - def __init__(self): - self.FvImageOptionName = '' - self.FvImageOptionValues = [] - -## PlatformFvImageClass -# -# This class defined FvImage item used in platform file -# -# @param object: Inherited from object class -# -# @var Name: To store value for Name -# @var Value: To store value for Value -# @var Type: To store value for Type, selection scope is in below list -# Attributes | Options | Components | ImageName -# @var FvImageNames: To store value for FvImageNames -# @var FvImageOptions: To store value for FvImageOptions, it is a list structure as -# [ PlatformFvImageOption, ...] -# -class PlatformFvImageClass(object): - def __init__(self): - self.Name = '' - self.Value = '' - self.Type = '' - self.FvImageNames = [] - self.FvImageOptions = [] - -## PlatformFvImageNameClass -# -# This class defined FvImageName item used in platform file -# -# @param object: Inherited from object class -# -# @var Name: To store value for Name -# @var Type: To store value for Type, selection scope is in below list -# FV_MAIN | FV_MAIN_COMPACT | NV_STORAGE | FV_RECOVERY | FV_RECOVERY_FLOPPY | FV_FILE | CAPSULE_CARGO | NULL | USER_DEFINED -# @var FvImageOptions: To store value for FvImageOptions, it is a list structure as -# [ PlatformFvImageOption, ...] -# -class PlatformFvImageNameClass(object): - def __init__(self): - self.Name = '' - self.Type = '' - self.FvImageOptions = [] - -## PlatformFvImagesClass -# -# This class defined FvImages item used in platform file -# -# @param object: Inherited from object class -# -# @var FvImages: To store value for FvImages -# -class PlatformFvImagesClass(object): - def __init__(self): - self.FvImages = [] - -## PlatformAntTaskClass -# -# This class defined AntTask item used in platform file -# -# @param object: Inherited from object class -# -# @var Id: To store value for Id -# @var AntCmdOptions: To store value for AntCmdOptions -# @var FilePath: To store value for FilePath -# -class PlatformAntTaskClass(object): - def __init__(self): - self.Id = '' - self.AntCmdOptions = '' - self.FilePath = '' - -## PlatformFfsSectionClass -# -# This class defined FfsSection item used in platform file -# -# @param CommonClass: Inherited from CommonClass class -# -# @var BindingOrder: To store value for BindingOrder -# @var Compressible: To store value for Compressible -# @var SectionType: To store value for SectionType -# @var EncapsulationType: To store value for EncapsulationType -# @var ToolName: To store value for ToolName -# @var Filenames: To store value for Filenames -# @var Args: To store value for Args -# @var OutFile: To store value for OutFile -# @var OutputFileExtension: To store value for OutputFileExtension -# @var ToolNameElement: To store value for ToolNameElement -# -class PlatformFfsSectionClass(CommonClass): - def __init__(self): - CommonClass.__init__(self) - self.BindingOrder = '' - self.Compressible = '' - self.SectionType = '' - self.EncapsulationType = '' - self.ToolName = '' - self.Filenames = [] - self.Args = '' - self.OutFile = '' - self.OutputFileExtension = '' - self.ToolNameElement = '' - -## PlatformFfsSectionsClass -# -# This class defined FfsSections item used in platform file -# -# @param CommonClass: Inherited from CommonClass class -# -# @var BindingOrder: To store value for BindingOrder -# @var Compressible: To store value for Compressible -# @var SectionType: To store value for SectionType -# @var EncapsulationType: To store value for EncapsulationType -# @var ToolName: To store value for ToolName -# @var Section: To store value for Section, it is a list structure as -# [ PlatformFfsSectionClass, ... ] -# @var Sections: To store value for Sections, it is a list structure as -# [ PlatformFfsSectionsClass, ...] -# -class PlatformFfsSectionsClass(CommonClass): - def __init__(self): - CommonClass.__init__(self) - self.BindingOrder = '' - self.Compressible = '' - self.SectionType = '' - self.EncapsulationType = '' - self.ToolName = '' - self.Section = [] - self.Sections = [] - -## PlatformFfsClass -# -# This class defined Ffs item used in platform file -# -# @param object: Inherited from object class -# -# @var Attribute: To store value for Attribute, it is a set structure as -# { [(Name, PlatformFfsSectionsClass)] : Value} -# @var Sections: To store value for Sections, it is a list structure as -# [ PlatformFfsSectionsClass] -# @var ToolName: To store value for ToolName -# -class PlatformFfsClass(object): - def __init__(self): - self.Attribute = {} - self.Sections = [] - self.Key = '' - -## PlatformBuildOptionClass -# -# This class defined BuildOption item used in platform file -# -# @param object: Inherited from object class -# -# @var UserDefinedAntTasks: To store value for UserDefinedAntTasks, it is a set structure as -# { [Id] : PlatformAntTaskClass, ...} -# @var Options: To store value for Options, it is a list structure as -# [ BuildOptionClass, ...] -# @var UserExtensions: To store value for UserExtensions, it is a set structure as -# { [(UserID, Identifier)] : UserExtensionsClass, ...} -# @var FfsKeyList: To store value for FfsKeyList, it is a set structure as -# { [FfsKey]: PlatformFfsClass, ...} -# -class PlatformBuildOptionClass(object): - def __init__(self): - self.UserDefinedAntTasks = {} - self.Options = [] - self.UserExtensions = {} - self.FfsKeyList = {} - -## PlatformBuildOptionClasses -# -# This class defined BuildOption item list used in platform file -# -# @param IncludeStatementClass: Inherited from IncludeStatementClass class -# -# @var FvBinding: To store value for FvBinding -# @var FfsFileNameGuid: To store value for FfsFileNameGuid -# @var FfsFormatKey: To store value for FfsFormatKey -# @var BuildOptionList: To store value for BuildOptionList, it is a list structure as -# [ BuildOptionClass, ... ] -# -class PlatformBuildOptionClasses(IncludeStatementClass): - def __init__(self): - IncludeStatementClass.__init__(self) - self.FvBinding = '' - self.FfsFileNameGuid = '' - self.FfsFormatKey = '' - self.BuildOptionList = [] - -## PlatformLibraryClass -# -# This class defined Library item used in platform file -# -# @param CommonClass: Inherited from CommonClass class -# @param DefineClass: Inherited from DefineClass class -# @param Name: Input value for Name, default is '' -# @param FilePath: Input value for FilePath, default is '' -# -# @var Name: To store value for Name -# @var FilePath: To store value for FilePath -# @var ModuleType: To store value for ModuleType -# @var SupModuleList: To store value for SupModuleList -# @var ModuleGuid: To store value for ModuleGuid -# @var ModuleVersion: To store value for ModuleVersion -# @var PackageGuid: To store value for PackageGuid -# @var PackageVersion: To store value for PackageVersion -# -class PlatformLibraryClass(CommonClass, DefineClass): - def __init__(self, Name = '', FilePath = ''): - CommonClass.__init__(self) - DefineClass.__init__(self) - self.Name = Name - self.FilePath = FilePath - self.ModuleType = [] - self.SupModuleList = [] - self.ModuleGuid = '' - self.ModuleVersion = '' - self.PackageGuid = '' - self.PackageVersion = '' - -## PlatformLibraryClasses -# -# This class defined Library item list used in platform file -# -# @param IncludeStatementClass: Inherited from IncludeStatementClass class -# -# @var LibraryList: To store value for LibraryList, it is a list structure as -# [ PlatformLibraryClass, ... ] -# -class PlatformLibraryClasses(IncludeStatementClass): - def __init__(self): - IncludeStatementClass.__init__(self) - self.LibraryList = [] - -## PlatformModuleClass -# -# This class defined Module item used in platform file -# -# @param CommonClass: Inherited from CommonClass class -# @param DefineClass: Inherited from DefineClass class -# @param IncludeStatementClass: Inherited from IncludeStatementClass class -# -# @var Name: To store value for Name (Library name or libraryclass name or module name) -# @var FilePath: To store value for FilePath -# @var Type: To store value for Type, selection scope is in below list -# LIBRARY | LIBRARY_CLASS | MODULE -# @var ModuleType: To store value for ModuleType -# @var ExecFilePath: To store value for ExecFilePath -# @var LibraryClasses: To store value for LibraryClasses, it is a structure as -# PlatformLibraryClasses -# @var PcdBuildDefinitions: To store value for PcdBuildDefinitions, it is a list structure as -# [ PcdClass, ...] -# @var ModuleSaBuildOption: To store value for ModuleSaBuildOption, it is a structure as -# PlatformBuildOptionClasses -# @var Specifications: To store value for Specifications, it is a list structure as -# [ '', '', ...] -# -class PlatformModuleClass(CommonClass, DefineClass, IncludeStatementClass): - def __init__(self): - CommonClass.__init__(self) - DefineClass.__init__(self) - self.Name = '' - self.FilePath = '' - self.Type = '' - self.ModuleType = '' - self.ExecFilePath = '' - self.LibraryClasses = PlatformLibraryClasses() - self.PcdBuildDefinitions = [] - self.ModuleSaBuildOption = PlatformBuildOptionClasses() - self.Specifications = [] - self.SourceOverridePath = '' - -## PlatformModuleClasses -# -# This class defined Module item list used in platform file -# -# @param IncludeStatementClass: Inherited from IncludeStatementClass class -# -# @var ModuleList: To store value for ModuleList, it is a list structure as -# [ PlatformModuleClass, ... ] -# -class PlatformModuleClasses(IncludeStatementClass): - def __init__(self): - IncludeStatementClass.__init__(self) - self.ModuleList = [] - -## PlatformClass -# -# This class defined a complete platform item -# -# @param object: Inherited from object class -# -# @var Header: To store value for Header, it is a structure as -# {Arch : PlatformHeaderClass()} -# @var SkuInfos: To store value for SkuInfos, it is a structure as -# SkuInfoListClass -# @var Libraries: To store value for Libraries, it is a structure as -# PlatformLibraryClasses -# @var LibraryClasses: To store value for LibraryClasses, it is a structure as -# PlatformLibraryClasses -# @var Modules: To store value for Modules, it is a structure as -# PlatformModuleClasses -# @var FlashDefinitionFile: To store value for FlashDefinitionFile, it is a structure as -# PlatformFlashDefinitionFileClass -# @var Prebuild: To store value for PREBUILD, it is a structure as -# BuildScriptClass -# @var Postbuild: To store value for POSTBUILD, it is a structure as -# BuildScriptClass -# @var BuildOptions: To store value for BuildOptions, it is a structure as -# PlatformBuildOptionClasses -# @var DynamicPcdBuildDefinitions: To store value for DynamicPcdBuildDefinitions, it is a list structure as -# [ PcdClass, ...] -# @var Fdf: To store value for Fdf, it is a list structure as -# [ FdfClass, ...] -# @var UserExtensions: To store value for UserExtensions, it is a list structure as -# [ UserExtensionsClass, ...] -# -class PlatformClass(object): - def __init__(self): - self.Header = {} - self.SkuInfos = SkuInfoListClass() - self.Libraries = PlatformLibraryClasses() - self.LibraryClasses = PlatformLibraryClasses() - self.Modules = PlatformModuleClasses() - self.FlashDefinitionFile = PlatformFlashDefinitionFileClass() - self.Prebuild = BuildScriptClass() - self.Postbuild = BuildScriptClass() - self.BuildOptions = PlatformBuildOptionClasses() - self.DynamicPcdBuildDefinitions = [] - self.Fdf = [] - self.UserExtensions = [] - -## -# -# This acts like the main() function for the script, unless it is 'import'ed into another -# script. -# -if __name__ == '__main__': - P = PlatformClass() diff --git a/BaseTools/Source/Python/Makefile b/BaseTools/Source/Python/Makefile index a51207d3d831..527d766bf4c2 100644 --- a/BaseTools/Source/Python/Makefile +++ b/BaseTools/Source/Python/Makefile @@ -58,7 +58,6 @@ COMMON_PYTHON=$(BASE_TOOLS_PATH)\Source\Python\Common\BuildToolError.py \ $(BASE_TOOLS_PATH)\Source\Python\CommonDataClass\DataClass.py \ $(BASE_TOOLS_PATH)\Source\Python\CommonDataClass\Exceptions.py \ $(BASE_TOOLS_PATH)\Source\Python\CommonDataClass\FdfClass.py \ - $(BASE_TOOLS_PATH)\Source\Python\CommonDataClass\PlatformClass.py \ $(BASE_TOOLS_PATH)\Source\Python\Table\Table.py \ $(BASE_TOOLS_PATH)\Source\Python\Table\TableDataModel.py \ $(BASE_TOOLS_PATH)\Source\Python\Table\TableDec.py \ -- 2.16.2.windows.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/1] BaseTools: remove PlatformClass as it's not used 2018-04-19 15:12 ` [PATCH v2 1/1] BaseTools: remove PlatformClass as it's " Jaben Carsey @ 2018-04-23 3:13 ` Zhu, Yonghong 0 siblings, 0 replies; 4+ messages in thread From: Zhu, Yonghong @ 2018-04-23 3:13 UTC (permalink / raw) To: Carsey, Jaben, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> Best Regards, Zhu Yonghong -----Original Message----- From: Carsey, Jaben Sent: Thursday, April 19, 2018 11:13 PM To: edk2-devel@lists.01.org Cc: Gao, Liming <liming.gao@intel.com>; Zhu, Yonghong <yonghong.zhu@intel.com> Subject: [PATCH v2 1/1] BaseTools: remove PlatformClass as it's not used v2 - update makefile too. 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> --- BaseTools/Source/Python/CommonDataClass/PlatformClass.py | 456 -------------------- BaseTools/Source/Python/Makefile | 1 - 2 files changed, 457 deletions(-) diff --git a/BaseTools/Source/Python/CommonDataClass/PlatformClass.py b/BaseTools/Source/Python/CommonDataClass/PlatformClass.py deleted file mode 100644 index a93d1ce2a1db..000000000000 --- a/BaseTools/Source/Python/CommonDataClass/PlatformClass.py +++ /dev/null @@ -1,456 +0,0 @@ -## @file -# This file is used to define a class object to describe a platform -# -# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR> -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies 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 IMPLIED. - -## -# Import Modules -# -from CommonClass import * - -## SkuInfoListClass -# -# This class defined sku info list item used in platform file -# -# @param IncludeStatementClass: Inherited from IncludeStatementClass class -# -# @var SkuInfoList: To store value for SkuInfoList, it is a set structure as -# { SkuName : SkuId } -# -class SkuInfoListClass(IncludeStatementClass): - def __init__(self): - IncludeStatementClass.__init__(self) - self.SkuInfoList = {} - -## PlatformHeaderClass -# -# This class defined header items used in Platform file -# -# @param IdentificationClass: Inherited from IdentificationClass class -# @param CommonHeaderClass: Inherited from CommonHeaderClass class -# @param DefineClass: Inherited from DefineClass class -# -# @var DscSpecification: To store value for DscSpecification -# @var SupArchList: To store value for SupArchList, selection scope is in below list -# EBC | IA32 | X64 | IPF | ARM | PPC | AARCH64 -# @var BuildTargets: To store value for BuildTargets, selection scope is in below list -# RELEASE | DEBUG -# @var IntermediateDirectories: To store value for IntermediateDirectories, selection scope is in below list -# MODULE | UNIFIED -# @var OutputDirectory: To store value for OutputDirectory -# @var ForceDebugTarget: To store value for ForceDebugTarget -# @var SkuIdName: To store value for SkuIdName -# @var BuildNumber: To store value for BuildNumber -# @var MakefileName: To store value for MakefileName -# @var ClonedFrom: To store value for ClonedFrom, it is a list structure as -# [ ClonedRecordClass, ... ] -# -class PlatformHeaderClass(IdentificationClass, CommonHeaderClass, DefineClass): - def __init__(self): - IdentificationClass.__init__(self) - CommonHeaderClass.__init__(self) - DefineClass.__init__(self) - self.DscSpecification = '' - self.SupArchList = [] - self.BuildTargets = [] - self.IntermediateDirectories = '' - self.OutputDirectory = '' - self.ForceDebugTarget = '' - self.SkuIdName = [] - self.BuildNumber = '' - self.MakefileName = '' - self.ClonedFrom = [] - -## PlatformFlashDefinitionFileClass -# -# This class defined FlashDefinitionFile item used in platform file -# -# @param object: Inherited from object class -# -# @var Id: To store value for Id -# @var UiName: To store value for UiName -# @var Preferred: To store value for Preferred -# @var FilePath: To store value for FilePath -# -class PlatformFlashDefinitionFileClass(object): - def __init__(self): - self.Id = '' - self.UiName = '' - self.Preferred = False - self.FilePath = '' - -## BuildScriptClass -# -# This class defined PREBUILD/POSTBUILD item used in platform file -# -# @param object: Inherited from object class -# -# @var Id: To store value for Id -# @var UiName: To store value for UiName -# @var Preferred: To store value for Preferred -# @var FilePath: To store value for FilePath -# -class BuildScriptClass(object): - def __init__(self): - self.Id = '' - self.UiName = '' - self.Preferred = False - self.FilePath = '' - -## PlatformFvImageOptionClass -# -# This class defined FvImageOption item used in platform file -# -# @param object: Inherited from object class -# -# @var FvImageOptionName: To store value for FvImageOptionName -# @var FvImageOptionValues: To store value for FvImageOptionValues -# -class PlatformFvImageOptionClass(object): - def __init__(self): - self.FvImageOptionName = '' - self.FvImageOptionValues = [] - -## PlatformFvImageClass -# -# This class defined FvImage item used in platform file -# -# @param object: Inherited from object class -# -# @var Name: To store value for Name -# @var Value: To store value for Value -# @var Type: To store value for Type, selection scope is in below list -# Attributes | Options | Components | ImageName -# @var FvImageNames: To store value for FvImageNames -# @var FvImageOptions: To store value for FvImageOptions, it is a list structure as -# [ PlatformFvImageOption, ...] -# -class PlatformFvImageClass(object): - def __init__(self): - self.Name = '' - self.Value = '' - self.Type = '' - self.FvImageNames = [] - self.FvImageOptions = [] - -## PlatformFvImageNameClass -# -# This class defined FvImageName item used in platform file -# -# @param object: Inherited from object class -# -# @var Name: To store value for Name -# @var Type: To store value for Type, selection scope is in below list -# FV_MAIN | FV_MAIN_COMPACT | NV_STORAGE | FV_RECOVERY | FV_RECOVERY_FLOPPY | FV_FILE | CAPSULE_CARGO | NULL | USER_DEFINED -# @var FvImageOptions: To store value for FvImageOptions, it is a list structure as -# [ PlatformFvImageOption, ...] -# -class PlatformFvImageNameClass(object): - def __init__(self): - self.Name = '' - self.Type = '' - self.FvImageOptions = [] - -## PlatformFvImagesClass -# -# This class defined FvImages item used in platform file -# -# @param object: Inherited from object class -# -# @var FvImages: To store value for FvImages -# -class PlatformFvImagesClass(object): - def __init__(self): - self.FvImages = [] - -## PlatformAntTaskClass -# -# This class defined AntTask item used in platform file -# -# @param object: Inherited from object class -# -# @var Id: To store value for Id -# @var AntCmdOptions: To store value for AntCmdOptions -# @var FilePath: To store value for FilePath -# -class PlatformAntTaskClass(object): - def __init__(self): - self.Id = '' - self.AntCmdOptions = '' - self.FilePath = '' - -## PlatformFfsSectionClass -# -# This class defined FfsSection item used in platform file -# -# @param CommonClass: Inherited from CommonClass class -# -# @var BindingOrder: To store value for BindingOrder -# @var Compressible: To store value for Compressible -# @var SectionType: To store value for SectionType -# @var EncapsulationType: To store value for EncapsulationType -# @var ToolName: To store value for ToolName -# @var Filenames: To store value for Filenames -# @var Args: To store value for Args -# @var OutFile: To store value for OutFile -# @var OutputFileExtension: To store value for OutputFileExtension -# @var ToolNameElement: To store value for ToolNameElement -# -class PlatformFfsSectionClass(CommonClass): - def __init__(self): - CommonClass.__init__(self) - self.BindingOrder = '' - self.Compressible = '' - self.SectionType = '' - self.EncapsulationType = '' - self.ToolName = '' - self.Filenames = [] - self.Args = '' - self.OutFile = '' - self.OutputFileExtension = '' - self.ToolNameElement = '' - -## PlatformFfsSectionsClass -# -# This class defined FfsSections item used in platform file -# -# @param CommonClass: Inherited from CommonClass class -# -# @var BindingOrder: To store value for BindingOrder -# @var Compressible: To store value for Compressible -# @var SectionType: To store value for SectionType -# @var EncapsulationType: To store value for EncapsulationType -# @var ToolName: To store value for ToolName -# @var Section: To store value for Section, it is a list structure as -# [ PlatformFfsSectionClass, ... ] -# @var Sections: To store value for Sections, it is a list structure as -# [ PlatformFfsSectionsClass, ...] -# -class PlatformFfsSectionsClass(CommonClass): - def __init__(self): - CommonClass.__init__(self) - self.BindingOrder = '' - self.Compressible = '' - self.SectionType = '' - self.EncapsulationType = '' - self.ToolName = '' - self.Section = [] - self.Sections = [] - -## PlatformFfsClass -# -# This class defined Ffs item used in platform file -# -# @param object: Inherited from object class -# -# @var Attribute: To store value for Attribute, it is a set structure as -# { [(Name, PlatformFfsSectionsClass)] : Value} -# @var Sections: To store value for Sections, it is a list structure as -# [ PlatformFfsSectionsClass] -# @var ToolName: To store value for ToolName -# -class PlatformFfsClass(object): - def __init__(self): - self.Attribute = {} - self.Sections = [] - self.Key = '' - -## PlatformBuildOptionClass -# -# This class defined BuildOption item used in platform file -# -# @param object: Inherited from object class -# -# @var UserDefinedAntTasks: To store value for UserDefinedAntTasks, it is a set structure as -# { [Id] : PlatformAntTaskClass, ...} -# @var Options: To store value for Options, it is a list structure as -# [ BuildOptionClass, ...] -# @var UserExtensions: To store value for UserExtensions, it is a set structure as -# { [(UserID, Identifier)] : UserExtensionsClass, ...} -# @var FfsKeyList: To store value for FfsKeyList, it is a set structure as -# { [FfsKey]: PlatformFfsClass, ...} -# -class PlatformBuildOptionClass(object): - def __init__(self): - self.UserDefinedAntTasks = {} - self.Options = [] - self.UserExtensions = {} - self.FfsKeyList = {} - -## PlatformBuildOptionClasses -# -# This class defined BuildOption item list used in platform file -# -# @param IncludeStatementClass: Inherited from IncludeStatementClass class -# -# @var FvBinding: To store value for FvBinding -# @var FfsFileNameGuid: To store value for FfsFileNameGuid -# @var FfsFormatKey: To store value for FfsFormatKey -# @var BuildOptionList: To store value for BuildOptionList, it is a list structure as -# [ BuildOptionClass, ... ] -# -class PlatformBuildOptionClasses(IncludeStatementClass): - def __init__(self): - IncludeStatementClass.__init__(self) - self.FvBinding = '' - self.FfsFileNameGuid = '' - self.FfsFormatKey = '' - self.BuildOptionList = [] - -## PlatformLibraryClass -# -# This class defined Library item used in platform file -# -# @param CommonClass: Inherited from CommonClass class -# @param DefineClass: Inherited from DefineClass class -# @param Name: Input value for Name, default is '' -# @param FilePath: Input value for FilePath, default is '' -# -# @var Name: To store value for Name -# @var FilePath: To store value for FilePath -# @var ModuleType: To store value for ModuleType -# @var SupModuleList: To store value for SupModuleList -# @var ModuleGuid: To store value for ModuleGuid -# @var ModuleVersion: To store value for ModuleVersion -# @var PackageGuid: To store value for PackageGuid -# @var PackageVersion: To store value for PackageVersion -# -class PlatformLibraryClass(CommonClass, DefineClass): - def __init__(self, Name = '', FilePath = ''): - CommonClass.__init__(self) - DefineClass.__init__(self) - self.Name = Name - self.FilePath = FilePath - self.ModuleType = [] - self.SupModuleList = [] - self.ModuleGuid = '' - self.ModuleVersion = '' - self.PackageGuid = '' - self.PackageVersion = '' - -## PlatformLibraryClasses -# -# This class defined Library item list used in platform file -# -# @param IncludeStatementClass: Inherited from IncludeStatementClass class -# -# @var LibraryList: To store value for LibraryList, it is a list structure as -# [ PlatformLibraryClass, ... ] -# -class PlatformLibraryClasses(IncludeStatementClass): - def __init__(self): - IncludeStatementClass.__init__(self) - self.LibraryList = [] - -## PlatformModuleClass -# -# This class defined Module item used in platform file -# -# @param CommonClass: Inherited from CommonClass class -# @param DefineClass: Inherited from DefineClass class -# @param IncludeStatementClass: Inherited from IncludeStatementClass class -# -# @var Name: To store value for Name (Library name or libraryclass name or module name) -# @var FilePath: To store value for FilePath -# @var Type: To store value for Type, selection scope is in below list -# LIBRARY | LIBRARY_CLASS | MODULE -# @var ModuleType: To store value for ModuleType -# @var ExecFilePath: To store value for ExecFilePath -# @var LibraryClasses: To store value for LibraryClasses, it is a structure as -# PlatformLibraryClasses -# @var PcdBuildDefinitions: To store value for PcdBuildDefinitions, it is a list structure as -# [ PcdClass, ...] -# @var ModuleSaBuildOption: To store value for ModuleSaBuildOption, it is a structure as -# PlatformBuildOptionClasses -# @var Specifications: To store value for Specifications, it is a list structure as -# [ '', '', ...] -# -class PlatformModuleClass(CommonClass, DefineClass, IncludeStatementClass): - def __init__(self): - CommonClass.__init__(self) - DefineClass.__init__(self) - self.Name = '' - self.FilePath = '' - self.Type = '' - self.ModuleType = '' - self.ExecFilePath = '' - self.LibraryClasses = PlatformLibraryClasses() - self.PcdBuildDefinitions = [] - self.ModuleSaBuildOption = PlatformBuildOptionClasses() - self.Specifications = [] - self.SourceOverridePath = '' - -## PlatformModuleClasses -# -# This class defined Module item list used in platform file -# -# @param IncludeStatementClass: Inherited from IncludeStatementClass class -# -# @var ModuleList: To store value for ModuleList, it is a list structure as -# [ PlatformModuleClass, ... ] -# -class PlatformModuleClasses(IncludeStatementClass): - def __init__(self): - IncludeStatementClass.__init__(self) - self.ModuleList = [] - -## PlatformClass -# -# This class defined a complete platform item -# -# @param object: Inherited from object class -# -# @var Header: To store value for Header, it is a structure as -# {Arch : PlatformHeaderClass()} -# @var SkuInfos: To store value for SkuInfos, it is a structure as -# SkuInfoListClass -# @var Libraries: To store value for Libraries, it is a structure as -# PlatformLibraryClasses -# @var LibraryClasses: To store value for LibraryClasses, it is a structure as -# PlatformLibraryClasses -# @var Modules: To store value for Modules, it is a structure as -# PlatformModuleClasses -# @var FlashDefinitionFile: To store value for FlashDefinitionFile, it is a structure as -# PlatformFlashDefinitionFileClass -# @var Prebuild: To store value for PREBUILD, it is a structure as -# BuildScriptClass -# @var Postbuild: To store value for POSTBUILD, it is a structure as -# BuildScriptClass -# @var BuildOptions: To store value for BuildOptions, it is a structure as -# PlatformBuildOptionClasses -# @var DynamicPcdBuildDefinitions: To store value for DynamicPcdBuildDefinitions, it is a list structure as -# [ PcdClass, ...] -# @var Fdf: To store value for Fdf, it is a list structure as -# [ FdfClass, ...] -# @var UserExtensions: To store value for UserExtensions, it is a list structure as -# [ UserExtensionsClass, ...] -# -class PlatformClass(object): - def __init__(self): - self.Header = {} - self.SkuInfos = SkuInfoListClass() - self.Libraries = PlatformLibraryClasses() - self.LibraryClasses = PlatformLibraryClasses() - self.Modules = PlatformModuleClasses() - self.FlashDefinitionFile = PlatformFlashDefinitionFileClass() - self.Prebuild = BuildScriptClass() - self.Postbuild = BuildScriptClass() - self.BuildOptions = PlatformBuildOptionClasses() - self.DynamicPcdBuildDefinitions = [] - self.Fdf = [] - self.UserExtensions = [] - -## -# -# This acts like the main() function for the script, unless it is 'import'ed into another -# script. -# -if __name__ == '__main__': - P = PlatformClass() diff --git a/BaseTools/Source/Python/Makefile b/BaseTools/Source/Python/Makefile index a51207d3d831..527d766bf4c2 100644 --- a/BaseTools/Source/Python/Makefile +++ b/BaseTools/Source/Python/Makefile @@ -58,7 +58,6 @@ COMMON_PYTHON=$(BASE_TOOLS_PATH)\Source\Python\Common\BuildToolError.py \ $(BASE_TOOLS_PATH)\Source\Python\CommonDataClass\DataClass.py \ $(BASE_TOOLS_PATH)\Source\Python\CommonDataClass\Exceptions.py \ $(BASE_TOOLS_PATH)\Source\Python\CommonDataClass\FdfClass.py \ - $(BASE_TOOLS_PATH)\Source\Python\CommonDataClass\PlatformClass.py \ $(BASE_TOOLS_PATH)\Source\Python\Table\Table.py \ $(BASE_TOOLS_PATH)\Source\Python\Table\TableDataModel.py \ $(BASE_TOOLS_PATH)\Source\Python\Table\TableDec.py \ -- 2.16.2.windows.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/1] BaseTools: remove EdkIIWorkspace as its not used. 2018-04-19 15:12 ` [PATCH v2 1/1] BaseTools: remove EdkIIWorkspace as its not used Jaben Carsey [not found] ` <cover.1524150680.git.jaben.carsey@intel.com> @ 2018-04-23 3:13 ` Zhu, Yonghong 1 sibling, 0 replies; 4+ messages in thread From: Zhu, Yonghong @ 2018-04-23 3:13 UTC (permalink / raw) To: Carsey, Jaben, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> Best Regards, Zhu Yonghong -----Original Message----- From: Carsey, Jaben Sent: Thursday, April 19, 2018 11:13 PM To: edk2-devel@lists.01.org Cc: Gao, Liming <liming.gao@intel.com>; Zhu, Yonghong <yonghong.zhu@intel.com> Subject: [PATCH v2 1/1] BaseTools: remove EdkIIWorkspace as its not used. v2 - update makefile too. 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> --- 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/Source/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 Workspace -# -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies 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 IMPLIED. -# - -## -# Import Modules -# -import Common.LongFilePathOs as os, sys, time -from DataType import * -from Common.LongFilePathSupport import OpenLongFilePath as open -from Common.MultipleWorkspace import MultipleWorkspace as mws - -## EdkIIWorkspace -# -# Collect WorkspaceDir from the environment, the Verbose command line flag, and detect an icon bitmap file. -# -# @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 = time.time() - self.PrintRunTime = False - self.PrintRunStatus = False - self.RunStatus = '' - - # - # Check environment valiable 'WORKSPACE' - # - if os.environ.get('WORKSPACE') is None: - print 'ERROR: WORKSPACE not defined. Please run EdkSetup from the EDK II install directory.' - return False - - self.CurrentWorkingDir = os.getcwd() - - self.WorkspaceDir = os.path.realpath(os.environ.get('WORKSPACE')) - (Drive, Path) = os.path.splitdrive(self.WorkspaceDir) - if Drive == '': - (Drive, CwdPath) = os.path.splitdrive(self.CurrentWorkingDir) - if Drive != '': - self.WorkspaceDir = Drive + Path - else: - self.WorkspaceDir = Drive.upper() + Path - - self.WorkspaceRelativeWorkingDir = self.WorkspaceRelativePath (self.CurrentWorkingDir) - - try: - # - # Load TianoCoreOrgLogo, used for GUI tool - # - self.Icon = wx.Icon(self.WorkspaceFile('tools/Python/TianoCoreOrgLogo.gif'), wx.BITMAP_TYPE_GIF) - except: - self.Icon = None - - self.Verbose = False - for Arg in sys.argv: - if Arg.lower() == '-v': - self.Verbose = True - - ## Close build system - # - # Close build system and print running time and status - # - def Close(self): - if self.PrintRunTime: - Seconds = int(time.time() - self.StartTime) - if Seconds < 60: - print 'Run Time: %d seconds' % (Seconds) - else: - Minutes = Seconds / 60 - Seconds = Seconds % 60 - if Minutes < 60: - print 'Run Time: %d minutes %d seconds' % (Minutes, Seconds) - else: - Hours = Minutes / 60 - Minutes = Minutes % 60 - print 'Run Time: %d hours %d minutes %d seconds' % (Hours, Minutes, Seconds) - if self.RunStatus != '': - 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 = os.path.realpath(FileName) - if FileName.find(self.WorkspaceDir) != 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.WorkspaceDir)) - - ## 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), SectionTag) - # - def XmlParseFileSection (self, FileName, SectionTag): - if self.Verbose: - print FileName - return XmlParseFileSection (self.WorkspaceFile(FileName), SectionTag) - - ## 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:value) 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 key value. Key1 = Value1, '=' 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 = Value1|Value2, '|' is the value split char - # - # @retval ConvertTextFileToDictionary(self.WorkspaceFile(FileName), Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter) - # - def ConvertTextFileToDictionary(self, FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter): - if self.Verbose: - print FileName - return ConvertTextFileToDictionary(self.WorkspaceFile(FileName), Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter) - - ## Convert Dictionary To Text File - # - # Convert a dictionary of (name:value) pairs to a workspace relative text 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 key value. Key1 = Value1, '=' 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 = Value1|Value2, '|' is the value split char - # - # @retval ConvertDictionaryToTextFile(self.WorkspaceFile(FileName), Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter) - # - def ConvertDictionaryToTextFile(self, FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter): - if self.Verbose: - print FileName - return ConvertDictionaryToTextFile(self.WorkspaceFile(FileName), Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter) - -## 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 content -# @param KeySplitCharacter: Key split char, between key name and key value. Key1 = Value1, '=' 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 = Value1|Value2, '|' is the value split char -# -# @retval True Convert successfully -# @retval False Open file failed -# -def ConvertTextFileToDictionary(FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter): - try: - F = open(FileName, 'r') - except: - return False - Keys = [] - for Line in F: - LineList = Line.split(KeySplitCharacter, 1) - if len(LineList) >= 2: - Key = LineList[0].split() - if len(Key) == 1 and Key[0][0] != CommentCharacter and Key[0] not in Keys: - if ValueSplitFlag: - Dictionary[Key[0]] = LineList[1].replace('\\', '/').split(ValueSplitCharacter) - else: - Dictionary[Key[0]] = LineList[1].strip().replace('\\', '/') - Keys += [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 content -# @param KeySplitCharacter: Key split char, between key name and key value. Key1 = Value1, '=' 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 = Value1|Value2, '|' is the value split char -# -# @retval True Convert successfully -# @retval False Open file failed -# -def ConvertDictionaryToTextFile(FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter): - try: - F = open(FileName, 'r') - Lines = [] - Lines = F.readlines() - F.close() - except: - Lines = [] - Keys = Dictionary.keys() - MaxLength = max(map(len,Keys)) - Index = 0 - for Line in Lines: - LineList = Line.split(KeySplitCharacter, 1) - if len(LineList) >= 2: - Key = LineList[0].split() - if len(Key) == 1 and Key[0][0] != CommentCharacter and Key[0] in Dictionary: - if ValueSplitFlag: - Line = '%-*s %c %s\n' % (MaxLength, Key[0], KeySplitCharacter, ' '.join(Dictionary[Key[0]])) - else: - Line = '%-*s %c %s\n' % (MaxLength, Key[0], KeySplitCharacter, Dictionary[Key[0]]) - Lines.pop(Index) - if Key[0] in Keys: - Lines.insert(Index, Line) - Keys.remove(Key[0]) - Index += 1 - for RemainingKey in Keys: - if ValueSplitFlag: - Line = '%-*s %c %s\n' % (MaxLength, RemainingKey, KeySplitCharacter, ' '.join(Dictionary[RemainingKey])) - else: - Line = '%-*s %c %s\n' % (MaxLength, RemainingKey, KeySplitCharacter, Dictionary[RemainingKey]) - Lines.append(Line) - try: - F = 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='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__ == '__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/Makefile index a51207d3d831..4fda6d7e0c84 100644 --- a/BaseTools/Source/Python/Makefile +++ b/BaseTools/Source/Python/Makefile @@ -37,7 +37,6 @@ APPLICATIONS=$(BIN_DIR)\build.exe $(BIN_DIR)\GenFds.exe $(BIN_DIR)\Trim.exe $(BI COMMON_PYTHON=$(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 ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-04-23 3:13 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <cover.1524150605.git.jaben.carsey@intel.com> 2018-04-19 15:12 ` [PATCH v2 1/1] BaseTools: remove EdkIIWorkspace as its not used Jaben Carsey [not found] ` <cover.1524150680.git.jaben.carsey@intel.com> 2018-04-19 15:12 ` [PATCH v2 1/1] BaseTools: remove PlatformClass as it's " Jaben Carsey 2018-04-23 3:13 ` Zhu, Yonghong 2018-04-23 3:13 ` [PATCH v2 1/1] BaseTools: remove EdkIIWorkspace as its " Zhu, Yonghong
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox