From b9fcbbf86bc71addafc830debe289e7edb2a5697 Mon Sep 17 00:00:00 2001 From: Rok Mandeljc Date: Fri, 19 Feb 2021 10:36:37 +0100 Subject: [PATCH] depend/utils: strip paths from modules collected into base_library.zip (#5564) Strip paths from modules collected into base_library.zip, to enable reproducible builds regardless of python's install location. Fixes #5563. --- PyInstaller/depend/utils.py | 7 ++++++- news/5563.bugfix.rst | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 news/5563.bugfix.rst diff --git a/PyInstaller/depend/utils.py b/PyInstaller/depend/utils.py index 95846f39d5..bb293859cb 100644 --- a/PyInstaller/depend/utils.py +++ b/PyInstaller/depend/utils.py @@ -49,6 +49,10 @@ def create_py3_base_library(libzip_filename, graph): modules is necessary to have on PYTHONPATH for initializing libpython3 in order to run the frozen executable with Python 3. """ + # Import strip_paths_in_code locally to avoid cyclic import between + # building.utils and depend.utils (this module); building.utils + # imports depend.bindepend, which in turn imports depend.utils. + from ..building.utils import strip_paths_in_code # Construct regular expression for matching modules that should be bundled # into base_library.zip. # Excluded are plain 'modules' or 'submodules.ANY_NAME'. @@ -102,7 +106,8 @@ def create_py3_base_library(libzip_filename, graph): fc.write(source_hash) else: fc.write(struct.pack('