From eb4bbd5a22af0a3b1d7a387272004bcc2e62622d Mon Sep 17 00:00:00 2001 From: donhui <977675308@qq.com> Date: Sat, 10 Sep 2022 11:38:00 +0800 Subject: [PATCH] support python 3.11 --- .github/workflows/ci.yml | 4 ++-- artifactory.py | 22 +++++++++++++++++++++- tox.ini | 1 + 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index be1c40e7..6c709b32 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,14 +14,14 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] + python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11-dev'] steps: - uses: actions/checkout@v1 with: fetch-depth: 1 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} diff --git a/artifactory.py b/artifactory.py index bfec2dd5..095c9357 100755 --- a/artifactory.py +++ b/artifactory.py @@ -640,7 +640,17 @@ def __iter__(self): return self.iterator -class _ArtifactoryAccessor(pathlib._Accessor): +_artifactory_access_parent_class = None +try: + _artifactory_access_parent_class = pathlib._Accessor +except AttributeError: + _artifactory_access_parent_class = ( + pathlib.WindowsPath if os.name == "nt" else pathlib.PosixPath + ) + + +class _ArtifactoryAccessor(_artifactory_access_parent_class): + """ Implements operations with Artifactory REST API """ @@ -1897,6 +1907,16 @@ def lchmod(self, mode): """ raise NotImplementedError() + def unlink(self, missing_ok=False): + """ + Removes a file or folder + """ + try: + self._accessor.unlink(self) + except ArtifactoryException: + if not missing_ok: + raise + def symlink_to(self, target, target_is_directory=False): """ Throw NotImplementedError diff --git a/tox.ini b/tox.ini index bb776255..224e13f4 100644 --- a/tox.ini +++ b/tox.ini @@ -5,6 +5,7 @@ envlist = py38 py39 py310 + py311 pre-commit [testenv]