I was puzzled to see that some files and folders are actually ending up in the pyinstaller generated dist folder. For example, the .git in my project root is ending up as dist/Script/mpl-data/.git together with other files from the root directory. Any idea how to prevent that?
The specfile I am using looks like this:
block_cipher = None
a = Analysis(['..\\scripts\\scipt.py'],
pathex=['C:\\Users\\..\\scripts'],
binaries=[],
datas=[...],
hiddenimports=['pkg_resources.py2_warn'],
hookspath=[],
runtime_hooks=[],
excludes=['**/*.git', '**/__cache__', '**/dist', '**/build', '**/InnoSetup'],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='Script',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='Script')
I tried to add the directory names to exclude, but that does not work.
The way I am using pyinstaller is from the root directory of my package.
|-package/__init__.py
| |...
|-specfiles/pyinstaller_specfile.spec
|-scripts/mainscript.py
|-hooks/...
|-setup.py
|...
And I call
pyinstaller --onedir --noconfirm specfiles\pyinstaller_specfile.spec --additional-hooks-dir=hooks