Tags: devopshq/artifactory
Tags
Python 3.13 compatibility (#474) * Python 3.13 compatibility. (#473) Between Python 3.12 and Python 3.13, the internal structure of pathlib changed, causing the Artifactory URL parsing to fail. `pathlib.PurePath` previously had a private class attribute, `_flavour`, which has now been renamed to `parser` and made into a public and documented API. This renames `_flavour` to `parser` in the ArtifactoryPath subclasses, but it leaves around a `_flavour` class attribute that is aliased to `parser` as a compatibility shim for older versions of Python. One other breakage between Python 3.12 and 3.13 is that the artifactory package attempted to import `posixpath` via the `pathlib` package. `posixpath` was never meant to be a publicly accessible attribute of `pathlib`, as `posixpath` is its own top-level package in the standard library. The `pathlib` code was significantly restructured, causing the `posixpath` module to no longer be accessible under `pathlib`. We fix this in artifactory by directly importing the top-level `posixpath` package. Finally, this adds Python 3.13 to the package metadata in setup.py and the tox and GitHub Actions configuration files so that it is officially declared as a supported Python version and tested in CI. * Replace _make_child_relpath() with public joinpath() (#475) * Add unit test for `glob()` and partially fix Python 3.13 case. (#476) * Add unit test for `glob()` and partially fix Python 3.13 case. * Add custom subclass of _Globber to fix remaining issues with glob behavior. * Guard _globber override with Python version check. Co-authored-by: allburov <allburov@gmail.com> * Rearrange `if` statement to prefer early returns. Co-authored-by: allburov <allburov@gmail.com> * Add comment linking to original code for recursive_selector(). --------- Co-authored-by: allburov <allburov@gmail.com> --------- Co-authored-by: Richard Xia <richardxia@richardxia.com> Co-authored-by: offa <bm-dev@yandex.com>
ArtifactoryPath: fix iterdir with Python 3.11 On Python 3.11, pathlib's iterdir() calls directly to os.listdir(), so it does not go through ArtifactoryAccessor. Similar to commit 5278d06, override iterdir() so that we call our own ArtifactoryPath implementation.
Python 3.11 (#424) * ArtifactoryPath: fix mkdir and rmdir with Python 3.11 pathlib in Python 3.11 implements mkdir and rmdir directly in terms of calling os.<func> without any accessor layer. So copy the implementations of those functions from Python 3.10 to get the previous behavior back. Fixes: #415 Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com> * test_artifactory_path: Add basic unit test for mkdir() Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com> * ArtifactoryPath: Fix glob() in Python 3.11 Python 3.11 replaced _accessor.scandir with _scandir. Override _scandir to still use our implementation. Should be a noop on older Python versions because they didn't have _scandir at all. Fixes: #396 Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com> --------- Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
PreviousNext