[arch-commits] Commit in python-mocket/repos/community-any (3 files)

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


    Date: Monday, July 27, 2020 @ 17:08:40
  Author: felixonmars
Revision: 665494

archrelease: copy trunk to community-any

Added:
  python-mocket/repos/community-any/PKGBUILD
    (from rev 665493, python-mocket/trunk/PKGBUILD)
Deleted:
  python-mocket/repos/community-any/PKGBUILD
  python-mocket/repos/community-any/file-magic.patch

------------------+
 PKGBUILD         |   82 +++++++++++++++++++++++++----------------------------
 file-magic.patch |   49 -------------------------------
 2 files changed, 39 insertions(+), 92 deletions(-)

Deleted: PKGBUILD
===================================================================
--- PKGBUILD	2020-07-27 17:08:31 UTC (rev 665493)
+++ PKGBUILD	2020-07-27 17:08:40 UTC (rev 665494)
@@ -1,43 +0,0 @@
-# Maintainer: Felix Yan <felixonmars at archlinux.org>
-
-pkgname=python-mocket
-pkgver=3.8.6
-pkgrel=2
-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')
-arch=('any')
-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')
-
-prepare() {
-  cd python-mocket-$pkgver
-  pipenv_to_requirements
-
-  patch -p1 -i ../file-magic.patch
-  sed -i 's/python-magic/file_magic/' requirements.txt
-}
-
-build() {
-  cd python-mocket-$pkgver
-  python setup.py build
-}
-
-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
-}
-
-package() {
-  cd python-mocket-$pkgver
-  python setup.py install --root="$pkgdir" --optimize=1
-
-  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
-}

Copied: python-mocket/repos/community-any/PKGBUILD (from rev 665493, python-mocket/trunk/PKGBUILD)
===================================================================
--- PKGBUILD	                        (rev 0)
+++ PKGBUILD	2020-07-27 17:08:40 UTC (rev 665494)
@@ -0,0 +1,39 @@
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+
+pkgname=python-mocket
+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')
+arch=('any')
+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' '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
+
+  sed -i 's/python-magic/file_magic/' requirements.txt
+}
+
+build() {
+  cd python-mocket-$pkgver
+  python setup.py build
+}
+
+check() {
+  cd python-mocket-$pkgver
+  pifpaf run redis pytest
+}
+
+package() {
+  cd python-mocket-$pkgver
+  python setup.py install --root="$pkgdir" --optimize=1
+
+  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
+}

Deleted: file-magic.patch
===================================================================
--- file-magic.patch	2020-07-27 17:08:31 UTC (rev 665493)
+++ file-magic.patch	2020-07-27 17:08:40 UTC (rev 665494)
@@ -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