2009-07-17 09:10:31 +00:00
## @file
# This file is used to define class Configuration
#
2018-05-05 04:25:16 +08:00
# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
2019-04-03 16:03:11 -07:00
# SPDX-License-Identifier: BSD-2-Clause-Patent
2009-07-17 09:10:31 +00:00
#
##
# Import Modules
#
2018-06-25 18:31:26 +08:00
from __future__ import print_function
2014-08-15 03:06:48 +00:00
import Common.LongFilePathOs as os
2009-07-17 09:10:31 +00:00
import Common.EdkLogger as EdkLogger
from Common.DataType import *
2018-05-19 18:50:25 +08:00
from Common.StringUtils import *
2014-08-15 03:06:48 +00:00
from Common.LongFilePathSupport import OpenLongFilePath as open
2009-07-17 09:10:31 +00:00
2018-05-05 04:25:16 +08:00
_ConfigFileToInternalTranslation = {
# not same
"ModifierList" : "ModifierSet" ,
# same
# please keep this in correct alphabetical order.
"AutoCorrect" : "AutoCorrect" ,
"BinaryExtList" : "BinaryExtList" ,
"CFunctionLayoutCheckAll" : "CFunctionLayoutCheckAll" ,
"CFunctionLayoutCheckDataDeclaration" : "CFunctionLayoutCheckDataDeclaration" ,
"CFunctionLayoutCheckFunctionBody" : "CFunctionLayoutCheckFunctionBody" ,
"CFunctionLayoutCheckFunctionName" : "CFunctionLayoutCheckFunctionName" ,
"CFunctionLayoutCheckFunctionPrototype" : "CFunctionLayoutCheckFunctionPrototype" ,
"CFunctionLayoutCheckNoInitOfVariable" : "CFunctionLayoutCheckNoInitOfVariable" ,
"CFunctionLayoutCheckNoStatic" : "CFunctionLayoutCheckNoStatic" ,
"CFunctionLayoutCheckOptionalFunctionalModifier" : "CFunctionLayoutCheckOptionalFunctionalModifier" ,
"CFunctionLayoutCheckReturnType" : "CFunctionLayoutCheckReturnType" ,
"CheckAll" : "CheckAll" ,
"Copyright" : "Copyright" ,
"DeclarationDataTypeCheckAll" : "DeclarationDataTypeCheckAll" ,
"DeclarationDataTypeCheckEFIAPIModifier" : "DeclarationDataTypeCheckEFIAPIModifier" ,
"DeclarationDataTypeCheckEnumeratedType" : "DeclarationDataTypeCheckEnumeratedType" ,
"DeclarationDataTypeCheckInOutModifier" : "DeclarationDataTypeCheckInOutModifier" ,
"DeclarationDataTypeCheckNoUseCType" : "DeclarationDataTypeCheckNoUseCType" ,
"DeclarationDataTypeCheckSameStructure" : "DeclarationDataTypeCheckSameStructure" ,
"DeclarationDataTypeCheckStructureDeclaration" : "DeclarationDataTypeCheckStructureDeclaration" ,
"DeclarationDataTypeCheckUnionType" : "DeclarationDataTypeCheckUnionType" ,
"DoxygenCheckAll" : "DoxygenCheckAll" ,
"DoxygenCheckCommand" : "DoxygenCheckCommand" ,
"DoxygenCheckCommentDescription" : "DoxygenCheckCommentDescription" ,
"DoxygenCheckCommentFormat" : "DoxygenCheckCommentFormat" ,
"DoxygenCheckFileHeader" : "DoxygenCheckFileHeader" ,
"DoxygenCheckFunctionHeader" : "DoxygenCheckFunctionHeader" ,
"GeneralCheckAll" : "GeneralCheckAll" ,
"GeneralCheckCarriageReturn" : "GeneralCheckCarriageReturn" ,
"GeneralCheckFileExistence" : "GeneralCheckFileExistence" ,
"GeneralCheckIndentation" : "GeneralCheckIndentation" ,
"GeneralCheckIndentationWidth" : "GeneralCheckIndentationWidth" ,
"GeneralCheckLine" : "GeneralCheckLine" ,
2018-08-08 11:18:06 +08:00
"GeneralCheckLineEnding" : "GeneralCheckLineEnding" ,
2018-05-05 04:25:16 +08:00
"GeneralCheckLineWidth" : "GeneralCheckLineWidth" ,
"GeneralCheckNoProgma" : "GeneralCheckNoProgma" ,
"GeneralCheckNoTab" : "GeneralCheckNoTab" ,
"GeneralCheckNo_Asm" : "GeneralCheckNo_Asm" ,
"GeneralCheckTabWidth" : "GeneralCheckTabWidth" ,
2018-08-08 11:18:06 +08:00
"GeneralCheckTrailingWhiteSpaceLine" : "GeneralCheckTrailingWhiteSpaceLine" ,
2018-05-05 04:25:16 +08:00
"GeneralCheckUni" : "GeneralCheckUni" ,
"HeaderCheckAll" : "HeaderCheckAll" ,
"HeaderCheckCFileCommentLicenseFormat" : "HeaderCheckCFileCommentLicenseFormat" ,
"HeaderCheckCFileCommentReferenceFormat" : "HeaderCheckCFileCommentReferenceFormat" ,
"HeaderCheckCFileCommentStartSpacesNum" : "HeaderCheckCFileCommentStartSpacesNum" ,
"HeaderCheckFile" : "HeaderCheckFile" ,
"HeaderCheckFileCommentEnd" : "HeaderCheckFileCommentEnd" ,
"HeaderCheckFunction" : "HeaderCheckFunction" ,
"IncludeFileCheckAll" : "IncludeFileCheckAll" ,
"IncludeFileCheckData" : "IncludeFileCheckData" ,
"IncludeFileCheckSameName" : "IncludeFileCheckSameName" ,
"MetaDataFileCheckAll" : "MetaDataFileCheckAll" ,
"MetaDataFileCheckBinaryInfInFdf" : "MetaDataFileCheckBinaryInfInFdf" ,
"MetaDataFileCheckGenerateFileList" : "MetaDataFileCheckGenerateFileList" ,
"MetaDataFileCheckGuidDuplicate" : "MetaDataFileCheckGuidDuplicate" ,
"MetaDataFileCheckLibraryDefinedInDec" : "MetaDataFileCheckLibraryDefinedInDec" ,
"MetaDataFileCheckLibraryInstance" : "MetaDataFileCheckLibraryInstance" ,
"MetaDataFileCheckLibraryInstanceDependent" : "MetaDataFileCheckLibraryInstanceDependent" ,
"MetaDataFileCheckLibraryInstanceOrder" : "MetaDataFileCheckLibraryInstanceOrder" ,
"MetaDataFileCheckLibraryNoUse" : "MetaDataFileCheckLibraryNoUse" ,
"MetaDataFileCheckModuleFileGuidDuplication" : "MetaDataFileCheckModuleFileGuidDuplication" ,
"MetaDataFileCheckModuleFileGuidFormat" : "MetaDataFileCheckModuleFileGuidFormat" ,
"MetaDataFileCheckModuleFileNoUse" : "MetaDataFileCheckModuleFileNoUse" ,
"MetaDataFileCheckModuleFilePcdFormat" : "MetaDataFileCheckModuleFilePcdFormat" ,
"MetaDataFileCheckModuleFilePpiFormat" : "MetaDataFileCheckModuleFilePpiFormat" ,
"MetaDataFileCheckModuleFileProtocolFormat" : "MetaDataFileCheckModuleFileProtocolFormat" ,
"MetaDataFileCheckPathName" : "MetaDataFileCheckPathName" ,
"MetaDataFileCheckPathOfGenerateFileList" : "MetaDataFileCheckPathOfGenerateFileList" ,
"MetaDataFileCheckPcdDuplicate" : "MetaDataFileCheckPcdDuplicate" ,
"MetaDataFileCheckPcdFlash" : "MetaDataFileCheckPcdFlash" ,
"MetaDataFileCheckPcdNoUse" : "MetaDataFileCheckPcdNoUse" ,
"MetaDataFileCheckPcdType" : "MetaDataFileCheckPcdType" ,
"NamingConventionCheckAll" : "NamingConventionCheckAll" ,
"NamingConventionCheckDefineStatement" : "NamingConventionCheckDefineStatement" ,
"NamingConventionCheckFunctionName" : "NamingConventionCheckFunctionName" ,
"NamingConventionCheckPathName" : "NamingConventionCheckPathName" ,
"NamingConventionCheckSingleCharacterVariable" : "NamingConventionCheckSingleCharacterVariable" ,
"NamingConventionCheckTypedefStatement" : "NamingConventionCheckTypedefStatement" ,
"NamingConventionCheckVariableName" : "NamingConventionCheckVariableName" ,
"PredicateExpressionCheckAll" : "PredicateExpressionCheckAll" ,
"PredicateExpressionCheckBooleanValue" : "PredicateExpressionCheckBooleanValue" ,
"PredicateExpressionCheckComparisonNullType" : "PredicateExpressionCheckComparisonNullType" ,
"PredicateExpressionCheckNonBooleanOperator" : "PredicateExpressionCheckNonBooleanOperator" ,
"ScanOnlyDirList" : "ScanOnlyDirList" ,
"SkipDirList" : "SkipDirList" ,
"SkipFileList" : "SkipFileList" ,
"SmmCommParaCheckAll" : "SmmCommParaCheckAll" ,
"SmmCommParaCheckBufferType" : "SmmCommParaCheckBufferType" ,
"SpaceCheckAll" : "SpaceCheckAll" ,
"SpellingCheckAll" : "SpellingCheckAll" ,
2019-05-06 10:35:07 +08:00
"TokenReleaceList" : "TokenReleaceList" ,
2018-05-05 04:25:16 +08:00
"UniCheckAll" : "UniCheckAll" ,
"UniCheckHelpInfo" : "UniCheckHelpInfo" ,
"UniCheckPCDInfo" : "UniCheckPCDInfo" ,
"Version" : "Version"
}
2009-07-17 09:10:31 +00:00
## Configuration
#
# This class is used to define all items in configuration file
#
# @param Filename: The name of configuration file, the default is config.ini
#
class Configuration ( object ):
def __init__ ( self , Filename ):
self . Filename = Filename
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
self . Version = 0.1
## Identify to if check all items
# 1 - Check all items and ignore all other detailed items
# 0 - Not check all items, the tool will go through all other detailed items to decide to check or not
#
self . CheckAll = 0
## Identify to if automatically correct mistakes
# 1 - Automatically correct
# 0 - Not automatically correct
# Only the following check points can be automatically corrected, others not listed below are not supported even it is 1
#
# GeneralCheckTab
# GeneralCheckIndentation
# GeneralCheckLine
# GeneralCheckCarriageReturn
# SpaceCheckAll
#
self . AutoCorrect = 0
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
# List customized Modifer here, split with ','
# Defaultly use the definition in class DataType
2018-04-20 23:51:37 +08:00
self . ModifierSet = MODIFIER_SET
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
## General Checking
self . GeneralCheckAll = 0
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
# Check whether NO Tab is used, replaced with spaces
self . GeneralCheckNoTab = 1
# The width of Tab
self . GeneralCheckTabWidth = 2
# Check whether the indentation is followed coding style
self . GeneralCheckIndentation = 1
# The width of indentation
self . GeneralCheckIndentationWidth = 2
# Check whether no line is exceeding defined widty
self . GeneralCheckLine = 1
# The width of a line
self . GeneralCheckLineWidth = 120
# Check whether no use of _asm in the source file
self . GeneralCheckNo_Asm = 1
# Check whether no use of "#progma" in source file except "#pragma pack(#)".
self . GeneralCheckNoProgma = 1
# Check whether there is a carriage return at the end of the file
self . GeneralCheckCarriageReturn = 1
# Check whether the file exists
self . GeneralCheckFileExistence = 1
2014-08-25 01:16:34 +00:00
# Check whether UNI file is valid
self . GeneralCheckUni = 1
2018-07-23 13:57:57 +08:00
# Check Only use CRLF (Carriage Return Line Feed) line endings.
self . GeneralCheckLineEnding = 1
# Check if there is no trailing white space in one line.
self . GeneralCheckTrailingWhiteSpaceLine = 1
2010-09-06 01:58:00 +00:00
2019-02-18 14:23:30 +08:00
self . CFunctionLayoutCheckNoDeprecated = 1
2009-07-17 09:10:31 +00:00
## Space Checking
self . SpaceCheckAll = 1
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
## Predicate Expression Checking
self . PredicateExpressionCheckAll = 0
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
# Check whether Boolean values, variable type BOOLEAN not use explicit comparisons to TRUE or FALSE
self . PredicateExpressionCheckBooleanValue = 1
2010-09-06 01:58:00 +00:00
# Check whether Non-Boolean comparisons use a compare operator (==, !=, >, < >=, <=).
2009-07-17 09:10:31 +00:00
self . PredicateExpressionCheckNonBooleanOperator = 1
# Check whether a comparison of any pointer to zero must be done via the NULL type
self . PredicateExpressionCheckComparisonNullType = 1
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
## Headers Checking
self . HeaderCheckAll = 0
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
# Check whether File header exists
self . HeaderCheckFile = 1
# Check whether Function header exists
self . HeaderCheckFunction = 1
2011-12-07 06:19:28 +00:00
# Check whether Meta data File header Comment End with '##'
self . HeaderCheckFileCommentEnd = 1
# Check whether C File header Comment content start with two spaces
self . HeaderCheckCFileCommentStartSpacesNum = 1
# Check whether C File header Comment's each reference at list should begin with a bullet character '-'
self . HeaderCheckCFileCommentReferenceFormat = 1
# Check whether C File header Comment have the License immediately after the ""Copyright"" line
self . HeaderCheckCFileCommentLicenseFormat = 1
2018-07-05 17:40:04 +08:00
2009-07-17 09:10:31 +00:00
## C Function Layout Checking
self . CFunctionLayoutCheckAll = 0
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
# Check whether return type exists and in the first line
self . CFunctionLayoutCheckReturnType = 1
# Check whether any optional functional modifiers exist and next to the return type
self . CFunctionLayoutCheckOptionalFunctionalModifier = 1
# Check whether the next line contains the function name, left justified, followed by the beginning of the parameter list
# Check whether the closing parenthesis is on its own line and also indented two spaces
self . CFunctionLayoutCheckFunctionName = 1
# Check whether the function prototypes in include files have the same form as function definitions
self . CFunctionLayoutCheckFunctionPrototype = 1
# Check whether the body of a function is contained by open and close braces that must be in the first column
self . CFunctionLayoutCheckFunctionBody = 1
# Check whether the data declarations is the first code in a module.
self . CFunctionLayoutCheckDataDeclaration = 1
# Check whether no initialization of a variable as part of its declaration
self . CFunctionLayoutCheckNoInitOfVariable = 1
# Check whether no use of STATIC for functions
self . CFunctionLayoutCheckNoStatic = 1
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
## Include Files Checking
self . IncludeFileCheckAll = 0
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
#Check whether having include files with same name
self . IncludeFileCheckSameName = 1
# Check whether include files contain only public or only private data
# Check whether include files NOT contain code or define data variables
self . IncludeFileCheckData = 1
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
## Declarations and Data Types Checking
self . DeclarationDataTypeCheckAll = 0
2010-09-06 01:58:00 +00:00
2019-09-04 17:54:12 +08:00
# Check whether no use of int, unsigned, char, void, long in any .c, .h or .asl files.
2009-07-17 09:10:31 +00:00
self . DeclarationDataTypeCheckNoUseCType = 1
# Check whether the modifiers IN, OUT, OPTIONAL, and UNALIGNED are used only to qualify arguments to a function and should not appear in a data type declaration
self . DeclarationDataTypeCheckInOutModifier = 1
# Check whether the EFIAPI modifier should be used at the entry of drivers, events, and member functions of protocols
self . DeclarationDataTypeCheckEFIAPIModifier = 1
# Check whether Enumerated Type has a 'typedef' and the name is capital
self . DeclarationDataTypeCheckEnumeratedType = 1
# Check whether Structure Type has a 'typedef' and the name is capital
self . DeclarationDataTypeCheckStructureDeclaration = 1
# Check whether having same Structure
self . DeclarationDataTypeCheckSameStructure = 1
# Check whether Union Type has a 'typedef' and the name is capital
self . DeclarationDataTypeCheckUnionType = 1
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
## Naming Conventions Checking
self . NamingConventionCheckAll = 0
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
# Check whether only capital letters are used for #define declarations
self . NamingConventionCheckDefineStatement = 1
# Check whether only capital letters are used for typedef declarations
self . NamingConventionCheckTypedefStatement = 1
# Rule for path name, variable name and function name
# 1. First character should be upper case
# 2. Existing lower case in a word
# 3. No space existence
# Check whether the path name followed the rule
self . NamingConventionCheckPathName = 1
# Check whether the variable name followed the rule
self . NamingConventionCheckVariableName = 1
# Check whether the function name followed the rule
self . NamingConventionCheckFunctionName = 1
# Check whether NO use short variable name with single character
self . NamingConventionCheckSingleCharacterVariable = 1
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
## Doxygen Checking
self . DoxygenCheckAll = 0
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
# Check whether the file headers are followed Doxygen special documentation blocks in section 2.3.5
self . DoxygenCheckFileHeader = 1
# Check whether the function headers are followed Doxygen special documentation blocks in section 2.3.5
self . DoxygenCheckFunctionHeader = 1
2010-09-06 01:58:00 +00:00
# Check whether the first line of text in a comment block is a brief description of the element being documented.
2009-07-17 09:10:31 +00:00
# The brief description must end with a period.
self . DoxygenCheckCommentDescription = 1
# Check whether comment lines with '///< ... text ...' format, if it is used, it should be after the code section.
self . DoxygenCheckCommentFormat = 1
# Check whether only Doxygen commands allowed to mark the code are @bug and @todo.
self . DoxygenCheckCommand = 1
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
## Meta-Data File Processing Checking
self . MetaDataFileCheckAll = 0
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
# Check whether each file defined in meta-data exists
self . MetaDataFileCheckPathName = 1
# Generate a list for all files defined in meta-data files
self . MetaDataFileCheckGenerateFileList = 1
# The path of log file
self . MetaDataFileCheckPathOfGenerateFileList = 'File.log'
2010-09-06 01:58:00 +00:00
# Check whether all Library Instances defined for a given module (or dependent library instance) match the module's type.
# Each Library Instance must specify the Supported Module Types in its INF file,
2009-07-17 09:10:31 +00:00
# and any module specifying the library instance must be one of the supported types.
self . MetaDataFileCheckLibraryInstance = 1
# Check whether a Library Instance has been defined for all dependent library classes
self . MetaDataFileCheckLibraryInstanceDependent = 1
# Check whether the Library Instances specified by the LibraryClasses sections are listed in order of dependencies
self . MetaDataFileCheckLibraryInstanceOrder = 1
# Check whether the unnecessary inclusion of library classes in the INF file
self . MetaDataFileCheckLibraryNoUse = 1
2015-06-25 08:01:59 +00:00
# Check the header file in Include\Library directory whether be defined in the package DEC file.
self . MetaDataFileCheckLibraryDefinedInDec = 1
2009-07-17 09:10:31 +00:00
# Check whether an INF file is specified in the FDF file, but not in the DSC file, then the INF file must be for a Binary module only
self . MetaDataFileCheckBinaryInfInFdf = 1
# Not to report error and warning related OS include file such as "windows.h" and "stdio.h"
# Check whether a PCD is set in a DSC file or the FDF file, but not in both.
self . MetaDataFileCheckPcdDuplicate = 1
# Check whether PCD settings in the FDF file can only be related to flash.
self . MetaDataFileCheckPcdFlash = 1
# Check whether PCDs used in INF files but not specified in DSC or FDF files
self . MetaDataFileCheckPcdNoUse = 1
# Check whether having duplicate guids defined for Guid/Protocol/Ppi
self . MetaDataFileCheckGuidDuplicate = 1
# Check whether all files under module directory are described in INF files
self . MetaDataFileCheckModuleFileNoUse = 1
# Check whether the PCD is correctly used in C function via its type
self . MetaDataFileCheckPcdType = 1
2010-05-18 05:04:32 +00:00
# Check whether there are FILE_GUID duplication among different INF files
self . MetaDataFileCheckModuleFileGuidDuplication = 1
2014-08-25 01:16:34 +00:00
# Check Guid Format in INF files
self . MetaDataFileCheckModuleFileGuidFormat = 1
# Check Protocol Format in INF files
self . MetaDataFileCheckModuleFileProtocolFormat = 1
# Check Ppi Format in INF files
self . MetaDataFileCheckModuleFilePpiFormat = 1
# Check Pcd Format in INF files
self . MetaDataFileCheckModuleFilePcdFormat = 1
2018-07-05 17:40:04 +08:00
2015-06-25 07:50:55 +00:00
# Check UNI file
self . UniCheckAll = 0
# Check INF or DEC file whether defined the localized information in the associated UNI file.
self . UniCheckHelpInfo = 1
# Check PCD whether defined the prompt, help in the DEC file and localized information in the associated UNI file.
self . UniCheckPCDInfo = 1
2014-08-25 01:16:34 +00:00
2017-04-11 16:17:19 +08:00
# Check SMM communication function parameter
self . SmmCommParaCheckAll = 0
# Check if the EFI_SMM_COMMUNICATION_PROTOCOL parameter buffer type is Reserved / ACPI NVS or UEFI RT code/data
self . SmmCommParaCheckBufferType = - 1
2009-07-17 09:10:31 +00:00
#
# The check points in this section are reserved
#
# GotoStatementCheckAll = 0
#
self . SpellingCheckAll = 0
# The directory listed here will not be parsed, split with ','
self . SkipDirList = []
2018-07-05 17:40:04 +08:00
2015-06-25 07:43:03 +00:00
# The file listed here will not be parsed, split with ','
self . SkipFileList = []
2009-07-17 09:10:31 +00:00
2010-09-06 01:58:00 +00:00
# A list for binary file ext name
self . BinaryExtList = []
2018-07-05 17:40:04 +08:00
2014-07-01 07:10:10 +00:00
# A list for only scanned folders
self . ScanOnlyDirList = []
2018-07-05 17:40:04 +08:00
2015-07-02 06:05:26 +00:00
# A list for Copyright format
self . Copyright = []
2010-09-06 01:58:00 +00:00
2019-05-06 10:35:07 +08:00
self . TokenReleaceList = []
2009-07-17 09:10:31 +00:00
self . ParseConfig ()
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
def ParseConfig ( self ):
Filepath = os . path . normpath ( self . Filename )
if not os . path . isfile ( Filepath ):
ErrorMsg = "Can't find configuration file ' %s '" % Filepath
EdkLogger . error ( "Ecc" , EdkLogger . ECC_ERROR , ErrorMsg , File = Filepath )
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
LineNo = 0
for Line in open ( Filepath , 'r' ):
LineNo = LineNo + 1
Line = CleanString ( Line )
if Line != '' :
List = GetSplitValueList ( Line , TAB_EQUAL_SPLIT )
2018-05-05 04:25:16 +08:00
if List [ 0 ] not in _ConfigFileToInternalTranslation :
2009-07-17 09:10:31 +00:00
ErrorMsg = "Invalid configuration option ' %s ' was found" % List [ 0 ]
EdkLogger . error ( "Ecc" , EdkLogger . ECC_ERROR , ErrorMsg , File = Filepath , Line = LineNo )
2018-05-05 04:25:16 +08:00
assert _ConfigFileToInternalTranslation [ List [ 0 ]] in self . __dict__
2009-07-17 09:10:31 +00:00
if List [ 0 ] == 'ModifierList' :
List [ 1 ] = GetSplitValueList ( List [ 1 ], TAB_COMMA_SPLIT )
if List [ 0 ] == 'MetaDataFileCheckPathOfGenerateFileList' and List [ 1 ] == "" :
continue
if List [ 0 ] == 'SkipDirList' :
List [ 1 ] = GetSplitValueList ( List [ 1 ], TAB_COMMA_SPLIT )
2015-06-25 07:43:03 +00:00
if List [ 0 ] == 'SkipFileList' :
List [ 1 ] = GetSplitValueList ( List [ 1 ], TAB_COMMA_SPLIT )
2010-09-06 01:58:00 +00:00
if List [ 0 ] == 'BinaryExtList' :
List [ 1 ] = GetSplitValueList ( List [ 1 ], TAB_COMMA_SPLIT )
2015-07-02 06:05:26 +00:00
if List [ 0 ] == 'Copyright' :
List [ 1 ] = GetSplitValueList ( List [ 1 ], TAB_COMMA_SPLIT )
2019-05-06 10:35:07 +08:00
if List [ 0 ] == 'TokenReleaceList' :
List [ 1 ] = GetSplitValueList ( List [ 1 ], TAB_COMMA_SPLIT )
2018-05-05 04:25:16 +08:00
self . __dict__ [ _ConfigFileToInternalTranslation [ List [ 0 ]]] = List [ 1 ]
2010-09-06 01:58:00 +00:00
2009-07-17 09:10:31 +00:00
def ShowMe ( self ):
2018-06-25 18:31:26 +08:00
print ( self . Filename )
2009-07-17 09:10:31 +00:00
for Key in self . __dict__ . keys ():
2018-06-25 18:31:26 +08:00
print ( Key , '=' , self . __dict__ [ Key ])
2018-05-05 04:25:16 +08:00
#
# test that our dict and out class still match in contents.
#
if __name__ == '__main__' :
2024-09-18 16:40:08 +01:00
myconfig = Configuration ( r "BaseTools\Source\Python\Ecc\config.ini" )
2018-05-05 04:25:16 +08:00
for each in myconfig . __dict__ :
if each == "Filename" :
continue
assert each in _ConfigFileToInternalTranslation . values ()
for each in _ConfigFileToInternalTranslation . values ():
assert each in myconfig . __dict__