未验证 提交 12f103aa 编写于 作者: T tianshuo78520a 提交者: GitHub

[Cherry-Pick 33556]del python2 code (#33987)

* del python2 code

* cherry-pick 33556
上级 0d6c7532
...@@ -209,7 +209,7 @@ option(WITH_STRIP "Strip so files of Whl packages" OFF) ...@@ -209,7 +209,7 @@ option(WITH_STRIP "Strip so files of Whl packages" OFF)
# PY_VERSION # PY_VERSION
if(NOT PY_VERSION) if(NOT PY_VERSION)
set(PY_VERSION 2.7) set(PY_VERSION 3.6)
endif() endif()
set(PYBIND11_PYTHON_VERSION ${PY_VERSION}) set(PYBIND11_PYTHON_VERSION ${PY_VERSION})
......
requests>=2.20.0 requests>=2.20.0
numpy>=1.13, <=1.16.4 ; python_version<"3.5"
numpy>=1.13 ; python_version>="3.5" and platform_system != "Windows" numpy>=1.13 ; python_version>="3.5" and platform_system != "Windows"
numpy>=1.13, <=1.19.3 ; python_version>="3.5" and platform_system == "Windows" numpy>=1.13, <=1.19.3 ; python_version>="3.5" and platform_system == "Windows"
protobuf>=3.1.0 protobuf>=3.1.0
...@@ -7,5 +6,5 @@ gast>=0.3.3, <=0.4.0 ; platform_system != "Windows" ...@@ -7,5 +6,5 @@ gast>=0.3.3, <=0.4.0 ; platform_system != "Windows"
gast==0.3.3 ; platform_system == "Windows" gast==0.3.3 ; platform_system == "Windows"
Pillow Pillow
six six
decorator==4.4.2 decorator
astor astor
...@@ -4,10 +4,8 @@ pycrypto ; platform_system != "Windows" ...@@ -4,10 +4,8 @@ pycrypto ; platform_system != "Windows"
mock mock
gym gym
opencv-python<=4.2.0.32 opencv-python<=4.2.0.32
visualdl ; python_version>="3.5" visualdl
paddle2onnx>=0.4 paddle2onnx>=0.4
scipy>=0.19.0, <=1.2.1 ; python_version<"3.5" scipy
scipy<=1.3.1 ; python_version=="3.5"
scipy ; python_version>"3.5"
prettytable prettytable
distro distro
...@@ -37,10 +37,7 @@ omitted_list = [ ...@@ -37,10 +37,7 @@ omitted_list = [
def md5(doc): def md5(doc):
try: try:
hashinst = hashlib.md5() hashinst = hashlib.md5()
if platform.python_version()[0] == "2": hashinst.update(str(doc).encode('utf-8'))
hashinst.update(str(doc))
else:
hashinst.update(str(doc).encode('utf-8'))
md5sum = hashinst.hexdigest() md5sum = hashinst.hexdigest()
except UnicodeDecodeError as e: except UnicodeDecodeError as e:
md5sum = None md5sum = None
......
...@@ -36,10 +36,7 @@ visited_modules = set() ...@@ -36,10 +36,7 @@ visited_modules = set()
def md5(doc): def md5(doc):
try: try:
hashinst = hashlib.md5() hashinst = hashlib.md5()
if platform.python_version()[0] == "2": hashinst.update(str(doc).encode('utf-8'))
hashinst.update(str(doc))
else:
hashinst.update(str(doc).encode('utf-8'))
md5sum = hashinst.hexdigest() md5sum = hashinst.hexdigest()
except UnicodeDecodeError as e: except UnicodeDecodeError as e:
md5sum = None md5sum = None
...@@ -142,7 +139,7 @@ def visit_member(parent_name, member, member_name=None): ...@@ -142,7 +139,7 @@ def visit_member(parent_name, member, member_name=None):
def is_primitive(instance): def is_primitive(instance):
int_types = (int, long) if platform.python_version()[0] == "2" else (int, ) int_types = (int, )
pritimitive_types = int_types + (float, str) pritimitive_types = int_types + (float, str)
if isinstance(instance, pritimitive_types): if isinstance(instance, pritimitive_types):
return True return True
......
...@@ -389,7 +389,7 @@ def execute_samplecode(tfname): ...@@ -389,7 +389,7 @@ def execute_samplecode(tfname):
""" """
result = True result = True
msg = None msg = None
if platform.python_version()[0] in ["2", "3"]: if platform.python_version()[0] in ["3"]:
cmd = [sys.executable, tfname] cmd = [sys.executable, tfname]
else: else:
logger.error("Error: fail to parse python version!") logger.error("Error: fail to parse python version!")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册