From 82b84ad8eccad11e16da00ffeec1f4445046c44d Mon Sep 17 00:00:00 2001 From: Rok Mandeljc Date: Fri, 12 Mar 2021 13:53:34 +0100 Subject: [PATCH] hooks: pandas: update for compatibility with pandas 1.2.0 and later Pandas 1.2.0 and later require hidden import of cmath on linux and macOS. --- PyInstaller/hooks/hook-pandas.py | 8 +++++++- news/5630.hooks.rst | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 news/5630.hooks.rst diff --git a/PyInstaller/hooks/hook-pandas.py b/PyInstaller/hooks/hook-pandas.py index 22d76b8b3a..a130977782 100644 --- a/PyInstaller/hooks/hook-pandas.py +++ b/PyInstaller/hooks/hook-pandas.py @@ -9,7 +9,13 @@ # SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception) #----------------------------------------------------------------------------- -from PyInstaller.utils.hooks import collect_submodules +from PyInstaller.utils.hooks import collect_submodules, is_module_satisfies # Pandas keeps Python extensions loaded with dynamic imports here. hiddenimports = collect_submodules('pandas._libs') + +# Pandas 1.2.0 and later require cmath hidden import on linux and macOS. +# On Windows, this is not strictly required, but we add it anyway to keep +# things simple (and future-proof). +if is_module_satisfies('pandas >= 1.2.0'): + hiddenimports += ['cmath'] diff --git a/news/5630.hooks.rst b/news/5630.hooks.rst new file mode 100644 index 0000000000..30503c131b --- /dev/null +++ b/news/5630.hooks.rst @@ -0,0 +1 @@ +Update ``pandas`` hook for compatibility with version 1.2.0 and later.