-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Seasonal cleanup #8126
Merged
Merged
Seasonal cleanup #8126
Conversation
This file contains 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
Change the Analysis.toc filename matching pattern in data-vs-binary-reclassification tests from `Analysis-??.toc` to `Analysis-*.toc` to account for numbers beyond 99, which can (and do) occur on our CI.
Fix a PytestReturnNotNoneWarning caused by one of the tests returning an modulegraph instance for use in another test. Refactor the code into a helper (non-test) function and two tests using it.
Remove `modulegraph._compat` as we have no reason for carrying python2-specific code. Similarly, remove dead codepaths for out-of-support python versions from the main `modulegraph` module.
Use `importlib.util.decode_source` to decode source of input .py scripts. This also alleviates the need to worry about UTF8 BOM marker. Also, we do not need to append the newline anymore; since python 3.2, `compile` with 'exec' mode does not have to end in a newline anymore. Also use `decode_source` when reading code of modules and scanning them for the SWIG identification line. Remove the `modulegraph.util.guess_encoding`, its test suite, and remaining use in sqlalchemy hook.
Aside from its corresponding test suite, the only use of functionality from this module was `zipio.listdir` in `_find_all_submodules`, which seems to be called by `_import_importable_package_submodules` to deal with `from ... import *` statements. As we do not support zipped eggs anymore, this should be superfluous. If it turns out to break "portable" python on Windows (which has stdlib modules in a .zip file), we can bring back just the minimal required part of the code.
Remove python2-specific stuff from `get_implies`, and clean up its general structure.
Remove some more functions from modulegraph that appear to be used only in its test suite, and thus have no real purpose.
Remove bunch of python2-specific code from the modulegraph test suite.
Fix an `EncodingWarning`.
Add encoding='utf8' to `objdump` process call in binary-vs-data classification on linux, to silence an `EncodingWarning`.
The `pkgutil.find_loader` function emits a deprecation warning starting with python 3.12. So instead obtain the module's spec (`importlib.util.find_spec`) and the loader from its `loader` attribute. Extend the handled error types to include `TypeError` and `ValueError`, which were previously turned into `ImportError` by `pkgutil.find_loader` behind the scenes.
Fix an `EncodingWarning`.
Fix multiple instances of `EncodingWarning`.
When trying to determine the type of Tcl/Tk installation on macOS by reading the `init.tcl` file, assume the UTF-8 encoding instead if trying to query it via `locale.getpreferredencoding` to avoid an `EncodingWarning`.
bwoodsend
approved these changes
Nov 26, 2023
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.
Assorted clean up in various parts of codebase:
PytestReturnNotNoneWarning
by refactoring a test in modulegraph's test suiteimportlib.util.decode_source
to decode source .py files and remove themodulegraph.util.guess_encoding
modulegraph.zipio
module (we do not support zipped eggs anymore)modulegraph.find_modules.get_implies
- get rid of python2-only modulesmodulegraph
code and its test suitemodulegraph
code that is not used anywhere except for its test suiteEncodingWarning
that are under our controlpkgutil.find_loader
inPyInstaller.utils.hooks.get_module_file_attribute
due to deprecation warning in 3.12