mirror of
https://github.com/vale981/ray
synced 2025-03-06 02:21:39 -05:00
add msvcp140.dll to the wheel on windows (#19062)
* add msvcp140.dll to the wheel on windows * fixes from review * be more verbose * Update setup.py Co-authored-by: Philipp Moritz <pcmoritz@gmail.com>
This commit is contained in:
parent
5d9e3a0121
commit
63dd22c7c2
1 changed files with 20 additions and 0 deletions
|
@ -539,6 +539,19 @@ def copy_file(target_dir, filename, rootdir):
|
|||
return 0
|
||||
|
||||
|
||||
def add_system_dlls(dlls, target_dir):
|
||||
"""
|
||||
Copy any required dlls required by the c-extension module and not already
|
||||
provided by python. They will end up in the wheel next to the c-extension
|
||||
module which will guarentee they are available at runtime.
|
||||
"""
|
||||
for dll in dlls:
|
||||
# Installing Visual Studio will copy the runtime dlls to system32
|
||||
src = os.path.join(r"c:\Windows\system32", dll)
|
||||
assert os.path.exists(src)
|
||||
shutil.copy(src, target_dir)
|
||||
|
||||
|
||||
def pip_run(build_ext):
|
||||
build(True, BUILD_JAVA, True)
|
||||
|
||||
|
@ -563,6 +576,13 @@ def pip_run(build_ext):
|
|||
copied_files = 0
|
||||
for filename in setup_spec.files_to_include:
|
||||
copied_files += copy_file(build_ext.build_lib, filename, ROOT_DIR)
|
||||
if sys.platform == "win32":
|
||||
# _raylet.pyd links to some MSVC runtime DLLS, this one may not be
|
||||
# present on a user's machine. While vcruntime140.dll and
|
||||
# vcruntime140_1.dll are also required, they are provided by CPython.
|
||||
runtime_dlls = ["msvcp140.dll"]
|
||||
add_system_dlls(runtime_dlls, os.path.join(build_ext.build_lib, "ray"))
|
||||
copied_files += len(runtime_dlls)
|
||||
print("# of files copied to {}: {}".format(build_ext.build_lib,
|
||||
copied_files))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue