xgboost/tests/ci_build/insert_vcomp140.py
Jiaming Yuan 651c4ac03b
[CI] Fix CI/CD pipeline broken by latest auditwheel (4.0.0) (#6951) (#6952)
Co-authored-by: Philip Hyunsu Cho <chohyu01@cs.washington.edu>
2021-05-11 20:45:04 +08:00

19 lines
505 B
Python

import sys
import re
import zipfile
import glob
if len(sys.argv) != 2:
print('Usage: {} [wheel]'.format(sys.argv[0]))
sys.exit(1)
vcomp140_path = 'C:\\Windows\\System32\\vcomp140.dll'
for wheel_path in sorted(glob.glob(sys.argv[1])):
m = re.search(r'xgboost-(.*)-py3', wheel_path)
assert m, f'wheel_path = {wheel_path}'
version = m.group(1)
with zipfile.ZipFile(wheel_path, 'a') as f:
f.write(vcomp140_path, 'xgboost-{}.data/data/xgboost/vcomp140.dll'.format(version))