From e1a7513ea56d4884e84be774561bf03502e1ce7f Mon Sep 17 00:00:00 2001 From: liupx1988 Date: Wed, 12 Aug 2020 09:58:56 +0800 Subject: [PATCH 1/7] Add pyav hooks pyav uses a cython module which imports sub-modules. These are not normally detected by pyinstaller. This hook uses collect_submodules to add the missing modules as hidden imports. --- .../hooks/stdhooks/hook-av.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-av.py diff --git a/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-av.py b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-av.py new file mode 100644 index 00000000..5472638c --- /dev/null +++ b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-av.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 = ['fractions'] + collect_submodules("av") \ No newline at end of file From 240be833ce3eda00d090d57afc8342611123c182 Mon Sep 17 00:00:00 2001 From: liupx1988 Date: Wed, 12 Aug 2020 10:10:58 +0800 Subject: [PATCH 2/7] Add pyav hooks #29 pyav uses a cython module which imports sub-modules. These are not normally detected by pyinstaller. This hook uses collect_submodules to add the missing modules as hidden imports. --- news/29.new.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/29.new.rst diff --git a/news/29.new.rst b/news/29.new.rst new file mode 100644 index 00000000..1b8f831a --- /dev/null +++ b/news/29.new.rst @@ -0,0 +1 @@ +Add a hook for ``pyav(av)`` which has hidden imports. From 56183ebcd78630d33188f70c23e59c991b5f2ec7 Mon Sep 17 00:00:00 2001 From: liupx1988 Date: Wed, 12 Aug 2020 10:14:34 +0800 Subject: [PATCH 3/7] add newline at end of file --- src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-av.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-av.py b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-av.py index 5472638c..493c353e 100644 --- a/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-av.py +++ b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-av.py @@ -11,4 +11,4 @@ # ------------------------------------------------------------------ from PyInstaller.utils.hooks import collect_submodules -hiddenimports = ['fractions'] + collect_submodules("av") \ No newline at end of file +hiddenimports = ['fractions'] + collect_submodules("av") From 97a036fcc561a0e66eda32078cc6e650a4d2c733 Mon Sep 17 00:00:00 2001 From: liupx1988 Date: Wed, 12 Aug 2020 11:15:37 +0800 Subject: [PATCH 4/7] Add test for av(pyav) --- requirements-test.txt | 1 + src/_pyinstaller_hooks_contrib/tests/test_libraries.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/requirements-test.txt b/requirements-test.txt index 162af11b..dacdf68d 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -31,6 +31,7 @@ pyzmq==19.0.0 Unidecode==1.1.1 zeep==3.4.0 sentry-sdk==0.15.1 +av==8.0.2 # ------------------- Python Version/Platform (OS) specifics # These libraries only support python above 3.5 diff --git a/src/_pyinstaller_hooks_contrib/tests/test_libraries.py b/src/_pyinstaller_hooks_contrib/tests/test_libraries.py index 4e8eecb8..f6e66b2d 100644 --- a/src/_pyinstaller_hooks_contrib/tests/test_libraries.py +++ b/src/_pyinstaller_hooks_contrib/tests/test_libraries.py @@ -303,3 +303,10 @@ def test_iminuit(pyi_builder): pyi_builder.test_source(""" from iminuit import Minuit """) + + +@importorskip('av') +def test_iminuit(pyi_builder): + pyi_builder.test_source(""" + import av + """) \ No newline at end of file From 496afd8a79e28625101720b069ee555890b3d21a Mon Sep 17 00:00:00 2001 From: liupx1988 Date: Wed, 12 Aug 2020 11:17:21 +0800 Subject: [PATCH 5/7] add new line at end of file --- src/_pyinstaller_hooks_contrib/tests/test_libraries.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/_pyinstaller_hooks_contrib/tests/test_libraries.py b/src/_pyinstaller_hooks_contrib/tests/test_libraries.py index f6e66b2d..da13b8b6 100644 --- a/src/_pyinstaller_hooks_contrib/tests/test_libraries.py +++ b/src/_pyinstaller_hooks_contrib/tests/test_libraries.py @@ -309,4 +309,6 @@ def test_iminuit(pyi_builder): def test_iminuit(pyi_builder): pyi_builder.test_source(""" import av - """) \ No newline at end of file + """) + + \ No newline at end of file From a9bde86d36089090de9b11965a931c5e2bc44b5c Mon Sep 17 00:00:00 2001 From: liupx1988 Date: Wed, 12 Aug 2020 11:19:55 +0800 Subject: [PATCH 6/7] remove extra blanks --- src/_pyinstaller_hooks_contrib/tests/test_libraries.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/_pyinstaller_hooks_contrib/tests/test_libraries.py b/src/_pyinstaller_hooks_contrib/tests/test_libraries.py index da13b8b6..13b4bc1d 100644 --- a/src/_pyinstaller_hooks_contrib/tests/test_libraries.py +++ b/src/_pyinstaller_hooks_contrib/tests/test_libraries.py @@ -310,5 +310,3 @@ def test_iminuit(pyi_builder): pyi_builder.test_source(""" import av """) - - \ No newline at end of file From c361ffbafbdac55bd50eb1de77c40da1d6c34954 Mon Sep 17 00:00:00 2001 From: liupx1988 Date: Wed, 12 Aug 2020 11:23:11 +0800 Subject: [PATCH 7/7] fix duplicate func name --- src/_pyinstaller_hooks_contrib/tests/test_libraries.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pyinstaller_hooks_contrib/tests/test_libraries.py b/src/_pyinstaller_hooks_contrib/tests/test_libraries.py index 13b4bc1d..591835a8 100644 --- a/src/_pyinstaller_hooks_contrib/tests/test_libraries.py +++ b/src/_pyinstaller_hooks_contrib/tests/test_libraries.py @@ -306,7 +306,7 @@ def test_iminuit(pyi_builder): @importorskip('av') -def test_iminuit(pyi_builder): +def test_av(pyi_builder): pyi_builder.test_source(""" import av """)