|
33 | 33 | import platform
|
34 | 34 | import shutil
|
35 | 35 | import sys
|
36 |
| -import tempfile |
37 | 36 |
|
38 | 37 | from glob import glob
|
39 | 38 | from pathlib import Path
|
40 |
| -from subprocess import PIPE, Popen, check_call |
| 39 | +from subprocess import PIPE, Popen |
41 | 40 | from sysconfig import get_config_vars, get_python_version
|
42 | 41 |
|
43 | 42 | from setuptools import Command
|
|
111 | 110 | LOGGER.addHandler(handler)
|
112 | 111 | LOGGER.setLevel(logging.WARNING)
|
113 | 112 |
|
| 113 | +SASL_WIN_LIBS = [ |
| 114 | + "libsasl.dll", |
| 115 | + "k5sprt64.dll", |
| 116 | + "comerr64.dll", |
| 117 | + "xpprof64.dll", |
| 118 | + "krbcc64.dll", |
| 119 | + "gssapi64.dll", |
| 120 | + "krb5_64.dll", |
| 121 | +] |
| 122 | + |
| 123 | +SASL_WIN_LIBS_AUTH_METHODS = ["saslSCRAM.dll", "saslGSSAPI.dll"] |
| 124 | + |
114 | 125 |
|
115 | 126 | def get_otel_src_package_data():
|
116 | 127 | """Get a list including all py.typed and dist-info files corresponding
|
@@ -390,9 +401,36 @@ def _copy_vendor_libraries(self):
|
390 | 401 | site_packages_files.append(
|
391 | 402 | os.path.join(self.with_mysql_capi, "lib", "libmysql.dll")
|
392 | 403 | )
|
| 404 | + |
| 405 | + # `SASL_WIN_LIBS` are loaded automatically as dependency of |
| 406 | + # authentication_ldap_sasl_client.dll. On Windows, they are expected to be |
| 407 | + # at `lib/site-packages` - next to `_mysql_connector`. |
| 408 | + sasl_dll_paths = [ |
| 409 | + os.path.join(self.with_mysql_capi, "bin", dll) for dll in SASL_WIN_LIBS |
| 410 | + ] |
| 411 | + site_packages_files.extend( |
| 412 | + [path for path in sasl_dll_paths if os.path.exists(path)] |
| 413 | + ) |
| 414 | + |
393 | 415 | self.distribution.data_files = [
|
394 | 416 | ("lib\\site-packages\\", site_packages_files)
|
395 | 417 | ]
|
| 418 | + |
| 419 | + # Also, we need to include the DLLs corresponding to the |
| 420 | + # SASL authorization methods. |
| 421 | + sasl_dll_auth_method_paths = [ |
| 422 | + os.path.join(self.with_mysql_capi, "bin", "sasl2", dll) |
| 423 | + for dll in SASL_WIN_LIBS_AUTH_METHODS |
| 424 | + if os.path.exists( |
| 425 | + os.path.join(self.with_mysql_capi, "bin", "sasl2", dll) |
| 426 | + ) |
| 427 | + ] |
| 428 | + |
| 429 | + if sasl_dll_auth_method_paths: |
| 430 | + self.distribution.data_files.append( |
| 431 | + ("lib\\site-packages\\sasl2", sasl_dll_auth_method_paths) |
| 432 | + ) |
| 433 | + |
396 | 434 | self.log.debug("# site_packages_files: %s", self.distribution.data_files)
|
397 | 435 | elif bundle_plugin_libs:
|
398 | 436 | # Bundle SASL libs
|
|
0 commit comments