]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Ecc/Ecc.py
BaseTools: Rename String to StringUtils.
[mirror_edk2.git] / BaseTools / Source / Python / Ecc / Ecc.py
index c2ad4faff4466b82b08c279a9858ef5c4ac870c7..e78d70372e36ce354be7b49f45de69d3410a5e8a 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # This file is used to be the main entrance of ECC tool\r
 #\r
-# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2009 - 2016, 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
@@ -24,7 +24,7 @@ from Configuration import Configuration
 from Check import Check\r
 import Common.GlobalData as GlobalData\r
 \r
-from Common.String import NormPath\r
+from Common.StringUtils import NormPath\r
 from Common.BuildVersion import gBUILD_VERSION\r
 from Common import BuildToolError\r
 from Common.Misc import PathClass\r
@@ -49,9 +49,9 @@ from Common.MultipleWorkspace import MultipleWorkspace as mws
 class Ecc(object):\r
     def __init__(self):\r
         # Version and Copyright\r
-        self.VersionNumber = ("0.01" + " " + gBUILD_VERSION)\r
+        self.VersionNumber = ("1.0" + " Build " + gBUILD_VERSION)\r
         self.Version = "%prog Version " + self.VersionNumber\r
-        self.Copyright = "Copyright (c) 2009 - 2010, Intel Corporation  All rights reserved."\r
+        self.Copyright = "Copyright (c) 2009 - 2016, Intel Corporation  All rights reserved."\r
 \r
         self.InitDefaultConfigIni()\r
         self.OutputFile = 'output.txt'\r
@@ -65,6 +65,7 @@ class Ecc(object):
 \r
         # Parse the options and args\r
         self.ParseOption()\r
+        EdkLogger.info(time.strftime("%H:%M:%S, %b.%d %Y ", time.localtime()) + "[00:00]" + "\n")\r
         \r
         #\r
         # Check EFI_SOURCE (Edk build convention). EDK_SOURCE will always point to ECP\r
@@ -104,7 +105,7 @@ class Ecc(object):
         GlobalData.gGlobalDefines["EDK_SOURCE"] = EdkSourceDir\r
         GlobalData.gGlobalDefines["ECP_SOURCE"] = EcpSourceDir\r
         \r
-        \r
+        EdkLogger.info("Loading ECC configuration ... done")\r
         # Generate checkpoints list\r
         EccGlobalData.gConfig = Configuration(self.ConfigFile)\r
 \r
@@ -177,7 +178,7 @@ class Ecc(object):
                 self.BuildMetaDataFileDatabase(SpeciDirs)\r
             if self.ScanSourceCode:\r
                 EdkLogger.quiet("Building database for Meta Data File Done!")\r
-                if SpeciDirs == None:\r
+                if SpeciDirs is None:\r
                     c.CollectSourceCodeDataIntoDB(EccGlobalData.gTarget)\r
                 else:\r
                     for specificDir in SpeciDirs:\r
@@ -194,7 +195,7 @@ class Ecc(object):
     #\r
     def BuildMetaDataFileDatabase(self, SpecificDirs = None):\r
         ScanFolders = []\r
-        if SpecificDirs == None:\r
+        if SpecificDirs is None:\r
             ScanFolders.append(EccGlobalData.gTarget)\r
         else:\r
             for specificDir in SpecificDirs:    \r
@@ -327,7 +328,6 @@ class Ecc(object):
     # Parse options\r
     #\r
     def ParseOption(self):\r
-        EdkLogger.quiet("Loading ECC configuration ... done")\r
         (Options, Target) = self.EccOptionParser()\r
 \r
         if Options.Workspace:\r
@@ -346,15 +346,15 @@ class Ecc(object):
         self.SetLogLevel(Options)\r
 \r
         # Set other options\r
-        if Options.ConfigFile != None:\r
+        if Options.ConfigFile is not None:\r
             self.ConfigFile = Options.ConfigFile\r
-        if Options.OutputFile != None:\r
+        if Options.OutputFile is not None:\r
             self.OutputFile = Options.OutputFile\r
-        if Options.ReportFile != None:\r
+        if Options.ReportFile is not None:\r
             self.ReportFile = Options.ReportFile\r
-        if Options.ExceptionFile != None:\r
+        if Options.ExceptionFile is not None:\r
             self.ExceptionFile = Options.ExceptionFile\r
-        if Options.Target != None:\r
+        if Options.Target is not None:\r
             if not os.path.isdir(Options.Target):\r
                 EdkLogger.error("ECC", BuildToolError.OPTION_VALUE_INVALID, ExtraData="Target [%s] does NOT exist" % Options.Target)\r
             else:\r
@@ -362,15 +362,15 @@ class Ecc(object):
         else:\r
             EdkLogger.warn("Ecc", EdkLogger.ECC_ERROR, "The target source tree was not specified, using current WORKSPACE instead!")\r
             EccGlobalData.gTarget = os.path.normpath(os.getenv("WORKSPACE"))\r
-        if Options.keepdatabase != None:\r
+        if Options.keepdatabase is not None:\r
             self.IsInit = False\r
-        if Options.metadata != None and Options.sourcecode != None:\r
+        if Options.metadata is not None and Options.sourcecode is not None:\r
             EdkLogger.error("ECC", BuildToolError.OPTION_CONFLICT, ExtraData="-m and -s can't be specified at one time")\r
-        if Options.metadata != None:\r
+        if Options.metadata is not None:\r
             self.ScanSourceCode = False\r
-        if Options.sourcecode != None:\r
+        if Options.sourcecode is not None:\r
             self.ScanMetaData = False\r
-        if Options.folders != None:\r
+        if Options.folders is not None:\r
             self.OnlyScan = True\r
 \r
     ## SetLogLevel\r
@@ -380,11 +380,11 @@ class Ecc(object):
     # @param Option:  The option list including log level setting\r
     #\r
     def SetLogLevel(self, Option):\r
-        if Option.verbose != None:\r
+        if Option.verbose is not None:\r
             EdkLogger.SetLevel(EdkLogger.VERBOSE)\r
-        elif Option.quiet != None:\r
+        elif Option.quiet is not None:\r
             EdkLogger.SetLevel(EdkLogger.QUIET)\r
-        elif Option.debug != None:\r
+        elif Option.debug is not None:\r
             EdkLogger.SetLevel(Option.debug + 1)\r
         else:\r
             EdkLogger.SetLevel(EdkLogger.INFO)\r
@@ -437,7 +437,6 @@ if __name__ == '__main__':
     # Initialize log system\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