Browse Source

Drop suport for python 3.5.

Jelmer Vernooij 3 years ago
parent
commit
4b33973dfa
6 changed files with 36 additions and 61 deletions
  1. 1 7
      .github/workflows/pythonpackage.yml
  2. 3 8
      .github/workflows/pythonpublish.yml
  3. 2 0
      NEWS
  4. 1 1
      README.rst
  5. 25 41
      dulwich/porcelain.py
  6. 4 4
      setup.py

+ 1 - 7
.github/workflows/pythonpackage.yml

@@ -13,7 +13,7 @@ jobs:
     strategy:
       matrix:
         os: [ubuntu-latest, macos-latest, windows-latest]
-        python-version: [3.5, 3.6, 3.7, 3.8, 3.9, 3.10-dev, pypy3]
+        python-version: [3.6, 3.7, 3.8, 3.9, 3.10-dev, pypy3]
         exclude:
           # sqlite3 exit handling seems to get in the way
           - os: macos-latest
@@ -21,12 +21,6 @@ jobs:
           # doesn't support passing in bytestrings to os.scandir
           - os: windows-latest
             python-version: pypy3
-          # path encoding
-          - os: windows-latest
-            python-version: 3.5
-          # path encoding
-          - os: macos-latest
-            python-version: 3.5
       fail-fast: false
 
     steps:

+ 3 - 8
.github/workflows/pythonpublish.yml

@@ -12,16 +12,11 @@ jobs:
     strategy:
       matrix:
         os: [macos-latest, windows-latest]
-        python-version: ['3.5', '3.6', '3.7', '3.8', '3.9']
+        python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
         include:
           - os: ubuntu-latest
             python-version: '3.x'
           # path encoding
-        exclude:
-          - os: windows-latest
-            python-version: 3.5
-          - os: macos-latest
-            python-version: 3.5
       fail-fast: false
 
     steps:
@@ -56,12 +51,12 @@ jobs:
     - name: Build and publish (Linux aarch64)
       uses: RalfG/python-wheels-manylinux-build@v0.3.3-manylinux2014_aarch64
       with:
-        python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39'
+        python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310'
       if: "matrix.os == 'ubuntu-latest'"
     - name: Build and publish (Linux)
       uses: RalfG/python-wheels-manylinux-build@v0.3.1
       with:
-        python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39'
+        python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310'
       env:
         # Temporary fix for LD_LIBRARY_PATH issue. See
         # https://github.com/RalfG/python-wheels-manylinux-build/issues/26

+ 2 - 0
NEWS

