diff --git a/PyInstaller/depend/analysis.py b/PyInstaller/depend/analysis.py index b5ee339f5a..a3a15a8692 100644 --- a/PyInstaller/depend/analysis.py +++ b/PyInstaller/depend/analysis.py @@ -918,7 +918,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'), diff --git a/news/5851.bugfix.rst b/news/5851.bugfix.rst new file mode 100644 index 0000000000..c73134768a --- /dev/null +++ b/news/5851.bugfix.rst @@ -0,0 +1,2 @@ +Fix collection of duplicated ``_struct`` and ``zlib`` extension modules +with mangled filenames.