Skip to content

Commit

Permalink
building: add_suffix_to_extensions: avoid reprocessing entries
Browse files Browse the repository at this point in the history
Detect if EXTENSION entry has already been processed and avoid
processing it again, which would mangle the filename due to
replacement of dots in suffix with os.sep (resulting in pyinstaller#5851).
  • Loading branch information
rokm committed May 20, 2021
1 parent f712244 commit 1dbd019
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions PyInstaller/building/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ def add_suffix_to_extensions(toc):
new_toc = TOC()
for inm, fnm, typ in toc:
if typ == 'EXTENSION':
if fnm.endswith(inm):
# If inm completely fits into end of the fnm, it has
# already been processed
new_toc.append((inm, fnm, typ))
continue
# Check if the extension entry has already been processed.
# This should be reliably indicated by presence of os.sep
# in the inm... Unless
# Change the dotted name into a relative path. This places C
# extensions in the Python-standard location.
inm = inm.replace('.', os.sep)
Expand Down

0 comments on commit 1dbd019

Please sign in to comment.