Skip to content

Commit

Permalink
depend: get_bootstrap_modules: divert extensions into lib-dynload
Browse files Browse the repository at this point in the history
Divert extensions, included by get_bootstrap_modules() (_struct,
zlib) into lib-dynload directory if applicable, to match the
behavior introduced in pyinstaller#5604. This prevents unused duplicates of
_struct and zlib extensions and fixed 5851.
  • Loading branch information
rokm committed May 20, 2021
1 parent 1dbd019 commit f2e1655
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion PyInstaller/depend/analysis.py
Expand Up @@ -840,7 +840,12 @@ def get_bootstrap_modules():
for mod_name in ['_struct', 'zlib']:
mod = __import__(mod_name) # C extension.
if hasattr(mod, '__file__'):
loader_mods.append((mod_name, os.path.abspath(mod.__file__), 'EXTENSION'))
mod_file = os.path.abspath(mod.__file__)
if os.path.basename(os.path.dirname(mod_file)) == 'lib-dynload':
# Divert extensions originating from python's lib-dynload
# directory, to match behavior of #5604.
mod_name = os.path.join('lib-dynload', mod_name)
loader_mods.append((mod_name, mod_file, 'EXTENSION'))
# NOTE:These modules should be kept simple without any complicated dependencies.
loader_mods +=[
('struct', os.path.abspath(mod_struct.__file__), 'PYMODULE'),
Expand Down
2 changes: 2 additions & 0 deletions news/5851.bugfix.rst
@@ -0,0 +1,2 @@
Fix collection of duplicated ``_struct`` and ``zlib`` extension modules
with mangled filenames.

0 comments on commit f2e1655

Please sign in to comment.