Browse Source

Import upstream version 0.20.8, md5 333b4a70b3119789ffc1e54472a36048

Jelmer Vernooij 4 years ago
parent
commit
7ea81ba4d9

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

@@ -9,7 +9,7 @@ jobs:
     strategy:
     strategy:
       matrix:
       matrix:
         os: [ubuntu-latest, macos-latest, windows-latest]
         os: [ubuntu-latest, macos-latest, windows-latest]
-        python-version: [3.5, 3.6, 3.7, 3.8, pypy3]
+        python-version: [3.5, 3.6, 3.7, 3.8, 3.9, pypy3]
         exclude:
         exclude:
           # sqlite3 exit handling seems to get in the way
           # sqlite3 exit handling seems to get in the way
           - os: macos-latest
           - os: macos-latest

+ 1 - 1
.github/workflows/pythonpublish.yml

@@ -12,7 +12,7 @@ jobs:
     strategy:
     strategy:
       matrix:
       matrix:
         os: [macos-latest, windows-latest]
         os: [macos-latest, windows-latest]
-        python-version: ['3.5', '3.6', '3.7', '3.8']
+        python-version: ['3.5', '3.6', '3.7', '3.8', '3.9']
         include:
         include:
           - os: ubuntu-latest
           - os: ubuntu-latest
             python-version: '3.x'
             python-version: '3.x'

+ 15 - 0
NEWS

