diff --git a/build_tools/github/vendor.py b/build_tools/github/vendor.py index bbc941d8f25f7..c93d1e9055490 100644 --- a/build_tools/github/vendor.py +++ b/build_tools/github/vendor.py @@ -17,6 +17,7 @@ VCOMP140_SRC_PATH = "C:\\Windows\\System32\\vcomp140.dll" VCRUNTIME140_SRC_PATH = "C:\\Windows\\System32\\vcruntime140.dll" VCRUNTIME140_1_SRC_PATH = "C:\\Windows\\System32\\vcruntime140_1.dll" +MSVCP140_SRC_PATH = "C:\\Windows\\System32\\msvcp140.dll" def make_distributor_init_32_bits( @@ -65,12 +66,13 @@ def make_distributor_init_64_bits( vcomp140_dll_filename, vcruntime140_dll_filename, vcruntime140_1_dll_filename, + msvcp140_dll_filename, ): """Create a _distributor_init.py file for 64-bit architectures. This file is imported first when importing the sklearn package - so as to pre-load the vendored vcomp140.dll, vcruntime140.dll - and vcruntime140_1.dll. + so as to pre-load the vendored vcomp140.dll, vcruntime140.dll, + vcruntime140_1.dll and msvcp140.dll. """ with open(distributor_init, "wt") as f: f.write( @@ -97,13 +99,16 @@ def make_distributor_init_64_bits( vcomp140_dll_filename = op.join(libs_path, "{0}") vcruntime140_dll_filename = op.join(libs_path, "{1}") vcruntime140_1_dll_filename = op.join(libs_path, "{2}") + msvcp140_dll_filename = op.join(libs_path, "{3}") WinDLL(op.abspath(vcomp140_dll_filename)) WinDLL(op.abspath(vcruntime140_dll_filename)) WinDLL(op.abspath(vcruntime140_1_dll_filename)) + WinDLL(op.abspath(msvcp140_dll_filename)) """.format( vcomp140_dll_filename, vcruntime140_dll_filename, vcruntime140_1_dll_filename, + msvcp140_dll_filename, ) ) ) @@ -120,12 +125,16 @@ def main(wheel_dirname, bitness): if not op.exists(VCRUNTIME140_1_SRC_PATH) and bitness == "64": raise ValueError(f"Could not find {VCRUNTIME140_1_SRC_PATH}.") + if not op.exists(MSVCP140_SRC_PATH) and bitness == "64": + raise ValueError(f"Could not find {MSVCP140_SRC_PATH}.") + if not op.isdir(wheel_dirname): raise RuntimeError(f"Could not find {wheel_dirname} file.") vcomp140_dll_filename = op.basename(VCOMP140_SRC_PATH) vcruntime140_dll_filename = op.basename(VCRUNTIME140_SRC_PATH) vcruntime140_1_dll_filename = op.basename(VCRUNTIME140_1_SRC_PATH) + msvcp140_dll_filename = op.basename(MSVCP140_SRC_PATH) target_folder = op.join(wheel_dirname, TARGET_FOLDER) distributor_init = op.join(wheel_dirname, DISTRIBUTOR_INIT) @@ -144,6 +153,9 @@ def main(wheel_dirname, bitness): print(f"Copying {VCRUNTIME140_1_SRC_PATH} to {target_folder}.") shutil.copy2(VCRUNTIME140_1_SRC_PATH, target_folder) + print(f"Copying {MSVCP140_SRC_PATH} to {target_folder}.") + shutil.copy2(MSVCP140_SRC_PATH, target_folder) + # Generate the _distributor_init file in the source tree print("Generating the '_distributor_init.py' file.") if bitness == "32": @@ -156,6 +168,7 @@ def main(wheel_dirname, bitness): vcomp140_dll_filename, vcruntime140_dll_filename, vcruntime140_1_dll_filename, + msvcp140_dll_filename, )