]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Ecc/Configuration.py
BaseTools/Ecc: Fix an issue of path separator compatibility
[mirror_edk2.git] / BaseTools / Source / Python / Ecc / Configuration.py
index 217b60f4f319a4d6e6f4773db3fecb1ad2925128..9d9feaca5eb6a01908e5d1d87fca10fa72dbdccb 100644 (file)
@@ -2,18 +2,13 @@
 # This file is used to define class Configuration\r
 #\r
 # Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution.  The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
 #\r
 \r
 ##\r
 # Import Modules\r
 #\r
+from __future__ import print_function\r
 import Common.LongFilePathOs as os\r
 import Common.EdkLogger as EdkLogger\r
 from Common.DataType import *\r
@@ -59,12 +54,14 @@ _ConfigFileToInternalTranslation = {
     "GeneralCheckIndentation":"GeneralCheckIndentation",\r
     "GeneralCheckIndentationWidth":"GeneralCheckIndentationWidth",\r
     "GeneralCheckLine":"GeneralCheckLine",\r
+    "GeneralCheckLineEnding":"GeneralCheckLineEnding",\r
     "GeneralCheckLineWidth":"GeneralCheckLineWidth",\r
     "GeneralCheckNoProgma":"GeneralCheckNoProgma",\r
     "GeneralCheckNoTab":"GeneralCheckNoTab",\r
     "GeneralCheckNo_Asm":"GeneralCheckNo_Asm",\r
     "GeneralCheckNonAcsii":"GeneralCheckNonAcsii",\r
     "GeneralCheckTabWidth":"GeneralCheckTabWidth",\r
+    "GeneralCheckTrailingWhiteSpaceLine":"GeneralCheckTrailingWhiteSpaceLine",\r
     "GeneralCheckUni":"GeneralCheckUni",\r
     "HeaderCheckAll":"HeaderCheckAll",\r
     "HeaderCheckCFileCommentLicenseFormat":"HeaderCheckCFileCommentLicenseFormat",\r
@@ -117,6 +114,7 @@ _ConfigFileToInternalTranslation = {
     "SmmCommParaCheckBufferType":"SmmCommParaCheckBufferType",\r
     "SpaceCheckAll":"SpaceCheckAll",\r
     "SpellingCheckAll":"SpellingCheckAll",\r
+    "TokenReleaceList":"TokenReleaceList",\r
     "UniCheckAll":"UniCheckAll",\r
     "UniCheckHelpInfo":"UniCheckHelpInfo",\r
     "UniCheckPCDInfo":"UniCheckPCDInfo",\r
@@ -185,6 +183,12 @@ class Configuration(object):
         self.GeneralCheckNonAcsii = 1\r
         # Check whether UNI file is valid\r
         self.GeneralCheckUni = 1\r
+        # Check Only use CRLF (Carriage Return Line Feed) line endings.\r
+        self.GeneralCheckLineEnding = 1\r
+        # Check if there is no trailing white space in one line.\r
+        self.GeneralCheckTrailingWhiteSpaceLine = 1\r
+\r
+        self.CFunctionLayoutCheckNoDeprecated = 1\r
 \r
         ## Space Checking\r
         self.SpaceCheckAll = 1\r
@@ -214,7 +218,7 @@ class Configuration(object):
         self.HeaderCheckCFileCommentReferenceFormat = 1\r
         # Check whether C File header Comment have the License immediately after the ""Copyright"" line\r
         self.HeaderCheckCFileCommentLicenseFormat = 1\r
-  \r
+\r
         ## C Function Layout Checking\r
         self.CFunctionLayoutCheckAll = 0\r
 \r
@@ -252,7 +256,7 @@ class Configuration(object):
         ## Declarations and Data Types Checking\r
         self.DeclarationDataTypeCheckAll = 0\r
 \r
-        # Check whether no use of int, unsigned, char, void, static, long in any .c, .h or .asl files.\r
+        # Check whether no use of int, unsigned, char, void, long in any .c, .h or .asl files.\r
         self.DeclarationDataTypeCheckNoUseCType = 1\r
         # 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\r
         self.DeclarationDataTypeCheckInOutModifier = 1\r
@@ -351,7 +355,7 @@ class Configuration(object):
         self.MetaDataFileCheckModuleFilePpiFormat = 1\r
         # Check Pcd Format in INF files\r
         self.MetaDataFileCheckModuleFilePcdFormat = 1\r
-        \r
+\r
         # Check UNI file\r
         self.UniCheckAll = 0\r
         # Check INF or DEC file whether defined the localized information in the associated UNI file.\r
@@ -373,19 +377,21 @@ class Configuration(object):
 \r
         # The directory listed here will not be parsed, split with ','\r
         self.SkipDirList = []\r
-        \r
+\r
         # The file listed here will not be parsed, split with ','\r
         self.SkipFileList = []\r
 \r
         # A list for binary file ext name\r
         self.BinaryExtList = []\r
-        \r
+\r
         # A list for only scanned folders\r
         self.ScanOnlyDirList = []\r
-        \r
+\r
         # A list for Copyright format\r
         self.Copyright = []\r
 \r
+        self.TokenReleaceList = []\r
+\r
         self.ParseConfig()\r
 \r
     def ParseConfig(self):\r
@@ -416,12 +422,14 @@ class Configuration(object):
                     List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)\r
                 if List[0] == 'Copyright':\r
                     List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)\r
+                if List[0] == 'TokenReleaceList':\r
+                    List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)\r
                 self.__dict__[_ConfigFileToInternalTranslation[List[0]]] = List[1]\r
 \r
     def ShowMe(self):\r
-        print self.Filename\r
+        print(self.Filename)\r
         for Key in self.__dict__.keys():\r
-            print Key, '=', self.__dict__[Key]\r
+            print(Key, '=', self.__dict__[Key])\r
 \r
 #\r
 # test that our dict and out class still match in contents.\r