Fixed iter_modules hook when packages are symbolically linked#7885
Merged
rokm merged 2 commits intopyinstaller:developfrom Aug 25, 2023
Merged
Fixed iter_modules hook when packages are symbolically linked#7885rokm merged 2 commits intopyinstaller:developfrom
rokm merged 2 commits intopyinstaller:developfrom
Conversation
Member
|
Nice work, @gentlegiantJGC! The removal of early check for |
22 tasks
bwoodsend
approved these changes
Aug 25, 2023
toofar
added a commit
to qutebrowser/qutebrowser
that referenced
this pull request
Aug 25, 2023
Pull in this PR: pyinstaller/pyinstaller#7885 How to test: make sure extensions are loaded on macOS now that data files are under qutebrowser/... again and we are not doing any frozen specific workarounds for loading data files or extensions.
When a package is symbolically linked out of the _MEIPASS directory (for example, in macOS .app bundles when package contains data files), there is a path mismatch causing it to get skipped. This resolves the real path of the package paths and the module paths so that they can be compared correctly. It changes the comparison to run in path space rather than module dotted space. I believe this is equivalent because all modules in the PyiFrozenImporter should be in the _MEIPASS directory.
…ta file Add a test for `pkgutil.iter_modules` and package with data file in macOS .app bundles. In such cases, the package's directory is fully collected into `Contents/Resources` directory, and a symbolic link to the package's directory is created in `Contents/Frameworks` (the `_MEIPASS` directory). When validating the package path prefix, our `pkgutil.iter_modules` implementation needs to account that resolved package path does not directly match the `_MEIPASS` path due to the symbolic link.
rokm
approved these changes
Aug 25, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When packages are symbolically linked out of the _MEIPASS directory as they are on MacOS when data files are present there is a path mismatch causing them to get skipped.
This resolves the real path of the package paths and the module paths so that they can be compared correctly.
This changes the comparison to run in path space rather than module dotted space.
I believe this is equivalent because all modules in the PyiFrozenImporter should be in the _MEIPASS directory.
Fixes #7884