Fix a python syntax error.
authorqhuang8 <qhuang8@7335b38e-4728-0410-8992-fb3ffe349368>
Fri, 14 Aug 2009 01:07:27 +0000 (01:07 +0000)
committerqhuang8 <qhuang8@7335b38e-4728-0410-8992-fb3ffe349368>
Fri, 14 Aug 2009 01:07:27 +0000 (01:07 +0000)
If we use "from Common.BuildToolError import *", we really do not need "BuildToolError." name space, which is only required when we use "from Common.BuildToolError import BuildToolError"

git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1681 7335b38e-4728-0410-8992-fb3ffe349368

Source/Python/GenFds/GenFds.py
Source/Python/GenFds/GenFdsGlobalVariable.py

index 2bc416f..3e332df 100644 (file)
@@ -77,10 +77,10 @@ def main():
             EdkLogger.SetLevel(EdkLogger.INFO)
 
         if (Options.Workspace == None):
-            EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "WORKSPACE not defined",
+            EdkLogger.error("GenFds", OPTION_MISSING, "WORKSPACE not defined",
                             ExtraData="Please use '-w' switch to pass it or set the WORKSPACE environment variable.")
         elif not os.path.exists(Options.Workspace):
-            EdkLogger.error("GenFds", BuildToolError.PARAMETER_INVALID, "WORKSPACE is invalid",
+            EdkLogger.error("GenFds", PARAMETER_INVALID, "WORKSPACE is invalid",
                             ExtraData="Please use '-w' switch to pass it or set the WORKSPACE environment variable.")
         else:
             Workspace = os.path.normcase(Options.Workspace)
@@ -95,17 +95,17 @@ def main():
             FdfFilename = Options.filename
             FdfFilename = GenFdsGlobalVariable.ReplaceWorkspaceMacro(FdfFilename)
         else:
-            EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing FDF filename")
+            EdkLogger.error("GenFds", OPTION_MISSING, "Missing FDF filename")
 
         if (Options.BuildTarget):
             GenFdsGlobalVariable.TargetName = Options.BuildTarget
         else:
-            EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing build target")
+            EdkLogger.error("GenFds", OPTION_MISSING, "Missing build target")
 
         if (Options.ToolChain):
             GenFdsGlobalVariable.ToolChainTag = Options.ToolChain
         else:
-            EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing tool chain tag")
+            EdkLogger.error("GenFds", OPTION_MISSING, "Missing tool chain tag")
 
         if FdfFilename[0:2] == '..':
             FdfFilename = os.path.realpath(FdfFilename)
@@ -113,7 +113,7 @@ def main():
             FdfFilename = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, FdfFilename)
 
         if not os.path.exists(FdfFilename):
-            EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, ExtraData=FdfFilename)
+            EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=FdfFilename)
         GenFdsGlobalVariable.FdfFile = FdfFilename
         GenFdsGlobalVariable.FdfFileTimeStamp = os.path.getmtime(FdfFilename)
 
@@ -128,19 +128,19 @@ def main():
                 ActivePlatform = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, ActivePlatform)
 
             if not os.path.exists(ActivePlatform)  :
-                EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, "ActivePlatform doesn't exist!")
+                EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatform doesn't exist!")
 
             if ActivePlatform.find(Workspace) == -1:
-                EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, "ActivePlatform doesn't exist in Workspace!")
+                EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatform doesn't exist in Workspace!")
 
             ActivePlatform = ActivePlatform.replace(Workspace, '')
             if len(ActivePlatform) > 0 :
                 if ActivePlatform[0] == '\\' or ActivePlatform[0] == '/':
                     ActivePlatform = ActivePlatform[1:]
             else:
-                EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, "ActivePlatform doesn't exist!")
+                EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatform doesn't exist!")
         else :
-            EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing active platform")
+            EdkLogger.error("GenFds", OPTION_MISSING, "Missing active platform")
 
         GenFdsGlobalVariable.ActivePlatform = PathClass(NormPath(ActivePlatform), Workspace)
 
@@ -148,7 +148,7 @@ def main():
         if os.path.isfile(BuildConfigurationFile) == True:
             TargetTxtClassObject.TargetTxtClassObject(BuildConfigurationFile)
         else:
-            EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, ExtraData=BuildConfigurationFile)
+            EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=BuildConfigurationFile)
 
         if Options.Macros:
             for Pair in Options.Macros:
@@ -179,7 +179,7 @@ def main():
         if (Options.archList) :
             ArchList = Options.archList.split(',')
         else:
-#            EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing build ARCH")
+#            EdkLogger.error("GenFds", OPTION_MISSING, "Missing build ARCH")
             ArchList = BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].SupArchList
 
         TargetArchList = set(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].SupArchList) & set(ArchList)
@@ -206,7 +206,7 @@ def main():
                 OutputDir = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, OutputDir)
 
             if not os.path.exists(OutputDir):
-                EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, ExtraData=OutputDir)
+                EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=OutputDir)
             GenFdsGlobalVariable.OutputDirDict[Key] = OutputDir
 
         """ Parse Fdf file, has to place after build Workspace as FDF may contain macros from DSC file """
@@ -214,20 +214,20 @@ def main():
         FdfParserObj.ParseFile()
 
         if FdfParserObj.CycleReferenceCheck():
-            EdkLogger.error("GenFds", BuildToolError.FORMAT_NOT_SUPPORTED, "Cycle Reference Detected in FDF file")
+            EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Cycle Reference Detected in FDF file")
 
         if (Options.uiFdName) :
             if Options.uiFdName.upper() in FdfParserObj.Profile.FdDict.keys():
                 GenFds.OnlyGenerateThisFd = Options.uiFdName
             else:
-                EdkLogger.error("GenFds", BuildToolError.OPTION_VALUE_INVALID,
+                EdkLogger.error("GenFds", OPTION_VALUE_INVALID,
                                 "No such an FD in FDF file: %s" % Options.uiFdName)
 
         if (Options.uiFvName) :
             if Options.uiFvName.upper() in FdfParserObj.Profile.FvDict.keys():
                 GenFds.OnlyGenerateThisFv = Options.uiFvName
             else:
-                EdkLogger.error("GenFds", BuildToolError.OPTION_VALUE_INVALID,
+                EdkLogger.error("GenFds", OPTION_VALUE_INVALID,
                                 "No such an FV in FDF file: %s" % Options.uiFvName)
 
         """Modify images from build output if the feature of loading driver at fixed address is on."""
@@ -240,8 +240,8 @@ def main():
         GenFds.DisplayFvSpaceInfo(FdfParserObj)
         
     except FdfParser.Warning, X:
-        EdkLogger.error(X.ToolName, BuildToolError.FORMAT_INVALID, File=X.FileName, Line=X.LineNumber, ExtraData=X.Message, RaiseError = False)
-        ReturnCode = BuildToolError.FORMAT_INVALID
+        EdkLogger.error(X.ToolName, FORMAT_INVALID, File=X.FileName, Line=X.LineNumber, ExtraData=X.Message, RaiseError = False)
+        ReturnCode = FORMAT_INVALID
     except FatalError, X:
         if Options.debug != None:
             import traceback
index d556ce7..77c8821 100644 (file)
@@ -360,7 +360,7 @@ class GenFdsGlobalVariable:
         try:
             PopenObject = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr= subprocess.PIPE)
         except Exception, X:
-            EdkLogger.error("GenFds", BuildToolError.COMMAND_FAILURE, ExtraData="%s: %s" % (str(X), cmd[0]))
+            EdkLogger.error("GenFds", COMMAND_FAILURE, ExtraData="%s: %s" % (str(X), cmd[0]))
         (out, error) = PopenObject.communicate()
 
         while PopenObject.returncode == None :
@@ -371,7 +371,7 @@ class GenFdsGlobalVariable:
             GenFdsGlobalVariable.InfLogger (error)
             if PopenObject.returncode != 0:
                 print "###", cmd
-                EdkLogger.error("GenFds", BuildToolError.COMMAND_FAILURE, errorMess)
+                EdkLogger.error("GenFds", COMMAND_FAILURE, errorMess)
 
     def VerboseLogger (msg):
         EdkLogger.verbose(msg)
@@ -380,7 +380,7 @@ class GenFdsGlobalVariable:
         EdkLogger.info(msg)
 
     def ErrorLogger (msg, File = None, Line = None, ExtraData = None):
-        EdkLogger.error('GenFds', BuildToolError.GENFDS_ERROR, msg, File, Line, ExtraData)
+        EdkLogger.error('GenFds', GENFDS_ERROR, msg, File, Line, ExtraData)
 
     def DebugLogger (Level, msg):
         EdkLogger.debug(Level, msg)