Repository navigation
Python3.7 compatibility in testsuite, plus new CI workflow to test it - #1167
Open
elboulangero wants to merge 5 commits into
Open
elboulangero wants to merge 5 commits into
elboulangero wants to merge 5 commits into
Conversation
This was introduced in Python 3.8
shlex.join was added in Python 3.8 This commit adds a wrapper 'join_and_quote', which just invokes shlex.join if it exists, and otherwise basically implements it (the implementation is just a one-line in the Python stdlib, so it's easy to reproduce it here). Then the commit replaces all calls to shlex.join with calls to join_and_quote so that it works with Python 3.7
This was introduced in Python 3.8 This commit adds a wrapper unlink_missing_ok, which just calls Path.unlink(missing_ok=True) for Python 3.8 or above, and otherwise falls back to the try/except method. Then this commit also replaces all occurences to unlink(missing_ok=True) with calls to unlink_missing_ok, so that it works with Python 3.7.
Contributor
Author
|
One test fails (full log at https://github.com/RsyncProject/rsync/actions/runs/43154963062/job/130972649691): I checked but can't figure out how to fix it, the call to |
Contributor
Author
I fixed it with the last commit of this pull request. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This commits makes the test suite compatible with Python 3.7. For a use-case: I'm working on backporting rsync 3.5 to Debian buster, which comes with Python 3.7. While Debian buster is archived (read-only), it is still supported via Freexian ELTS offering, cf. https://wiki.debian.org/LTS/Extended?pow_referer=https%3A%2F%2Fwww.google.com%2F. ELTS is a commercial offering, so only avail to customers.
Still, if you think that compat with Python 3.7 is worth keeping for others, then here's a pull request!
Also note that the changes are minor, so basically Python 3.7 is almost supported (My guess is that it was supported but then was broken due to lack of CI).
Consequently, this pull request also adds a CI workflow to make sure Python 3.7 support is tested and keeps working.
Implementation
There are mainly two things missing in Python 3.7:
shlex.joinmissing_okfor functionPath.unlink.I solved both by defining wrappers, and replacing direct calls by calls to the wrapper.
Maybe the fix for missing
shlex.joincould be made a bit more elegant. For example, we can define shlex.join if missing in a file compat.py (or even straight in rsyncfns.py), so that it can then be used transparently. But it also means that all script that use shlex.join need to import compat.py (otherwise it will fail on Python 3.7), which is maybe not obvious.I suppose the same approach can be taken for
Path.unlink, the function is just a few lines long, so I suppose we can re-implement it in case of Python 3.7.Any preference ? I think that second approach would work better, so I can rework, no problem.