pyinstaller / pyinstaller/pyinstaller
Use script name instead of project name for xref and dot files
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13.1k
- Forks
- 2k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 11
Description
Is your feature request related to a problem? Please describe.
When building multiple package bundle (MERGE) pyinstaller overwrites the xref and dot files, making it harder on the user/developer to analyze build problems.
Describe the solution you'd like
PyInstaller should use the pattern build/{project}/xref-{script}.html instead of build/{project}/xref-{project}.html and do the same for the dot file so they don't get overwritten by Analysis calls.
Describe alternatives you've considered
Manually rename xref and dot files after each Analysis step.
Additional context
The following spec file will create sample files in the current directory and use MERGE to merge dependencies. It will also make a copy and print out the crc32 checksum of the xref files generated during the build.
Run with pyinstaller --log-level=WARN --noconfirm --noupx complex.spec for clarity/speed.
# -*- mode: python ; coding: utf-8 -*-
from PyInstaller.config import CONF
import binascii
import os
with open("complex.py", "w") as f:
f.write("""
from jsonschema import Draft7Validator
print(Draft7Validator)
""")
with open("simple.py", "w") as f:
f.write("""
import os
print("current working directory is", os.getcwd())
""")
block_cipher = None
a1 = Analysis(['complex.py'],
pathex=['.'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
with open(CONF['xref-file'], "rb") as f:
print(f"{CONF['xref-file']} crc32:", binascii.crc32(f.read()) & 0xffffffff)
import shutil
shutil.copy(CONF['xref-file'], CONF['xref-file'] + "_complex.html")
a2 = Analysis(['simple.py'],
pathex=['C:\\Code\\xrefbug'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
with open(CONF['xref-file'], "rb") as f:
print(f"{CONF['xref-file']} crc32:", binascii.crc32(f.read()) & 0xffffffff)
shutil.copy(CONF['xref-file'], CONF['xref-file'] + "_simple.html")
MERGE(
(a1, 'complex', 'complex'),
(a2, 'simple', 'simple')
)
pyz1 = PYZ(a1.pure, a1.zipped_data,
cipher=block_cipher)
exe1 = EXE(pyz1,
a1.scripts,
[],
exclude_binaries=True,
name='complex',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=False,
console=True )
coll1 = COLLECT(exe1,
a1.binaries,
a1.zipfiles,
a1.datas,
strip=False,
upx=False,
upx_exclude=[],
name='complex')
pyz2 = PYZ(a2.pure, a2.zipped_data,
cipher=block_cipher)
exe2 = EXE(pyz2,
a2.scripts,
[],
exclude_binaries=True,
name='simple',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=False,
console=True )
coll2 = COLLECT(exe2,
a2.binaries,
a2.zipfiles,
a2.datas,
strip=False,
upx=False,
upx_exclude=[],
name='simple')
try:
os.remove("complex.py")
except:
pass
try:
os.remove("simple.py")
except:
pass
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided complex.spec and trace how each Analysis call sets CONF['xref-file'] and the corresponding dot-file path. Compare the generated paths for the complex.py and simple.py analyses when using MERGE. Done means each analysis produces xref and dot files distinguished by script name without overwriting the previous files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100