Factor out dependency checking. Use modern version handling #2866
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.
toolset.py
uses the classLooseVersion
fromdistutils
to implement comparison of versions.Distutils is deprecated, and won't be in Python 3.12 which is < 3 months away.
As a result, deprecations warnings are appearing in p4a's logs.
This PR moves over to use
packaging.Version
.packaging
is a already an install_req.Note:
packaging.Version
is a lot more opinionated about what a version number must look like. The current Python dependencies that are checked are sh and colorama, both of which adhere to this versioning standard, so there is no issue there.But, Android SDK versions sometimes contain spaces, so that code has become more complex.
This presented an opportunity to move the dependency-checking out of
toolchain.py
(another 1300-line file) into its own file.[This area is expected to need an overhaul to eventually support different python dependencies on different platforms, and Windows Prerequisites.]
Which presented an opportunity to cleanup the imports to follow PEP8 (alphabetical order, standard-then-3rd-party-then-local).
I have added no additional unit-tests. It is tricky to work out a good way to test this.