From 7b0b064da4a8c5f5fa5935ec72d52d0b27657580 Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Tue, 18 May 2021 10:59:02 +0800 Subject: [PATCH] [cherry-pick] Fix CI Python3 on release/2.1 (#32930) Fix CI Python3 on release/2.1 #32930 --- python/unittest_py/requirements.txt | 1 + tools/check_op_desc.py | 8 +++----- tools/summary_env.py | 5 +++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/python/unittest_py/requirements.txt b/python/unittest_py/requirements.txt index 5a59935887..752f3545c6 100644 --- a/python/unittest_py/requirements.txt +++ b/python/unittest_py/requirements.txt @@ -10,3 +10,4 @@ scipy>=0.19.0, <=1.2.1 ; python_version<"3.5" scipy<=1.3.1 ; python_version=="3.5" scipy ; python_version>"3.5" prettytable +distro diff --git a/tools/check_op_desc.py b/tools/check_op_desc.py index 15e4104012..78abb6f36c 100644 --- a/tools/check_op_desc.py +++ b/tools/check_op_desc.py @@ -17,8 +17,6 @@ import sys from paddle.utils import OpLastCheckpointChecker from paddle.fluid.core import OpUpdateType -SAME = 0 - INPUTS = "Inputs" OUTPUTS = "Outputs" ATTRS = "Attrs" @@ -71,7 +69,7 @@ def diff_vars(origin_vars, new_vars): vars_name_only_in_new = set(new_vars.keys()) - set(origin_vars.keys()) for var_name in common_vars_name: - if cmp(origin_vars.get(var_name), new_vars.get(var_name)) == SAME: + if origin_vars.get(var_name) == new_vars.get(var_name): continue else: error, var_error = True, True @@ -120,7 +118,7 @@ def diff_attr(ori_attrs, new_attrs): attrs_only_in_new = set(new_attrs.keys()) - set(ori_attrs.keys()) for attr_name in common_attrs: - if cmp(ori_attrs.get(attr_name), new_attrs.get(attr_name)) == SAME: + if ori_attrs.get(attr_name) == new_attrs.get(attr_name): continue else: error, attr_error = True, True @@ -184,7 +182,7 @@ def compare_op_desc(origin_op_desc, new_op_desc): new = json.loads(new_op_desc) desc_error_message = {} version_error_message = {} - if cmp(origin_op_desc, new_op_desc) == SAME: + if origin_op_desc == new_op_desc: return desc_error_message, version_error_message for op_type in origin: diff --git a/tools/summary_env.py b/tools/summary_env.py index 38bae87651..d12e644cc2 100644 --- a/tools/summary_env.py +++ b/tools/summary_env.py @@ -13,6 +13,7 @@ # limitations under the License. import os import sys +import distro import platform import subprocess @@ -47,8 +48,8 @@ def get_os_info(): plat = "macOs" ver = platform.mac_ver()[0] elif platform.system() == "Linux": - plat = platform.linux_distribution()[0] - ver = platform.linux_distribution()[1] + plat = distro.linux_distribution()[0] + ver = distro.linux_distribution()[1] elif platform.system() == "Windows": plat = "Windows" ver = platform.win32_ver()[0] -- GitLab