diff --git a/news/426.update.rst b/news/426.update.rst new file mode 100644 index 00000000..6b3c0ac3 --- /dev/null +++ b/news/426.update.rst @@ -0,0 +1,3 @@ +Update ``mariadb`` hook to always include the ``decimal`` module as a +hidden import, instead of implicitly relying on it being picked up due +to import in some other, unrelated module. diff --git a/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-mariadb.py b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-mariadb.py index 2b978b34..328d66d1 100644 --- a/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-mariadb.py +++ b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-mariadb.py @@ -10,11 +10,9 @@ # SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------ - -from PyInstaller.compat import is_py38 - - -# The MariaDB uses a .pyd file and uses import within its __init__.py -# The decimal import seems to be hidden in Python version 3.7 and older -if not is_py38: - hiddenimports = ['decimal'] +# The MariaDB uses a .pyd file that imports ``decimal`` module within its +# module initialization function. On recent python versions (> 3.8), the decimal +# module seems to be picked up nevertheless (presumably due to import in some +# other module), but it is better not to rely on that, and ensure it is always +# collected as a hidden import. +hiddenimports = ['decimal']