Skip to content

Commit dc4db59

Browse files
committed
Add link libraries directories
1 parent 730f589 commit dc4db59

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

lib/cpy_distutils.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,7 @@ def _get_posix_openssl_libs(self):
389389
return openssl_libs
390390

391391
def _copy_vendor_libraries(self):
392-
is_wheel = getattr(self.distribution.get_command_obj("install"),
393-
"is_wheel", False)
394-
if not self.with_mysql_capi or not is_wheel:
392+
if not self.with_mysql_capi:
395393
return
396394

397395
log.info("Copying vendor files")
@@ -671,6 +669,13 @@ def fix_compiler(self):
671669
if self.extra_link_args and ext.name == "_mysql_connector":
672670
extra_link_args = self.extra_link_args.split()
673671
if platform.system() == "Linux":
672+
mysql_config = self.with_mysql_capi \
673+
if not os.path.isdir(self.with_mysql_capi) \
674+
else os.path.join(self.with_mysql_capi, "bin", "mysql_config")
675+
mysql_info = mysql_c_api_info(mysql_config)
676+
extra_link_args.extend(
677+
["-L{0}".format(lib)
678+
for lib in mysql_info["link_directories"]])
674679
extra_link_args += ["-Wl,-rpath,$ORIGIN/mysql-vendor"]
675680
ext.extra_link_args.extend(extra_link_args)
676681
# Add system headers

unittests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ def main():
849849
options.extra_compile_args,
850850
options.extra_link_args, options.debug)
851851

852-
if platform.system() == "Darwin" and tests.MYSQL_VERSION > (8, 0, 5):
852+
if platform.system() in ("Darwin", "Linux") and tests.MYSQL_VERSION > (8, 0, 5):
853853
shutil.copytree(os.path.join(_TOPDIR, "mysql-vendor"),
854854
os.path.join(tests.TEST_BUILD_DIR, "mysql-vendor"))
855855

0 commit comments

Comments
 (0)