]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Ecc/c.py
BaseTools/Ecc: Fix import issues
[mirror_edk2.git] / BaseTools / Source / Python / Ecc / c.py
index 99b22725e6bacb788653eae2cabd397613f60458..953f1630b69394d0ea1eee3848d2da3313a79a7b 100644 (file)
 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 #\r
 \r
+from __future__ import print_function\r
+from __future__ import absolute_import\r
 import sys\r
 import Common.LongFilePathOs as os\r
 import re\r
 import string\r
-import CodeFragmentCollector\r
-import FileProfile\r
+from Ecc import CodeFragmentCollector\r
+from Ecc import FileProfile\r
 from CommonDataClass import DataClass\r
-import Database\r
+from Ecc import Database\r
 from Common import EdkLogger\r
-from EccToolError import *\r
-import EccGlobalData\r
-import MetaDataParser\r
+from Ecc.EccToolError import *\r
+from Ecc import EccGlobalData\r
+from Ecc import MetaDataParser\r
 \r
 IncludeFileListDict = {}\r
 AllIncludeFileListDict = {}\r
@@ -2285,7 +2287,7 @@ def CheckDoxygenTripleForwardSlash(FullFileName):
         for Result in ResultSet:\r
             CommentSet.append(Result)\r
     except:\r
-        print 'Unrecognized chars in comment of file %s', FullFileName\r
+        print('Unrecognized chars in comment of file %s', FullFileName)\r
 \r
 \r
     for Result in CommentSet:\r
@@ -2348,13 +2350,13 @@ def CheckFileHeaderDoxygenComments(FullFileName):
         if (len(CommentStrListTemp) <= 1):\r
             # For Mac\r
             CommentStrListTemp = CommentStr.split('\r')\r
-        # Skip the content before the file  header    \r
+        # Skip the content before the file  header\r
         for CommentLine in CommentStrListTemp:\r
             if CommentLine.strip().startswith('/** @file'):\r
                 FileStartFlag = True\r
             if FileStartFlag ==  True:\r
                 CommentStrList.append(CommentLine)\r
-                       \r
+\r
         ID = Result[1]\r
         Index = 0\r
         if CommentStrList and CommentStrList[0].strip().startswith('/** @file'):\r
@@ -2377,7 +2379,7 @@ def CheckFileHeaderDoxygenComments(FullFileName):
             if EccGlobalData.gConfig.HeaderCheckCFileCommentStartSpacesNum == '1' or EccGlobalData.gConfig.HeaderCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':\r
                 if CommentLine.startswith('/** @file') == False and CommentLine.startswith('**/') == False and CommentLine.strip() and CommentLine.startswith('  ') == False:\r
                     PrintErrorMsg(ERROR_HEADER_CHECK_FILE, 'File header comment content should start with two spaces at each line', FileTable, ID)\r
-            \r
+\r
             CommentLine = CommentLine.strip()\r
             if CommentLine.startswith('Copyright'):\r
                 NoCopyrightFlag = False\r
@@ -2402,9 +2404,9 @@ def CheckFileHeaderDoxygenComments(FullFileName):
                     # Check whether C File header Comment's each reference at list should begin with a bullet character.\r
                     if EccGlobalData.gConfig.HeaderCheckCFileCommentReferenceFormat == '1' or EccGlobalData.gConfig.HeaderCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':\r
                         if RefListFlag == True:\r
-                            if RefLine.strip() and RefLine.strip().startswith('**/') == False and RefLine.startswith('  -') == False:                            \r
-                                PrintErrorMsg(ERROR_HEADER_CHECK_FILE, 'Each reference on a separate line should begin with a bullet character ""-"" ', FileTable, ID)                    \r
-    \r
+                            if RefLine.strip() and RefLine.strip().startswith('**/') == False and RefLine.startswith('  -') == False:\r
+                                PrintErrorMsg(ERROR_HEADER_CHECK_FILE, 'Each reference on a separate line should begin with a bullet character ""-"" ', FileTable, ID)\r
+\r
     if NoHeaderCommentStartFlag:\r
         PrintErrorMsg(ERROR_DOXYGEN_CHECK_FILE_HEADER, 'File header comment should begin with ""/** @file""', FileTable, ID)\r
         return\r
@@ -2438,7 +2440,7 @@ def CheckFuncHeaderDoxygenComments(FullFileName):
         for Result in ResultSet:\r
             CommentSet.append(Result)\r
     except:\r
-        print 'Unrecognized chars in comment of file %s', FullFileName\r
+        print('Unrecognized chars in comment of file %s', FullFileName)\r
 \r
     # Func Decl check\r
     SqlStatement = """ select Modifier, Name, StartLine, ID, Value\r
@@ -2469,7 +2471,7 @@ def CheckFuncHeaderDoxygenComments(FullFileName):
         for Result in ResultSet:\r
             CommentSet.append(Result)\r
     except:\r
-        print 'Unrecognized chars in comment of file %s', FullFileName\r
+        print('Unrecognized chars in comment of file %s', FullFileName)\r
 \r
     SqlStatement = """ select Modifier, Header, StartLine, ID, Name\r
                        from Function\r
@@ -2634,9 +2636,9 @@ if __name__ == '__main__':
     try:\r
         test_file = sys.argv[1]\r
     except IndexError as v:\r
-        print "Usage: %s filename" % sys.argv[0]\r
+        print("Usage: %s filename" % sys.argv[0])\r
         sys.exit(1)\r
     MsgList = CheckFuncHeaderDoxygenComments(test_file)\r
     for Msg in MsgList:\r
-        print Msg\r
-    print 'Done!'\r
+        print(Msg)\r
+    print('Done!')\r