New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in TOC type (its __sub__ function) #6669
Comments
Nice catch! |
Thanks rokm! I have a related thing to note: For TOC entries with typecode BINARY or DATA, toc = TOC([('m1', None, None), ('m2', None, None), ('BadModule', None, 'BINARY')])
toc -= [('BadModule', None, None)]
print(toc)
# On Windows: -> [('m1', None, None), ('m2', None, None), ('BadModule', None, 'BINARY')]
# On Linux: -> [('m1', None, None), ('m2', None, None)] |
I'd say this example is invalid, because the subtracted element does not have type code. If it was
it would work as expected. |
True, but I guess that only works because specifying BINARY or DATA makes the name you give be run through Since the docs say:
perhaps this bears mentioning, but I am not sure how to word this in a way that is not going to confuse people.
This actually sent me for a spin for several hours yesterday, I was really confused about why subtracting 'opengl32sw.dll' would work but something like 'Qt5DBus.dll' stays. That the casing is responsible did not even occur to me until I looked at the code. |
perhaps this bears mentioning, but I am not sure how to word this in a way that is not going to confuse people.
Ah simple - we don't. If |
Hmmm, you're right. I wasn't aware that the docs were encouraging that sort of thing. I'll revise that part of docs to mention case normalization for BINARY and DATA entries, and explain why typecode needs to be specified on case-insensitive OSes (or alternatively, lowercase names should be provided, like you mentioned). |
Except we can't apply it consistently. If user does not provide the typecode of the operand, we have no way of knowing whether the normalization should be performed (i.e., the entry is data or binary) or not (i.e., the entry is for example a python module). And trying to infer this from the existing entries in the original TOC would require prior matching, leading to chicken-and-egg problem (I suppose pre-matching could be performed in lower-case, but it's a lot of additional complexity for very little gain). That's why I think adding a note about normalization and specifying lower-case names in lieu of typecodes is the best solution for this... |
Now that I think about it, why not perform case normalization on all |
Sounds like the sensible thing to me. |
I've moved this second part to a separate issue for easier bookkeeping. The case normalization changes involve fixing up tests that explicitly test for the old behavior, so I'd rather have the changes in a separate PR. |
Description of the issue
The documentation shows you can exclude binaries by adding something like the following to your spec file:
I noticed that if you then subtract again,
a.binaries
becomes an empty list.For example:
I believe L117 in
PyInstaller/building/datastruct.py
is the culprit. If I change it toresult.append(entry)
it fixes the issue. Otherwise the result__sub__
returns has an empty set for itsfilenames
, which then causes subsequent subtractions to fail, because the subtraction relies onfilenames
being set properly (see L109).Context information (for bug reports)
(this is probably irrelevant but just in case)
pyinstaller --version
:4.9
3.7.4
Windows 10 1909 en-GB
python.org/downloads
A minimal example program which shows the error
Stacktrace / full error message
and if you
print(toc)
at this point you get[]
.The text was updated successfully, but these errors were encountered: