Testcpio improvements, cpiofile improvements and port to py3#16
Merged
psafont merged 56 commits intoxenserver:masterfrom Nov 28, 2022
Merged
Testcpio improvements, cpiofile improvements and port to py3#16psafont merged 56 commits intoxenserver:masterfrom
psafont merged 56 commits intoxenserver:masterfrom
Conversation
c282eb3 to
72b8c1b
Compare
Closed
72b8c1b to
b9f1970
Compare
This is a common error documented in https://docs.python.org/2.7/whatsnew/2.6.html#pep-3110-exception-handling-changes Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Note there are indentation issues introduced in xcp.repository, as well as uses of the `future` package (which are not supposed to happen in pass 1), and several smaller issues. All of this is handled separately in further patches, so we can easily reconstruct this patch by running `futurize -wn1`. Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…lengths Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
This API change requires switching literals from str to unicode. Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
This implementation of CpioFileCompat.write cannot work with python 2.7, as adding new attributes to a ZipInfo triggers an exception. `tarfile.py` in Python 2.7 has a fix, but this method is clearly not used, so there's no reason to keep it, especially as its use of StringIO should likely switch to BytesIO and we would need to write tests for this. Also note that in python3 the TarFileCompat class is removed. We could probably just drop our CpioFileCompat completely, if we're sure noone uses it, but it likely only exists because there was a TarFileCompat. Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
... on locations reported by futurize Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
This is the only usage we have of `future`, where we used `six` instead everywhere else. At least `future` has the advantage of being really easy to drop when we cull python2 support. Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
These changes come from a `futurize -2` or `2to3` run, but are for some reason not applied by the `urllib` fix itself. Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Changes driven by "futurize -f libfuturize.fixes.fix_xrange_with_import", but not using "from builtins import range", which only brings negligible performance degradation on python2. Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
There has not been any distinction at the python code level between `long` and `int` since 2.2. `2to3 -f long` would replace them with casts to `int` instead, which would just be a no-op. Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…bility Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Only exclude a change to `xcp.accessor`. Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…timal Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…eeded 2to3 uses list comprehensions to replace `map` calls in many places where they're not needed, and would yield worse perf than `map`. Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…filter())` Looks like a bug/limitation in `2to3`. Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…ions Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…on convention Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…public-methods Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
…lengths Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Tests already fail on uncaught exception, and those except blocks are just adding dead code to tests. Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Makes for much more readable tests. Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
This helps understanding what really differs between 2 platforms. Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
When hunting for platform difference, it helps being able to tell that a difference comes from the original archives, now reproducible, or from the ones generated by the code under test. Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
References: * xz file-format spec: https://tukaani.org/xz/xz-file-format.txt * python3 defaults: https://docs.python.org/3/library/lzma.html#lzma.LZMACompressor * python2 defaults: Help on class LZMAFile in module lzma: class LZMAFile(__builtin__.object) | LZMAFile(name [, mode='r', buffering=0, memlimit=-1, | options={'format':'xz', 'check':'crc32', 'level':6, 'extreme':False, | 'dict_size':23, 'lc':3 'lp':0, 'pb':2, 'mode':2, | 'nice_len':128, 'mf':'bt4', 'depth':0]) -> file object Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Just safer than just checking for 2 single-digit bytes. Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Really hackish in case the code gets used. Caught/tested using non-included test_cpiofile.py derived from cpython's test_tarfile.py Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
b9f1970 to
1902174
Compare
Contributor
|
Could you a python3 environment in the CI to verify the port is working correctly? |
xennifer
approved these changes
Nov 25, 2022
Contributor
xennifer
left a comment
There was a problem hiding this comment.
Assuming it all works - the changes look reasnable to me.
Contributor
Author
I have done that as last commit in #17, as only then will all tests pass on python3. |
psafont
approved these changes
Nov 28, 2022
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.
Stacked PR, commits are: ydirson/xenserver-python-libs@futurize-pass-2...ydirson:xenserver-python-libs:testcpio-py3