BaseTools: Refactor python except statements
Convert "except ... ," to "except ... as" to be compatible with python3. Based on "futurize -f lib2to3.fixes.fix_except" Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
@ -1341,7 +1341,7 @@ class DscParser(MetaFileParser):
|
||||
self._InSubsection = False
|
||||
try:
|
||||
Processer[self._ItemType]()
|
||||
except EvaluationException, Excpt:
|
||||
except EvaluationException as Excpt:
|
||||
#
|
||||
# Only catch expression evaluation error here. We need to report
|
||||
# the precise number of line on which the error occurred
|
||||
@ -1363,7 +1363,7 @@ class DscParser(MetaFileParser):
|
||||
EdkLogger.error('Parser', FORMAT_INVALID, "Invalid expression: %s" % str(Excpt),
|
||||
File=self._FileWithError, ExtraData=' '.join(self._ValueList),
|
||||
Line=self._LineIndex + 1)
|
||||
except MacroException, Excpt:
|
||||
except MacroException as Excpt:
|
||||
EdkLogger.error('Parser', FORMAT_INVALID, str(Excpt),
|
||||
File=self._FileWithError, ExtraData=' '.join(self._ValueList),
|
||||
Line=self._LineIndex + 1)
|
||||
@ -1465,10 +1465,10 @@ class DscParser(MetaFileParser):
|
||||
Macros.update(GlobalData.gGlobalDefines)
|
||||
try:
|
||||
Result = ValueExpression(self._ValueList[1], Macros)()
|
||||
except SymbolNotFound, Exc:
|
||||
except SymbolNotFound as Exc:
|
||||
EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc), self._ValueList[1])
|
||||
Result = False
|
||||
except WrnExpression, Excpt:
|
||||
except WrnExpression as Excpt:
|
||||
#
|
||||
# Catch expression evaluation warning here. We need to report
|
||||
# the precise number of line and return the evaluation result
|
||||
@ -1614,7 +1614,7 @@ class DscParser(MetaFileParser):
|
||||
if PcdValue and "." not in self._ValueList[0]:
|
||||
try:
|
||||
ValList[Index] = ValueExpression(PcdValue, self._Macros)(True)
|
||||
except WrnExpression, Value:
|
||||
except WrnExpression as Value:
|
||||
ValList[Index] = Value.result
|
||||
except:
|
||||
pass
|
||||
@ -2019,7 +2019,7 @@ class DecParser(MetaFileParser):
|
||||
try:
|
||||
self._GuidDict.update(self._AllPcdDict)
|
||||
ValueList[0] = ValueExpressionEx(ValueList[0], ValueList[1], self._GuidDict)(True)
|
||||
except BadExpression, Value:
|
||||
except BadExpression as Value:
|
||||
EdkLogger.error('Parser', FORMAT_INVALID, Value, ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
|
||||
# check format of default value against the datum type
|
||||
IsValid, Cause = CheckPcdDatum(ValueList[1], ValueList[0])
|
||||
|
Reference in New Issue
Block a user