Fixed non-ascii characters issue when calling Cursor.fetchall() and unified some...
authorjwang36 <jwang36@7335b38e-4728-0410-8992-fb3ffe349368>
Wed, 19 Mar 2008 02:38:53 +0000 (02:38 +0000)
committerjwang36 <jwang36@7335b38e-4728-0410-8992-fb3ffe349368>
Wed, 19 Mar 2008 02:38:53 +0000 (02:38 +0000)
git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1076 7335b38e-4728-0410-8992-fb3ffe349368

Source/Python/Ecc/Check.py
Source/Python/Ecc/Database.py
Source/Python/Ecc/Ecc.py
Source/Python/Ecc/c.py

index 16f2a7a..daff1dc 100644 (file)
@@ -56,6 +56,7 @@ class Check(object):
     #\r
     def DoxygenCheckFunctionHeader(self):\r
         if EccGlobalData.gConfig.DoxygenCheckFunctionHeader == '1' or EccGlobalData.gConfig.DoxygenCheckAll == '1':\r
+            EdkLogger.quiet("Checking Doxygen function header ...")\r
             Tuple = os.walk(EccGlobalData.gTarget)\r
             IgnoredPattern = re.compile(r'.*[\\/](?:BUILD|CVS|\.SVN|INTELRESTRICTEDTOOLS|INTELRESTRICTEDPKG)[\\/].*')\r
 #            ParseErrorFileList = []\r
@@ -69,7 +70,6 @@ class Check(object):
                         MsgList = c.CheckFuncHeaderDoxygenComments(FullName)\r
 #                        for Msg in MsgList:\r
 #                            print Msg\r
-            print 'Done'                \r
                             \r
     #\r
     # Check whether the first line of text in a comment block is a brief description of the element being documented. \r
index 741d9c4..0e9f0d6 100644 (file)
@@ -82,6 +82,8 @@ class Database(object):
         self.Conn = sqlite3.connect(self.DbPath, isolation_level = 'DEFERRED')\r
         self.Conn.execute("PRAGMA page_size=4096")\r
         self.Conn.execute("PRAGMA synchronous=OFF")\r
+        # to avoid non-ascii charater conversion error\r
+        self.Conn.text_factory = str\r
         self.Cur = self.Conn.cursor()\r
         \r
         self.TblDataModel = TableDataModel(self.Cur)\r
index 473ba79..fec60ed 100644 (file)
@@ -45,13 +45,6 @@ class Ecc(object):
         self.OutputFile = 'output.txt'\r
         self.IsInit = True\r
         \r
-        #\r
-        # Initialize log system\r
-        #\r
-        EdkLogger.Initialize()\r
-        EdkLogger.IsRaiseError = False\r
-        EdkLogger.quiet(time.strftime("%H:%M:%S, %b.%d %Y ", time.localtime()) + "[00:00]" + "\n")\r
-        \r
         #\r
         # Parse the options and args\r
         #\r
@@ -89,6 +82,8 @@ class Ecc(object):
         #\r
         EccGlobalData.gDb.Close()\r
 \r
+\r
+\r
     ## BuildDatabase\r
     #\r
     # Build the database for target\r
@@ -265,4 +260,17 @@ class Ecc(object):
 # script.\r
 #\r
 if __name__ == '__main__':\r
+    #\r
+    # Initialize log system\r
+    #\r
+    EdkLogger.Initialize()\r
+    EdkLogger.IsRaiseError = False\r
+    EdkLogger.quiet(time.strftime("%H:%M:%S, %b.%d %Y ", time.localtime()) + "[00:00]" + "\n")\r
+\r
+    StartTime = time.clock()\r
     Ecc = Ecc()\r
+    FinishTime = time.clock()\r
+\r
+    BuildDuration = time.strftime("%M:%S", time.gmtime(int(round(FinishTime - StartTime))))\r
+    EdkLogger.quiet("\n%s [%s]" % (time.strftime("%H:%M:%S, %b.%d %Y", time.localtime()), BuildDuration))\r
+\r
index 6998ec9..108fe04 100644 (file)
@@ -200,7 +200,7 @@ def CollectSourceCodeDataIntoDB(RootDir):
             FullName = os.path.join(dirpath, f)\r
             \r
             if os.path.splitext(f)[1] in ('.h', '.c'):\r
-                print FullName\r
+                EdkLogger.info("Parsing " + FullName)\r
                 model = f.endswith('c') and DataClass.MODEL_FILE_C or DataClass.MODEL_FILE_H\r
                 collector = CodeFragmentCollector.CodeFragmentCollector(FullName)\r
                 try:\r
@@ -217,7 +217,7 @@ def CollectSourceCodeDataIntoDB(RootDir):
                 FileObj = DataClass.FileClass(-1, BaseName, Ext, DirName, FullName, model, ModifiedTime, GetFunctionList(), GetIdentifierList(), [])\r
                 FileObjList.append(FileObj)\r
                 collector.CleanFileProfileBuffer()   \r
-    print ParseErrorFileList\r
+    EdkLogger.info("Found error during parsing:\n\t%s\n" % "\n\t".join(ParseErrorFileList))\r
     \r
     Db = GetDB()    \r
     for file in FileObjList:    \r
@@ -226,7 +226,6 @@ def CollectSourceCodeDataIntoDB(RootDir):
     Db.UpdateIdentifierBelongsToFunction()\r
 \r
 def CheckFuncHeaderDoxygenComments(FullFileName):\r
-    print '\n' + FullFileName + '\n'\r
     ErrorMsgList = []\r
     Db = GetDB()\r
     \r