]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
BaseTools: Refactor python except statements
[mirror_edk2.git] / BaseTools / Source / Python / Ecc / MetaFileWorkspace / MetaFileParser.py
index 3749f6a2699e415ffed2063b826d2d9e0048e9e8..fd96bb9a3c0b7319639c318659f90c0542c01550 100644 (file)
@@ -1183,7 +1183,7 @@ class DscParser(MetaFileParser):
 \r
             try:\r
                 Processer[self._ItemType]()\r
-            except EvaluationException, Excpt:\r
+            except EvaluationException as Excpt:\r
                 # \r
                 # Only catch expression evaluation error here. We need to report\r
                 # the precise number of line on which the error occurred\r
@@ -1192,7 +1192,7 @@ class DscParser(MetaFileParser):
 #                 EdkLogger.error('Parser', FORMAT_INVALID, "Invalid expression: %s" % str(Excpt),\r
 #                                 File=self._FileWithError, ExtraData=' '.join(self._ValueList),\r
 #                                 Line=self._LineIndex+1)\r
-            except MacroException, Excpt:\r
+            except MacroException as Excpt:\r
                 EdkLogger.error('Parser', FORMAT_INVALID, str(Excpt),\r
                                 File=self._FileWithError, ExtraData=' '.join(self._ValueList), \r
                                 Line=self._LineIndex+1)\r
@@ -1305,10 +1305,10 @@ class DscParser(MetaFileParser):
             Macros.update(GlobalData.gGlobalDefines)\r
             try:\r
                 Result = ValueExpression(self._ValueList[1], Macros)()\r
-            except SymbolNotFound, Exc:\r
+            except SymbolNotFound as Exc:\r
                 EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc), self._ValueList[1])\r
                 Result = False\r
-            except WrnExpression, Excpt:\r
+            except WrnExpression as Excpt:\r
                 # \r
                 # Catch expression evaluation warning here. We need to report\r
                 # the precise number of line and return the evaluation result\r
@@ -1317,7 +1317,7 @@ class DscParser(MetaFileParser):
                                 File=self._FileWithError, ExtraData=' '.join(self._ValueList), \r
                                 Line=self._LineIndex+1)\r
                 Result = Excpt.result\r
-            except BadExpression, Exc:\r
+            except BadExpression as Exc:\r
                 EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc), self._ValueList[1])\r
                 Result = False\r
 \r
@@ -1437,13 +1437,13 @@ class DscParser(MetaFileParser):
             PcdValue = ValueList[0]      \r
             try:\r
                 ValueList[0] = ValueExpression(PcdValue, self._Macros)(True)\r
-            except WrnExpression, Value:\r
+            except WrnExpression as Value:\r
                 ValueList[0] = Value.result          \r
         else:\r
             PcdValue = ValueList[-1]\r
             try:\r
                 ValueList[-1] = ValueExpression(PcdValue, self._Macros)(True)\r
-            except WrnExpression, Value:\r
+            except WrnExpression as Value:\r
                 ValueList[-1] = Value.result\r
             \r
             if ValueList[-1] == 'True':\r