diff options
author | Gary Lin <glin@suse.com> | 2018-06-25 18:31:25 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-06-27 16:31:30 +0800 |
commit | 5b0671c1e514e534c6d5be9604da33bfc2cd0a24 (patch) | |
tree | 7e9dbe54574d43494ef71e57f008074295217c82 /BaseTools/Source/Python/AutoGen | |
parent | 00eb12a2c768cae3ca136110baacb5a35e9066a8 (diff) | |
download | edk2-5b0671c1e514e534c6d5be9604da33bfc2cd0a24.zip edk2-5b0671c1e514e534c6d5be9604da33bfc2cd0a24.tar.gz edk2-5b0671c1e514e534c6d5be9604da33bfc2cd0a24.tar.bz2 |
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>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen')
-rw-r--r-- | BaseTools/Source/Python/AutoGen/AutoGen.py | 2 | ||||
-rw-r--r-- | BaseTools/Source/Python/AutoGen/GenDepex.py | 2 | ||||
-rw-r--r-- | BaseTools/Source/Python/AutoGen/GenMake.py | 2 | ||||
-rw-r--r-- | BaseTools/Source/Python/AutoGen/UniClassObject.py | 4 |
4 files changed, 5 insertions, 5 deletions
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index ed0be3b..72d801d 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -2220,7 +2220,7 @@ class PlatformAutoGen(AutoGen): if ToPcd.DefaultValue:
try:
ToPcd.DefaultValue = ValueExpressionEx(ToPcd.DefaultValue, ToPcd.DatumType, self._GuidDict)(True)
- except BadExpression, Value:
+ except BadExpression as Value:
EdkLogger.error('Parser', FORMAT_INVALID, 'PCD [%s.%s] Value "%s", %s' %(ToPcd.TokenSpaceGuidCName, ToPcd.TokenCName, ToPcd.DefaultValue, Value),
File=self.MetaFile)
diff --git a/BaseTools/Source/Python/AutoGen/GenDepex.py b/BaseTools/Source/Python/AutoGen/GenDepex.py index ed5df2b..b69788c 100644 --- a/BaseTools/Source/Python/AutoGen/GenDepex.py +++ b/BaseTools/Source/Python/AutoGen/GenDepex.py @@ -449,7 +449,7 @@ def Main(): os.utime(Option.OutputFile, None)
else:
Dpx.Generate()
- except BaseException, X:
+ except BaseException as X:
EdkLogger.quiet("")
if Option is not None and Option.debug is not None:
EdkLogger.quiet(traceback.format_exc())
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 8541372..48b66c5 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -1030,7 +1030,7 @@ cleanlib: else:
try:
Fd = open(F.Path, 'r')
- except BaseException, X:
+ except BaseException as X:
EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=F.Path + "\n\t" + str(X))
FileContent = Fd.read()
diff --git a/BaseTools/Source/Python/AutoGen/UniClassObject.py b/BaseTools/Source/Python/AutoGen/UniClassObject.py index 5a3c254..06cf3e7 100644 --- a/BaseTools/Source/Python/AutoGen/UniClassObject.py +++ b/BaseTools/Source/Python/AutoGen/UniClassObject.py @@ -254,7 +254,7 @@ class UniFileClassObject(object): if len(Lang) != 3:
try:
FileIn = UniFileClassObject.OpenUniFile(LongFilePath(File.Path))
- except UnicodeError, X:
+ except UnicodeError as X:
EdkLogger.error("build", FILE_READ_FAILURE, "File read failure: %s" % str(X), ExtraData=File);
except:
EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=File);
@@ -393,7 +393,7 @@ class UniFileClassObject(object): try:
FileIn = UniFileClassObject.OpenUniFile(LongFilePath(File.Path))
- except UnicodeError, X:
+ except UnicodeError as X:
EdkLogger.error("build", FILE_READ_FAILURE, "File read failure: %s" % str(X), ExtraData=File.Path);
except:
EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=File.Path);
|