Skip to content

Commit 8cf8b69

Browse files
committed
Bundle libmysql.dll in the Windows wheel package
1 parent a8a708f commit 8cf8b69

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

cpyint

lib/cpy_distutils.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,16 +330,23 @@ def _copy_vendor_libraries(self):
330330
if not self.with_mysql_capi or not is_wheel:
331331
return
332332

333+
data_files = []
334+
333335
if os.name == "nt":
334336
openssl_libs = ["ssleay32.dll", "libeay32.dll"]
335337
vendor_folder = ""
336338
mysql_capi = os.path.join(self.with_mysql_capi, "bin")
339+
# Bundle libmysql.dll
340+
src = os.path.join(self.with_mysql_capi, "lib", "libmysql.dll")
341+
dst = os.getcwd()
342+
log.info("copying {0} -> {1}".format(src, dst))
343+
shutil.copy(src, dst)
344+
data_files.append("libmysql.dll")
337345
else:
338346
openssl_libs = self._get_posix_openssl_libs()
339347
vendor_folder = "mysql-vendor"
340348
mysql_capi = os.path.join(self.with_mysql_capi, "lib")
341349

342-
data_files = []
343350
if vendor_folder:
344351
mkpath(os.path.join(os.getcwd(), vendor_folder))
345352

@@ -725,6 +732,10 @@ def _finalize_connector_c(self, connc_loc):
725732
lib_file_path = os.path.join(self.connc_lib, lib_file)
726733
if os.path.isfile(lib_file_path) and not lib_file.endswith('.a'):
727734
os.unlink(os.path.join(self.connc_lib, lib_file))
735+
elif os.name == 'nt':
736+
self.include_dirs.extend([self.connc_include])
737+
self.libraries.extend(['libmysql'])
738+
self.library_dirs.extend([self.connc_lib])
728739

729740
def _finalize_protobuf(self):
730741
if not self.with_protobuf_include_dir:

0 commit comments

Comments
 (0)