[arch-commits] Commit in python-mocket/repos/community-any (4 files)
Felix Yan
felixonmars at archlinux.org
Mon Jul 27 12:37:18 UTC 2020
Date: Monday, July 27, 2020 @ 12:37:17
Author: felixonmars
Revision: 665448
archrelease: copy trunk to community-any
Added:
python-mocket/repos/community-any/PKGBUILD
(from rev 665447, python-mocket/trunk/PKGBUILD)
python-mocket/repos/community-any/file-magic.patch
(from rev 665447, python-mocket/trunk/file-magic.patch)
Deleted:
python-mocket/repos/community-any/PKGBUILD
python-mocket/repos/community-any/file-magic.patch
------------------+
PKGBUILD | 85 +++++++++++++++++++++++----------------------
file-magic.patch | 98 ++++++++++++++++++++++++++---------------------------
2 files changed, 92 insertions(+), 91 deletions(-)
Deleted: PKGBUILD
===================================================================
--- PKGBUILD 2020-07-27 12:36:59 UTC (rev 665447)
+++ PKGBUILD 2020-07-27 12:37:17 UTC (rev 665448)
@@ -1,42 +0,0 @@
-# Maintainer: Felix Yan <felixonmars at archlinux.org>
-
-pkgname=python-mocket
-pkgver=3.8.6
-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' '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
-}
-
-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 665447, python-mocket/trunk/PKGBUILD)
===================================================================
--- PKGBUILD (rev 0)
+++ PKGBUILD 2020-07-27 12:37:17 UTC (rev 665448)
@@ -0,0 +1,43 @@
+# 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/
+}
Deleted: file-magic.patch
===================================================================
--- file-magic.patch 2020-07-27 12:36:59 UTC (rev 665447)
+++ file-magic.patch 2020-07-27 12:37:17 UTC (rev 665448)
@@ -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):
Copied: python-mocket/repos/community-any/file-magic.patch (from rev 665447, python-mocket/trunk/file-magic.patch)
===================================================================
--- file-magic.patch (rev 0)
+++ file-magic.patch 2020-07-27 12:37:17 UTC (rev 665448)
@@ -0,0 +1,49 @@
+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