diff --git a/news/287.new.rst b/news/287.new.rst new file mode 100644 index 00000000..038e6b54 --- /dev/null +++ b/news/287.new.rst @@ -0,0 +1 @@ +Add a hook for `pynput` to collect hidden imports. diff --git a/requirements-test-libraries.txt b/requirements-test-libraries.txt index 40f377c6..f4a38e37 100644 --- a/requirements-test-libraries.txt +++ b/requirements-test-libraries.txt @@ -28,6 +28,7 @@ pycryptodomex==3.9.7 pyexcelerate==0.8.0 pylint==2.4.4 pyusb==1.0.2 +pynput==1.7.3 pyzmq==22.0.3 sentry-sdk==0.19.3 # shotgun_api3 can only be installed from git diff --git a/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-pynput.py b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-pynput.py new file mode 100644 index 00000000..84aad128 --- /dev/null +++ b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-pynput.py @@ -0,0 +1,14 @@ +# ------------------------------------------------------------------ +# Copyright (c) 2020 PyInstaller Development Team. +# +# This file is distributed under the terms of the GNU General Public +# License (version 2.0 or later). +# +# The full license is available in LICENSE.GPL.txt, distributed with +# this software. +# +# SPDX-License-Identifier: GPL-2.0-or-later +# ------------------------------------------------------------------ + +from PyInstaller.utils.hooks import collect_submodules +hiddenimports = collect_submodules("pynput") diff --git a/src/_pyinstaller_hooks_contrib/tests/test_libraries.py b/src/_pyinstaller_hooks_contrib/tests/test_libraries.py index 75eb2d2b..8f43f98b 100644 --- a/src/_pyinstaller_hooks_contrib/tests/test_libraries.py +++ b/src/_pyinstaller_hooks_contrib/tests/test_libraries.py @@ -657,3 +657,10 @@ def test_mnemonic(pyi_builder): import mnemonic mnemonic.Mnemonic("english") """) + + +@importorskip('pynput') +def test_pynput(pyi_builder): + pyi_builder.test_source(""" + import pynput + """)