Skip to content

Commit

Permalink
hooks: setuptools: avoid recursing into vendored pyparsing.diagram
Browse files Browse the repository at this point in the history
When collecting submodules from `setuptools._vendor`, avoid
recursing into `setuptools._vendor.pyparsing.diagram`, which is
usually unimportable and this generates a warning.
  • Loading branch information
rokm committed Sep 7, 2022
1 parent f93dd3f commit b80740e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion PyInstaller/hooks/hook-setuptools.py
Expand Up @@ -25,7 +25,13 @@
# setuptools >= 39.0.0 is "vendoring" its own direct dependencies from "_vendor" to "extern". This also requires
# 'pre_safe_import_module/hook-setuptools.extern.six.moves.py' to make the moves defined in 'setuptools._vendor.six'
# importable under 'setuptools.extern.six'.
hiddenimports.extend(collect_submodules('setuptools._vendor'))
_excluded_submodules = (
# Prevent recursing into setuptools._vendor.pyparsing.diagram, which typically fails to be imported due to
# missing dependencies (railroad, pyparsing (?), jinja2) and generates a warning... As the module is usually
# unimportable, it is likely not to be used by setuptools.
'setuptools._vendor.pyparsing.diagram',
)
hiddenimports.extend(collect_submodules('setuptools._vendor', filter=lambda name: name not in _excluded_submodules))

# As of setuptools >= 60.0, we need to collect the vendored version of distutils via hiddenimports. The corresponding
# pyi_rth_setuptools runtime hook ensures that the _distutils_hack is installed at the program startup, which allows
Expand Down

0 comments on commit b80740e

Please sign in to comment.