diff --git a/PyInstaller/archive/writers.py b/PyInstaller/archive/writers.py index b7b1af2ee3f..258cf606646 100644 --- a/PyInstaller/archive/writers.py +++ b/PyInstaller/archive/writers.py @@ -35,7 +35,7 @@ fake_pyc_timestamp from PyInstaller.loader.pyimod02_archive import PYZ_TYPE_MODULE, PYZ_TYPE_PKG, \ PYZ_TYPE_DATA, PYZ_TYPE_NSPKG -from ..compat import BYTECODE_MAGIC, is_py37 +from ..compat import BYTECODE_MAGIC, is_py37, is_win class ArchiveWriter(object): @@ -283,6 +283,10 @@ def add(self, dpos, dlen, ulen, flag, typcd, nm): # slashes '\\' since on Windows the bootloader works only with back # slashes. nm = os.path.normpath(nm) + if is_win and os.path.sep == '/': + # When building under MSYS, the above path normalization + # uses Unix-style separators, so replace them manually. + nm = nm.replace(os.path.sep, '\\') self.data.append((dpos, dlen, ulen, flag, typcd, nm))