Explorar el Código

Add 01_no_urllib3_pypy: disable HTTP on pypy, since pypy-urllib3 doesn't exist.

Jelmer Vernooij hace 7 años
padre
commit
06735900e7
Se han modificado 3 ficheros con 128 adiciones y 0 borrados
  1. 2 0
      debian/changelog
  2. 125 0
      debian/patches/01_no_urllib3_pypy
  3. 1 0
      debian/patches/series

+ 2 - 0
debian/changelog

@@ -2,6 +2,8 @@ dulwich (0.19.0-1) UNRELEASED; urgency=medium
 
   * New upstream release.
    + Add dependencies on python-certifi and python-urllib3.
+  * Add 01_no_urllib3_pypy: disable HTTP on pypy, since pypy-urllib3
+    doesn't exist.
 
  -- Jelmer Vernooij <jelmer@debian.org>  Sat, 10 Mar 2018 21:31:25 +0000
 

+ 125 - 0
debian/patches/01_no_urllib3_pypy

@@ -0,0 +1,125 @@
+diff --git a/dulwich/client.py b/dulwich/client.py
+index b5f5f804..0db532d0 100644
+--- a/dulwich/client.py
++++ b/dulwich/client.py
+@@ -60,10 +60,6 @@ except ImportError:
+     import urllib.request as urllib2
+     import urllib.parse as urlparse
+ 
+-import certifi
+-import urllib3
+-import urllib3.util
+-
+ import dulwich
+ from dulwich.errors import (
+     GitProtocolError,
+@@ -1260,6 +1256,8 @@ def default_urllib3_manager(config, verify_ssl=True):
+     :return: `urllib3.ProxyManager` instance for proxy configurations,
+         `urllib3.PoolManager` otherwise.
+     """
++    import urllib3
++    import certifi
+     proxy_server = user_agent = None
+ 
+     if config is not None:
+@@ -1298,6 +1296,7 @@ class HttpGitClient(GitClient):
+ 
+     def __init__(self, base_url, dumb=None, pool_manager=None, config=None,
+                  username=None, password=None, **kwargs):
++        import urllib3.util
+         self._base_url = base_url.rstrip("/") + "/"
+         self._username = username
+         self._password = password
+diff --git a/dulwich/tests/test_client.py b/dulwich/tests/test_client.py
+index eb1ccbea..881fabf5 100644
+--- a/dulwich/tests/test_client.py
++++ b/dulwich/tests/test_client.py
+@@ -35,8 +35,12 @@ try:
+ except ImportError:
+     import urllib.parse as urlparse
+ 
+-import certifi
+-import urllib3
++if '__pypy__' not in sys.modules:
++    import certifi
++    import urllib3
++else:
++    urllib3 = None
++    certifi = None
+ 
+ import dulwich
+ from dulwich import (
+@@ -534,12 +538,20 @@ class TestGetTransportAndPath(TestCase):
+         self.assertTrue(isinstance(c, SSHGitClient))
+ 
+     def test_http(self):
++        if '__pypy__' in sys.modules:
++            self.skipTest('urllib3 not available for pypy in debian')
++
++
+         url = 'https://github.com/jelmer/dulwich'
+         c, path = get_transport_and_path(url)
+         self.assertTrue(isinstance(c, HttpGitClient))
+         self.assertEqual('/jelmer/dulwich', path)
+ 
+     def test_http_auth(self):
++        if '__pypy__' in sys.modules:
++            self.skipTest('urllib3 not available for pypy in debian')
++
++
+         url = 'https://user:passwd@github.com/jelmer/dulwich'
+ 
+         c, path = get_transport_and_path(url)
+@@ -550,6 +562,10 @@ class TestGetTransportAndPath(TestCase):
+         self.assertEqual('passwd', c._password)
+ 
+     def test_http_no_auth(self):
++        if '__pypy__' in sys.modules:
++            self.skipTest('urllib3 not available for pypy in debian')
++
++
+         url = 'https://github.com/jelmer/dulwich'
+ 
+         c, path = get_transport_and_path(url)
+@@ -632,6 +648,9 @@ class TestGetTransportAndPathFromUrl(TestCase):
+             'prospero://bar/baz')
+ 
+     def test_http(self):
++        if '__pypy__' in sys.modules:
++            self.skipTest('urllib3 not available for pypy in debian')
++
+         url = 'https://github.com/jelmer/dulwich'
+         c, path = get_transport_and_path_from_url(url)
+         self.assertTrue(isinstance(c, HttpGitClient))
+@@ -863,6 +882,11 @@ class LocalGitClientTests(TestCase):
+ 
+ class HttpGitClientTests(TestCase):
+ 
++    def setUp(self):
++        super(HttpGitClientTests, self).setUp()
++        if '__pypy__' in sys.modules:
++            self.skipTest('urllib3 not available for pypy in debian')
++
+     @staticmethod
+     def b64encode(s):
+         """Python 2/3 compatible Base64 encoder. Returns string."""
+@@ -961,6 +985,11 @@ class TCPGitClientTests(TestCase):
+ 
+ class DefaultUrllib3ManagerTest(TestCase):
+ 
++    def setUp(self):
++        super(DefaultUrllib3ManagerTest, self).setUp()
++        if '__pypy__' in sys.modules:
++            self.skipTest('urllib3 not available for pypy in debian')
++
+     def assert_verify_ssl(self, manager, assertion=True):
+         pool_keywords = tuple(manager.connection_pool_kw.items())
+         assert_method = self.assertIn if assertion else self.assertNotIn
+@@ -972,6 +1001,7 @@ class DefaultUrllib3ManagerTest(TestCase):
+         self.assert_verify_ssl(manager)
+ 
+     def test_config_no_proxy(self):
++
+         manager = default_urllib3_manager(config=ConfigDict())
+         self.assert_verify_ssl(manager)
+ 

+ 1 - 0
debian/patches/series

@@ -0,0 +1 @@
+01_no_urllib3_pypy