Cleanup build.py (#7245)

This commit is contained in:
Changming Sun 2021-04-05 18:49:29 -07:00 committed by GitHub
parent 5bd192c439
commit 2fcd69d644
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,7 +10,6 @@ import re
import shutil
import subprocess
import sys
import hashlib
import platform
from amd_hipify import amd_hipify
from distutils.version import LooseVersion
@ -569,34 +568,7 @@ def install_python_deps(numpy_version=""):
dep_packages.append('sympy>=1.1')
dep_packages.append('packaging')
dep_packages.append('cerberus')
run_subprocess([sys.executable, '-m', 'pip', 'install', '--trusted-host',
'files.pythonhosted.org'] + dep_packages)
# We need to install Torch to test certain functionalities of the ORT Python package
def install_torch():
# Command works for both Windows
run_subprocess([sys.executable, '-m', 'pip', 'install', '--trusted-host',
'files.pythonhosted.org', 'torch===1.5.1+cu101', 'torchvision===0.6.1+cu101',
'-f', 'https://download.pytorch.org/whl/torch_stable.html'])
def check_md5(filename, expected_md5):
if not os.path.exists(filename):
return False
hash_md5 = hashlib.md5()
BLOCKSIZE = 1024 * 64
with open(filename, "rb") as f:
buf = f.read(BLOCKSIZE)
while len(buf) > 0:
hash_md5.update(buf)
buf = f.read(BLOCKSIZE)
hex = hash_md5.hexdigest()
if hex != expected_md5:
log.info('md5 mismatch, expect %s, got %s' % (expected_md5, hex))
os.remove(filename)
return False
return True
run_subprocess([sys.executable, '-m', 'pip', 'install'] + dep_packages)
def setup_test_data(build_dir, configs):