Repository navigation
Python3.7 compatibility in testsuite, plus new CI workflow to test it - #1167
elboulangero wants to merge 10 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.
|
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 |
I fixed it with the last commit of this pull request. |
Compiled without xxhash
|
Thank you Arnaud. #1122 now makes the testsuite standard-library-only on 3.7 -- I do not think we should add Debian 10 as a separate CI platform. Its old compiler and userspace coverage substantially overlap Alma while its archived package repositories would add brittleness based upon a downstream-specific dependency. Debian qualification is better kept in Debian's packaging infra. |
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.