Skip to content

Commit 396fb25

Browse files
committed
WL#16452: Bundle all installable authentication plugins when building the C-extension
The aim of this WorkLog is to bundle all of the authentication client plugins while building the C-extension of Connector/Python for both WHL and RPM package types. Change-Id: I8751b1f09db31ef87bf56526b3eb5dba39b69cd0
1 parent b5455e0 commit 396fb25

File tree

3 files changed

+31
-10
lines changed

3 files changed

+31
-10
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Full release notes:
1111
v9.1.0
1212
======
1313

14+
- WL#16452: Bundle all installable authentication plugins when building the C-extension
1415
- WL#16444: Drop build support for DEB packages
1516
- WL#16442: Upgrade gssapi version to 1.8.3
1617
- WL#16411: Improve wheel metadata information for Classic and XDevAPI connectors

mysql-connector-python/cpydist/__init__.py

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,39 @@ def _copy_vendor_libraries(self):
277277
bundle_plugin_libs = False
278278
if self.with_mysql_capi:
279279
plugin_ext = "dll" if os.name == "nt" else "so"
280-
plugin_path = os.path.join(self.with_mysql_capi, "lib", "plugin")
280+
expected_plugin_paths = [
281+
("lib", "plugin"),
282+
("lib", "mysql", "plugin"),
283+
("lib64", "mysql", "plugin"),
284+
]
285+
plugin_path = ""
286+
for path in expected_plugin_paths:
287+
plugin_path = os.path.join(self.with_mysql_capi, *path)
288+
if os.path.exists(plugin_path):
289+
self.log.info("plugin_path is set as : %s", plugin_path)
290+
break
291+
plugin_path = ""
292+
293+
if not len(plugin_path):
294+
searched_paths = ",".join(["/".join(p) for p in expected_plugin_paths])
295+
self.log.error(
296+
"None of the expected authentication plugins directories exist : %s",
297+
searched_paths,
298+
)
299+
raise FileNotFoundError(
300+
f"None of the expected authentication plugins directories exist : {searched_paths}"
301+
)
302+
281303
plugin_list = [
282304
("LDAP", f"authentication_ldap_sasl_client.{plugin_ext}"),
283305
("Kerberos", f"authentication_kerberos_client.{plugin_ext}"),
284306
("OCI IAM", f"authentication_oci_client.{plugin_ext}"),
285307
("WebAuthn", f"authentication_webauthn_client.{plugin_ext}"),
308+
(
309+
"OpenID Connect",
310+
f"authentication_openid_connect_client.{plugin_ext}",
311+
),
312+
("MySQL Native", f"mysql_native_password.{plugin_ext}"),
286313
]
287314

288315
for plugin_name, plugin_file in plugin_list:
@@ -315,7 +342,7 @@ def _copy_vendor_libraries(self):
315342
os.path.join(openssl_libs_path, "bin")
316343
):
317344
openssl_libs_path = os.path.join(openssl_libs_path, "bin")
318-
self.log.info("# openssl_libs_path: %s", openssl_libs_path)
345+
print("# openssl_libs_path: %s", openssl_libs_path)
319346
else:
320347
openssl_libs_path = os.path.join(self.with_mysql_capi, "bin")
321348
libssl, libcrypto = self._get_openssl_libs(openssl_libs_path, "dll")

mysql-connector-python/cpydist/data/rpm/mysql-connector-python.spec

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
%global with_openssl_opts ""
4646

4747
%if 0%{?openssl_include_dir:1}
48-
%global with_openssl_opts --with-openssl-include-dir=%{openssl_include_dir} --with-openssl-lib-dir=%{openssl_lib_dir}}
48+
%global with_openssl_opts --with-openssl-include-dir=%{openssl_include_dir} --with-openssl-lib-dir=%{openssl_lib_dir}
4949
%endif
5050

5151
# if true set byte_code_only to --byte_code_only
@@ -144,7 +144,6 @@ COMMON_INSTALL_ARGS="\
144144
--prefix=%{_prefix} \
145145
--root=%{buildroot} \
146146
%{with_openssl_opts} \
147-
--skip-vendor \
148147
"
149148
150149
%if 0%{?extra_compile_args:1}
@@ -161,12 +160,6 @@ EXTRA_LINK_ARGS=""
161160
162161
rm -rf %{buildroot}
163162
164-
# The LDAP client plugin from the Server is bundled if it exists under
165-
# 'with_mysql_capi'. For RPM builds we don't want to bundle, instead
166-
# we want to depend on the MySQL Server "client-plugins" RPM package.
167-
# Remove the plugin to force the build not to bundle.
168-
rm -f %{with_mysql_capi}/lib*/{,mysql/}plugin/authentication_ldap_sasl_client.*
169-
170163
cd mysql-connector-python
171164
%{__python3} setup.py ${COMMON_INSTALL_ARGS} \
172165
--extra-compile-args="${EXTRA_COMPILE_ARGS}" \

0 commit comments

Comments
 (0)