@@ -1,3 +1,15 @@
+0.20.8	2020-10-29
+
+ * Build wheels on Mac OS X / Windows for Python 3.9.
+   (Jelmer Vernooij)
+
+0.20.7	2020-10-29
+
+ * Check core.repositoryformatversion. (Jelmer Vernooij, #803)
+
+ * Fix ACK/NACK handling in archive command handling in dulwich.client.
+   (DzmitrySudnik, #805)
+
 0.20.6	2020-08-29
 0.20.6	2020-08-29
 
 
  * Add a ``RefsContainer.watch`` interface.
  * Add a ``RefsContainer.watch`` interface.
@@ -12,6 +24,9 @@
  * Fix porcelain.path_to_tree_path for Python 3.5.
  * Fix porcelain.path_to_tree_path for Python 3.5.
    (Boris Feld, #777)
    (Boris Feld, #777)
 
 
+ * Add support for honor proxy environment variables for HTTP.
+   (Aurélien Campéas, #797)
+
 0.20.5	2020-06-22
 0.20.5	2020-06-22
 
 
  * Print a clearer exception when setup.py is executed on Python < 3.5.
  * Print a clearer exception when setup.py is executed on Python < 3.5.

+ 4 - 3
PKG-INFO

@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Metadata-Version: 2.1
 Name: dulwich
 Name: dulwich
-Version: 0.20.6
+Version: 0.20.8
 Summary: Python Git Library
 Summary: Python Git Library
 Home-page: https://www.dulwich.io/
 Home-page: https://www.dulwich.io/
 Author: Jelmer Vernooij
 Author: Jelmer Vernooij
@@ -96,8 +96,8 @@ Description: This is the Dulwich project.
         Supported versions of Python
         Supported versions of Python
         ----------------------------
         ----------------------------
         
         
-        At the moment, Dulwich supports (and is tested on) CPython 3.5, 3.6,
-        3.7, 3.8 and Pypy.
+        At the moment, Dulwich supports (and is tested on) CPython 3.5 and later and
+        Pypy.
         
         
         The latest release series to support Python 2.x was the 0.19 series. See
         The latest release series to support Python 2.x was the 0.19 series. See
         the 0.19 branch in the Dulwich git repository.
         the 0.19 branch in the Dulwich git repository.
@@ -110,6 +110,7 @@ Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Operating System :: POSIX
 Classifier: Operating System :: POSIX

+ 2 - 2
README.rst

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

+ 12 - 0
SECURITY.md

@@ -0,0 +1,12 @@
+# Security Policy
+
+## Supported Versions
+
+| Version  | Supported          |
+| -------- | ------------------ |
+| 0.20.x   | :white_check_mark: |
+| < 0.20.x | :x:                |
+
+## Reporting a Vulnerability
+
+Please report security issues by e-mail to jelmer@jelmer.uk, ideally PGP encrypted to the key at https://jelmer.uk/D729A457.asc

+ 4 - 3
dulwich.egg-info/PKG-INFO

@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Metadata-Version: 2.1
 Name: dulwich
 Name: dulwich
-Version: 0.20.6
+Version: 0.20.8
 Summary: Python Git Library
 Summary: Python Git Library
 Home-page: https://www.dulwich.io/
 Home-page: https://www.dulwich.io/
 Author: Jelmer Vernooij
 Author: Jelmer Vernooij
@@ -96,8 +96,8 @@ Description: This is the Dulwich project.
         Supported versions of Python
         Supported versions of Python
         ----------------------------
         ----------------------------
         
         
-        At the moment, Dulwich supports (and is tested on) CPython 3.5, 3.6,
-        3.7, 3.8 and Pypy.
+        At the moment, Dulwich supports (and is tested on) CPython 3.5 and later and
+        Pypy.
         
         
         The latest release series to support Python 2.x was the 0.19 series. See
         The latest release series to support Python 2.x was the 0.19 series. See
         the 0.19 branch in the Dulwich git repository.
         the 0.19 branch in the Dulwich git repository.
@@ -110,6 +110,7 @@ Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Operating System :: POSIX
 Classifier: Operating System :: POSIX

+ 1 - 0
dulwich.egg-info/SOURCES.txt

@@ -11,6 +11,7 @@ Makefile
 NEWS
 NEWS
 README.rst
 README.rst
 README.swift.rst
 README.swift.rst
+SECURITY.md
 TODO
 TODO
 build.cmd
 build.cmd
 dulwich.cfg
 dulwich.cfg

+ 1 - 1
dulwich/__init__.py

@@ -22,4 +22,4 @@
 
 
 """Python implementation of the Git file formats and protocols."""
 """Python implementation of the Git file formats and protocols."""
 
 
-__version__ = (0, 20, 6)
+__version__ = (0, 20, 8)

+ 13 - 6
dulwich/client.py

@@ -969,9 +969,9 @@ class TraditionalGitClient(GitClient):
                 pkt = proto.read_pkt_line()
                 pkt = proto.read_pkt_line()
             except HangupException:
             except HangupException:
                 raise _remote_error_from_stderr(stderr)
                 raise _remote_error_from_stderr(stderr)
-            if pkt == b"NACK\n":
+            if pkt == b"NACK\n" or pkt == b"NACK":
                 return
                 return
-            elif pkt == b"ACK\n":
+            elif pkt == b"ACK\n" or pkt == b"ACK":
                 pass
                 pass
             elif pkt.startswith(b"ERR "):
             elif pkt.startswith(b"ERR "):
                 raise GitProtocolError(
                 raise GitProtocolError(
@@ -1476,11 +1476,18 @@ def default_urllib3_manager(config, pool_manager_cls=None,
     proxy_server = user_agent = None
     proxy_server = user_agent = None
     ca_certs = ssl_verify = None
     ca_certs = ssl_verify = None
 
 
+    if proxy_server is None:
+        for proxyname in ('https_proxy', 'http_proxy', 'all_proxy'):
+            proxy_server = os.environ.get(proxyname)
+            if proxy_server is not None:
+                break
+
     if config is not None:
     if config is not None:
-        try:
-            proxy_server = config.get(b"http", b"proxy")
-        except KeyError:
-            pass
+        if proxy_server is None:
+            try:
+                proxy_server = config.get(b"http", b"proxy")
+            except KeyError:
+                pass
         try:
         try:
             user_agent = config.get(b"http", b"useragent")
             user_agent = config.get(b"http", b"useragent")
         except KeyError:
         except KeyError:

+ 13 - 5
dulwich/protocol.py

@@ -150,6 +150,17 @@ class ProtocolFile(object):
         pass
         pass
 
 
 
 
+def format_cmd_pkt(cmd, *args):
+    return cmd + b" " + b"".join([(a + b"\0") for a in args])
+
+
+def parse_cmd_pkt(line):
+    splice_at = line.find(b" ")
+    cmd, args = line[:splice_at], line[splice_at+1:]
+    assert args[-1:] == b"\x00"
+    return cmd, args[:-1].split(b"\0")
+
+
 def pkt_line(data):
 def pkt_line(data):
     """Wrap data in a pkt-line.
     """Wrap data in a pkt-line.
 
 
@@ -327,7 +338,7 @@ class Protocol(object):
           cmd: The remote service to access.
           cmd: The remote service to access.
           args: List of arguments to send to remove service.
           args: List of arguments to send to remove service.
         """
         """
-        self.write_pkt_line(cmd + b" " + b"".join([(a + b"\0") for a in args]))
+        self.write_pkt_line(format_cmd_pkt(cmd, *args))
 
 
     def read_cmd(self):
     def read_cmd(self):
         """Read a command and some arguments from the git client
         """Read a command and some arguments from the git client
@@ -337,10 +348,7 @@ class Protocol(object):
         Returns: A tuple of (command, [list of arguments]).
         Returns: A tuple of (command, [list of arguments]).
         """
         """
         line = self.read_pkt_line()
         line = self.read_pkt_line()
-        splice_at = line.find(b" ")
-        cmd, args = line[:splice_at], line[splice_at+1:]
-        assert args[-1:] == b"\x00"
-        return cmd, args[:-1].split(b"\0")
+        return parse_cmd_pkt(line)
 
 
 
 
 _RBUFSIZE = 8192  # Default read buffer size.
 _RBUFSIZE = 8192  # Default read buffer size.

+ 13 - 0
dulwich/repo.py

@@ -963,6 +963,13 @@ def read_gitfile(f):
     return cs[len("gitdir: "):].rstrip("\n")
     return cs[len("gitdir: "):].rstrip("\n")
 
 
 
 
+class UnsupportedVersion(Exception):
+    """Unsupported repository version."""
+
+    def __init__(self, version):
+        self.version = version
+
+
 class Repo(BaseRepo):
 class Repo(BaseRepo):
     """A git repository backed by local disk.
     """A git repository backed by local disk.
 
 
@@ -1001,6 +1008,12 @@ class Repo(BaseRepo):
             self._commondir = self._controldir
             self._commondir = self._controldir
         self.path = root
         self.path = root
         config = self.get_config()
         config = self.get_config()
+        try:
+            format_version = int(config.get("core", "repositoryformatversion"))
+        except KeyError:
+            format_version = 0
+        if format_version != 0:
+            raise UnsupportedVersion(format_version)
         object_store = DiskObjectStore.from_config(
         object_store = DiskObjectStore.from_config(
             os.path.join(self.commondir(), OBJECTDIR),
             os.path.join(self.commondir(), OBJECTDIR),
             config)
             config)

+ 1 - 1
dulwich/server.py

@@ -1081,7 +1081,7 @@ class UploadArchiveHandler(Handler):
                 commit_sha = self.repo.refs[argument]
                 commit_sha = self.repo.refs[argument]
                 tree = store[store[commit_sha].tree]
                 tree = store[store[commit_sha].tree]
             i += 1
             i += 1
-        self.proto.write_pkt_line(b'ACK\n')
+        self.proto.write_pkt_line(b'ACK')
         self.proto.write_pkt_line(None)
         self.proto.write_pkt_line(None)
         for chunk in tar_stream(
         for chunk in tar_stream(
                 store, tree, mtime=time.time(), prefix=prefix, format=format):
                 store, tree, mtime=time.time(), prefix=prefix, format=format):

+ 12 - 0
dulwich/tests/test_client.py

@@ -1108,6 +1108,18 @@ class DefaultUrllib3ManagerTest(TestCase):
         self.assertEqual(manager.proxy.host, 'localhost')
         self.assertEqual(manager.proxy.host, 'localhost')
         self.assertEqual(manager.proxy.port, 3128)
         self.assertEqual(manager.proxy.port, 3128)
 
 
+    def test_environment_proxy(self):
+        import urllib3
+        config = ConfigDict()
+        os.environ['http_proxy'] = 'http://myproxy:8080'
+        manager = default_urllib3_manager(config=config)
+        self.assertIsInstance(manager, urllib3.ProxyManager)
+        self.assertTrue(hasattr(manager, 'proxy'))
+        self.assertEqual(manager.proxy.scheme, 'http')
+        self.assertEqual(manager.proxy.host, 'myproxy')
+        self.assertEqual(manager.proxy.port, 8080)
+        del os.environ['http_proxy']
+
     def test_config_proxy_custom_cls(self):
     def test_config_proxy_custom_cls(self):
         import urllib3
         import urllib3
 
 

+ 8 - 0
dulwich/tests/test_repository.py

@@ -41,6 +41,7 @@ from dulwich.repo import (
     Repo,
     Repo,
     MemoryRepo,
     MemoryRepo,
     check_user_identity,
     check_user_identity,
+    UnsupportedVersion,
     )
     )
 from dulwich.tests import (
 from dulwich.tests import (
     TestCase,
     TestCase,
@@ -872,6 +873,13 @@ class BuildRepoRootTests(TestCase):
         r = Repo(self._repo_dir)
         r = Repo(self._repo_dir)
         self.assertEqual(r.object_store.loose_compression_level, 4)
         self.assertEqual(r.object_store.loose_compression_level, 4)
 
 
+    def test_repositoryformatversion(self):
+        r = self._repo
+        c = r.get_config()
+        c.set(('core',), 'repositoryformatversion', '2')
+        c.write_to_path()
+        self.assertRaises(UnsupportedVersion, Repo, self._repo_dir)
+
     def test_commit_encoding_from_config(self):
     def test_commit_encoding_from_config(self):
         r = self._repo
         r = self._repo
         c = r.get_config()
         c = r.get_config()

+ 2 - 1
setup.py

@@ -23,7 +23,7 @@ if sys.version_info < (3, 5):
         'For 2.7 support, please install a version prior to 0.20')
         'For 2.7 support, please install a version prior to 0.20')
 
 
 
 
-dulwich_version_string = '0.20.6'
+dulwich_version_string = '0.20.8'
 
 
 
 
 class DulwichDistribution(Distribution):
 class DulwichDistribution(Distribution):
@@ -124,6 +124,7 @@ setup(name='dulwich',
           'Programming Language :: Python :: 3.6',
           'Programming Language :: Python :: 3.6',
           'Programming Language :: Python :: 3.7',
           'Programming Language :: Python :: 3.7',
           'Programming Language :: Python :: 3.8',
           'Programming Language :: Python :: 3.8',
+          'Programming Language :: Python :: 3.9',
           'Programming Language :: Python :: Implementation :: CPython',
           'Programming Language :: Python :: Implementation :: CPython',
           'Programming Language :: Python :: Implementation :: PyPy',
           'Programming Language :: Python :: Implementation :: PyPy',
           'Operating System :: POSIX',
           'Operating System :: POSIX',