commit d1ba2d4778cb6c28d4f45718cc1b0490d6b5ef3c from: Jelmer Vernooij date: Sun Jan 15 18:27:20 2023 UTC Cope with Protocol not being available on Python 3.8 commit - 7c4f65b680bc4295653904d23180cb8d8298429f commit + d1ba2d4778cb6c28d4f45718cc1b0490d6b5ef3c blob - 6bcc9918cc886bf27d15dd95282277a824ac17a6 blob + a3edd9f5fce0bb37afa8a474925239e96b2485a3 --- .github/workflows/pythontest.yml +++ .github/workflows/pythontest.yml @@ -31,19 +31,17 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -U pip coverage flake8 fastimport paramiko urllib3 + pip install -U ".[fastimport,paramiko,https]" - name: Install gpg on supported platforms - run: pip install -U gpg + run: pip install -U ".[pgp]" if: "matrix.os != 'windows-latest' && matrix.python-version != 'pypy3'" - - name: Install mypy - run: | - pip install -U mypy types-paramiko types-requests - if: "matrix.python-version != 'pypy3'" - name: Style checks run: | + pip install -U flake8 python -m flake8 - name: Typing checks run: | + pip install -U mypy types-paramiko types-requests python -m mypy dulwich if: "matrix.python-version != 'pypy3'" - name: Build @@ -51,4 +49,5 @@ jobs: python setup.py build_ext -i - name: Coverage test suite run run: | + pip install -U coverage python -m coverage run -p -m unittest dulwich.tests.test_suite blob - 25d75eced7d855d9227fce7a9d9d4846e448e10d blob + 9201aefc4bdd2ebbc00dd0cc2a47bad55083510c --- dulwich/object_store.py +++ dulwich/object_store.py @@ -28,8 +28,13 @@ import stat import sys import warnings -from typing import Callable, Dict, List, Optional, Tuple, Protocol, Iterator, Set, Iterable, Sequence, cast +from typing import Callable, Dict, List, Optional, Tuple, Iterator, Set, Iterable, Sequence, cast +try: + from typing import Protocol +except ImportError: # python << 3.8 + from typing_extensions import Protocol # type: ignore + from dulwich.errors import ( NotTreeError, ) blob - 08ee44a9df693318d1002c049c839e928c1580e1 blob + 9dcfa31e67776df61b6c2d09f37f968c35955084 --- dulwich/pack.py +++ dulwich/pack.py @@ -50,7 +50,13 @@ from itertools import chain import os import sys -from typing import Optional, Callable, Tuple, List, Deque, Union, Protocol, Iterable, Iterator, Dict, TypeVar, Generic, Sequence, Set +from typing import Optional, Callable, Tuple, List, Deque, Union, Iterable, Iterator, Dict, TypeVar, Generic, Sequence, Set + +try: + from typing import Protocol +except ImportError: # python << 3.8 + from typing_extensions import Protocol # type: ignore + import warnings from hashlib import sha1 blob - 853321cf35941e2fcc683ef2fb88743e064643a7 blob + 9b045eeddbada1386098f6c3630b629a693cb6ff --- dulwich/server.py +++ dulwich/server.py @@ -48,7 +48,13 @@ import os import socket import sys import time -from typing import List, Tuple, Dict, Optional, Iterable, Set, Protocol as TypingProtocol +from typing import List, Tuple, Dict, Optional, Iterable, Set + +try: + from typing import Protocol as TypingProtocol +except ImportError: # python < 3.8 + from typing_extensions import Protocol as TypingProtocol # type: ignore + import zlib import socketserver blob - ad428d2e55d87571932b8d89cd67348112e4edd5 blob + d539385f1a2425cdd47129a6a81b8e8fac8495e3 --- setup.cfg +++ setup.cfg @@ -52,6 +52,7 @@ packages = include_package_data = True install_requires = urllib3>=1.25 + typing_extensions;python_version<="3.7" zip_safe = False scripts = bin/dul-receive-pack