未验证 提交 0b4a7f1a 编写于 作者: T tianshuo78520a 提交者: GitHub

del python2 code (#33556)

上级 78a9870f
...@@ -216,7 +216,7 @@ option(WITH_STRIP "Strip so files of Whl packages" OFF) ...@@ -216,7 +216,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.7)
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 ; platform_system != "Windows" ...@@ -7,5 +6,5 @@ gast>=0.3.3 ; 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,9 +37,6 @@ omitted_list = [ ...@@ -37,9 +37,6 @@ 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))
else:
hashinst.update(str(doc).encode('utf-8')) hashinst.update(str(doc).encode('utf-8'))
md5sum = hashinst.hexdigest() md5sum = hashinst.hexdigest()
except UnicodeDecodeError as e: except UnicodeDecodeError as e:
......
...@@ -50,9 +50,6 @@ console.setFormatter( ...@@ -50,9 +50,6 @@ console.setFormatter(
def md5(doc): def md5(doc):
try: try:
hashinst = hashlib.md5() hashinst = hashlib.md5()
if platform.python_version()[0] == "2":
hashinst.update(str(doc))
else:
hashinst.update(str(doc).encode('utf-8')) hashinst.update(str(doc).encode('utf-8'))
md5sum = hashinst.hexdigest() md5sum = hashinst.hexdigest()
except UnicodeDecodeError as e: except UnicodeDecodeError as e:
...@@ -156,7 +153,7 @@ def visit_member(parent_name, member, member_name=None): ...@@ -156,7 +153,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
......
...@@ -390,7 +390,7 @@ def execute_samplecode(tfname): ...@@ -390,7 +390,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.
先完成此消息的编辑!
想要评论请 注册