[arch-commits] Commit in python-mocket/trunk (PKGBUILD file-magic.patch)

Felix Yan felixonmars at archlinux.org
Mon Jul 27 17:08:31 UTC 2020


    Date: Monday, July 27, 2020 @ 17:08:31
  Author: felixonmars
Revision: 665493

upgpkg: python-mocket 3.8.7-1

Modified:
  python-mocket/trunk/PKGBUILD
Deleted:
  python-mocket/trunk/file-magic.patch

------------------+
 PKGBUILD         |   16 ++++++----------
 file-magic.patch |   49 -------------------------------------------------
 2 files changed, 6 insertions(+), 59 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2020-07-27 16:51:44 UTC (rev 665492)
+++ PKGBUILD	2020-07-27 17:08:31 UTC (rev 665493)
@@ -1,8 +1,8 @@
 # Maintainer: Felix Yan <felixonmars at archlinux.org>
 
 pkgname=python-mocket
-pkgver=3.8.6
-pkgrel=2
+pkgver=3.8.7
+pkgrel=1
 pkgdesc="Socket Mock Framework - for all kinds of socket animals, web-clients included - with gevent/asyncio/SSL support"
 url="https://github.com/mindflayer/python-mocket"
 license=('BSD')
@@ -10,17 +10,14 @@
 depends=('python-decorator' 'python-magic' 'python-urllib3' 'python-six')
 makedepends=('python-pipenv-to-requirements' 'python-pytest-cov' 'python-setuptools')
 checkdepends=('pifpaf' 'python-aiohttp' 'python-gevent' 'python-mock' 'python-pook' 'python-redis'
-              'python-sure' 'redis')
-source=("https://github.com/mindflayer/python-mocket/archive/$pkgver/$pkgname-$pkgver.tar.gz"
-        file-magic.patch)
-sha512sums=('76e98927b4c8c3912309fe9341519d9e986538010e5a8fcf3efe95e04793d4da27f9d6472ce54db4199bb0535dd959d1d9f957c4be8ab8edbf4194845e194b16'
-            '03abc1d8bb73988c573dec87ce10b8aae52924117732372764b7118040645270d89c7daa5c415cd6d7efd9a0ba1e24478c29419d4a777d9d27a882bf7b6836e7')
+              'python-sure' 'python-xxhash' 'redis')
+source=("https://github.com/mindflayer/python-mocket/archive/$pkgver/$pkgname-$pkgver.tar.gz")
+sha512sums=('879b5272bc19e05f8fe45e60d66210e2a63db624f308cc2725ca0f5f129411556ac596e7cb8daa183708740a6701b34a2dc83bfd8f17c61fa36d33ad13612950')
 
 prepare() {
   cd python-mocket-$pkgver
   pipenv_to_requirements
 
-  patch -p1 -i ../file-magic.patch
   sed -i 's/python-magic/file_magic/' requirements.txt
 }
 
@@ -31,8 +28,7 @@
 
 check() {
   cd python-mocket-$pkgver
-  # https://github.com/mindflayer/python-mocket/issues/119
-  pifpaf run redis -- pytest --deselect tests/main/test_http_with_xxhash.py::HttpEntryTestCase::test_truesendall_with_dump_from_recording
+  pifpaf run redis pytest
 }
 
 package() {

Deleted: file-magic.patch
===================================================================
--- file-magic.patch	2020-07-27 16:51:44 UTC (rev 665492)
+++ file-magic.patch	2020-07-27 17:08:31 UTC (rev 665493)
@@ -1,49 +0,0 @@
-commit 7afc43a4bdd6eefd6637e17d3f84f70bdcee28f2
-Author: Felix Yan <felixonmars at archlinux.org>
-Date:   Mon Jul 27 20:19:24 2020 +0800
-
-    Add support for file's builtin magic module
-    
-    file's builtin magic module has a somewhat different API, and it's not
-    co-installable with pypi:python-magic as both has the same name. Adding
-    a fallback logic here makes mocket work with either one.
-    
-    All related tests are passing here.
-
-diff --git a/mocket/mockhttp.py b/mocket/mockhttp.py
-index 7f9a484..70da11c 100644
---- a/mocket/mockhttp.py
-+++ b/mocket/mockhttp.py
-@@ -87,9 +87,16 @@ class Response(object):
-         if not self.is_file_object:
-             self.headers["Content-Type"] = "text/plain; charset=utf-8"
-         elif self.magic:
--            self.headers["Content-Type"] = decode_from_bytes(
--                magic.from_buffer(self.body, mime=True)
--            )
-+            if hasattr(self.magic, "from_buffer"):
-+                # PyPI python-magic
-+                self.headers["Content-Type"] = decode_from_bytes(
-+                    magic.from_buffer(self.body, mime=True)
-+                )
-+            else:
-+                # file's builtin python wrapper
-+                _magic = magic.open(magic.MAGIC_MIME)
-+                _magic.load()
-+                self.headers["Content-Type"] = _magic.buffer(self.body)
- 
-     def set_extra_headers(self, headers):
-         for k, v in headers.items():
-diff --git a/tests/main/test_http.py b/tests/main/test_http.py
-index 2244a4c..9ef33c8 100644
---- a/tests/main/test_http.py
-+++ b/tests/main/test_http.py
-@@ -235,7 +235,7 @@ class HttpEntryTestCase(HttpTestCase):
-         self.assertEqual(remote_content, local_content)
-         self.assertEqual(len(remote_content), len(local_content))
-         self.assertEqual(int(r.headers["Content-Length"]), len(local_content))
--        self.assertEqual(r.headers["Content-Type"], "image/png")
-+        self.assertIn(r.headers["Content-Type"], ("image/png", "image/png; charset=binary"))
- 
-     @mocketize
-     def test_file_object_with_no_lib_magic(self):



More information about the arch-commits mailing list