Skip to content

Commit 6d9f5c5

Browse files
committed
hooks: add hook for backports namespace package
Add hook for `backports` package, to accommodate the `pkgutil`-style `backports` namespace package provided by `backports.functools-lru-cache` and the latest release of `backports.tarfile`. The `__init__.py` file from this `backports` namespace package uses `__import('pkgutil')__`, which slips past PyInstaller's modulegraph analysis, hence we need a hidden import.
1 parent 485ce07 commit 6d9f5c5

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

news/735.new.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Add hook for ``backports`` package, to accommodate the ``pkgutil``-style
2+
``backports`` namespace package provided by ``backports.functools-lru-cache``
3+
and the latest release of ``backports.tarfile``.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# ------------------------------------------------------------------
2+
# Copyright (c) 2024 PyInstaller Development Team.
3+
#
4+
# This file is distributed under the terms of the GNU General Public
5+
# License (version 2.0 or later).
6+
#
7+
# The full license is available in LICENSE.GPL.txt, distributed with
8+
# this software.
9+
#
10+
# SPDX-License-Identifier: GPL-2.0-or-later
11+
# ------------------------------------------------------------------
12+
13+
# Some of jaraco's backports packages (backports.functools-lru-cache, backports.tarfile) use pkgutil-style `backports`
14+
# namespace package, with `__init__.py` file that contains:
15+
#
16+
# __path__ = __import__('pkgutil').extend_path(__path__, __name__)
17+
#
18+
# This import via `__import__` function slips past PyInstaller's modulegraph analysis; so add a hidden import, in case
19+
# the user's program (and its dependencies) have no other direct imports of `pkgutil`.
20+
hiddenimports = ['pkgutil']

0 commit comments

Comments
 (0)