@@ -9,6 +9,8 @@
  * Support os.PathLike arguments to Repo.stage().
    (Jan Wiśniewski, #907)
 
+ * Drop support for Python 3.5.  (Jelmer Vernooij)
+
 0.20.24	2021-07-18
 
  * config: disregard UTF-8 BOM when reading file.

+ 1 - 1
README.rst

@@ -88,7 +88,7 @@ file and `list of open issues <https://github.com/dulwich/dulwich/issues>`_.
 Supported versions of Python
 ----------------------------
 
-At the moment, Dulwich supports (and is tested on) CPython 3.5 and later and
+At the moment, Dulwich supports (and is tested on) CPython 3.6 and later and
 Pypy.
 
 The latest release series to support Python 2.x was the 0.19 series. See

+ 25 - 41
dulwich/porcelain.py

@@ -222,52 +222,36 @@ def path_to_tree_path(repopath, path, tree_encoding=DEFAULT_ENCODING):
       path: A path, absolute or relative to the cwd
     Returns: A path formatted for use in e.g. an index
     """
-    # Pathlib resolve before Python 3.6 could raises FileNotFoundError in case
-    # there is no file matching the path so we reuse the old implementation for
-    # Python 3.5
-    if sys.version_info < (3, 6):
-        if not isinstance(path, bytes):
-            path = os.fsencode(path)
-        if not isinstance(repopath, bytes):
-            repopath = os.fsencode(repopath)
-        treepath = os.path.relpath(path, repopath)
-        if treepath.startswith(b".."):
-            err_msg = "Path %r not in repo path (%r)" % (path, repopath)
-            raise ValueError(err_msg)
-        if os.path.sep != "/":
-            treepath = treepath.replace(os.path.sep.encode("ascii"), b"/")
-        return treepath
-    else:
-        # Resolve might returns a relative path on Windows
-        # https://bugs.python.org/issue38671
-        if sys.platform == "win32":
-            path = os.path.abspath(path)
+    # Resolve might returns a relative path on Windows
+    # https://bugs.python.org/issue38671
+    if sys.platform == "win32":
+        path = os.path.abspath(path)
 
-        path = Path(path)
-        resolved_path = path.resolve()
+    path = Path(path)
+    resolved_path = path.resolve()
 
-        # Resolve and abspath seems to behave differently regarding symlinks,
-        # as we are doing abspath on the file path, we need to do the same on
-        # the repo path or they might not match
-        if sys.platform == "win32":
-            repopath = os.path.abspath(repopath)
+    # Resolve and abspath seems to behave differently regarding symlinks,
+    # as we are doing abspath on the file path, we need to do the same on
+    # the repo path or they might not match
+    if sys.platform == "win32":
+        repopath = os.path.abspath(repopath)
 
-        repopath = Path(repopath).resolve()
+    repopath = Path(repopath).resolve()
 
-        try:
-            relpath = resolved_path.relative_to(repopath)
-        except ValueError:
-            # If path is a symlink that points to a file outside the repo, we
-            # want the relpath for the link itself, not the resolved target
-            if path.is_symlink():
-                parent = path.parent.resolve()
-                relpath = (parent / path.name).relative_to(repopath)
-            else:
-                raise
-        if sys.platform == "win32":
-            return str(relpath).replace(os.path.sep, "/").encode(tree_encoding)
+    try:
+        relpath = resolved_path.relative_to(repopath)
+    except ValueError:
+        # If path is a symlink that points to a file outside the repo, we
+        # want the relpath for the link itself, not the resolved target
+        if path.is_symlink():
+            parent = path.parent.resolve()
+            relpath = (parent / path.name).relative_to(repopath)
         else:
-            return bytes(relpath)
+            raise
+    if sys.platform == "win32":
+        return str(relpath).replace(os.path.sep, "/").encode(tree_encoding)
+    else:
+        return bytes(relpath)
 
 
 class DivergedBranches(Error):

+ 4 - 4
setup.py

@@ -17,9 +17,9 @@ import sys
 from typing import Dict, Any
 
 
-if sys.version_info < (3, 5):
+if sys.version_info < (3, 6):
     raise Exception(
-        'Dulwich only supports Python 3.5 and later. '
+        'Dulwich only supports Python 3.6 and later. '
         'For 2.7 support, please install a version prior to 0.20')
 
 
@@ -88,7 +88,7 @@ if has_setuptools:
         "console_scripts": [
             "dulwich=dulwich.cli:main",
         ]}
-    setup_kwargs['python_requires'] = '>=3.5'
+    setup_kwargs['python_requires'] = '>=3.6'
 else:
     scripts.append('bin/dulwich')
 
@@ -121,11 +121,11 @@ setup(name='dulwich',
       classifiers=[
           'Development Status :: 4 - Beta',
           'License :: OSI Approved :: Apache Software License',
-          'Programming Language :: Python :: 3.5',
           'Programming Language :: Python :: 3.6',
           'Programming Language :: Python :: 3.7',
           'Programming Language :: Python :: 3.8',
           'Programming Language :: Python :: 3.9',
+          'Programming Language :: Python :: 3.10',
           'Programming Language :: Python :: Implementation :: CPython',
           'Programming Language :: Python :: Implementation :: PyPy',
           'Operating System :: POSIX',