Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/community/python-redis
diff options
context:
space:
mode:
Diffstat (limited to 'community/python-redis')
-rw-r--r--community/python-redis/PKGBUILD12
-rw-r--r--community/python-redis/precision.patch95
-rw-r--r--community/python-redis/tmp68
3 files changed, 175 insertions, 0 deletions
diff --git a/community/python-redis/PKGBUILD b/community/python-redis/PKGBUILD
new file mode 100644
index 00000000..1720d25f
--- /dev/null
+++ b/community/python-redis/PKGBUILD
@@ -0,0 +1,12 @@
+# see https://github.com/andymccurdy/redis-py/issues/899
+
+source+=('precision.patch')
+sha512sums+=('ccefada444c145f78098a37880bf7b1c7a2f2e24e92efc62f084610064c4391e4e0792a3e380ca940b73b15d703d5d0f166a8f7d8d17b9d84772b3e870fb74d5')
+
+eval "$(
+ declare -f prepare | \
+ sed '
+ /^{/ a \
+ patch -p0 -i precision.patch
+ '
+)"
diff --git a/community/python-redis/precision.patch b/community/python-redis/precision.patch
new file mode 100644
index 00000000..aa44b7cf
--- /dev/null
+++ b/community/python-redis/precision.patch
@@ -0,0 +1,95 @@
+--- redis-2.10.6/tests/test_commands.py 2017-09-15 15:05:58.441320136 +0200
++++ redis-2.10.6/tests/test_commands.py 2017-09-15 15:05:57.429413306 +0200
+@@ -1457,9 +1457,11 @@
+
+ r.geoadd('barcelona', *values)
+ # redis uses 52 bits precision, hereby small errors may be introduced.
+- assert r.geopos('barcelona', 'place1', 'place2') ==\
+- [(2.19093829393386841, 41.43379028184083523),
+- (2.18737632036209106, 41.40634178640635099)]
++ res = r.geopos('barcelona', 'place1', 'place2')
++ assert abs(res[0][0] - 2.19093829393386841) < 0.0001
++ assert abs(res[0][1] - 41.43379028184083523) < 0.0001
++ assert abs(res[1][0] - 2.18737632036209106) < 0.0001
++ assert abs(res[1][1] - 41.40634178640635099) < 0.0001
+
+ @skip_if_server_version_lt('4.0.0')
+ def test_geopos_no_value(self, r):
+@@ -1504,20 +1506,27 @@
+
+ # test a bunch of combinations to test the parse response
+ # function.
+- assert r.georadius('barcelona', 2.191, 41.433, 1, unit='km',
+- withdist=True, withcoord=True, withhash=True) ==\
+- [['place1', 0.0881, 3471609698139488,
+- (2.19093829393386841, 41.43379028184083523)]]
+-
+- assert r.georadius('barcelona', 2.191, 41.433, 1, unit='km',
+- withdist=True, withcoord=True) ==\
+- [['place1', 0.0881,
+- (2.19093829393386841, 41.43379028184083523)]]
+-
+- assert r.georadius('barcelona', 2.191, 41.433, 1, unit='km',
+- withhash=True, withcoord=True) ==\
+- [['place1', 3471609698139488,
+- (2.19093829393386841, 41.43379028184083523)]]
++ res = r.georadius('barcelona', 2.191, 41.433, 1, unit='km',
++ withdist=True, withcoord=True, withhash=True)[0]
++ assert res[0] == 'place1'
++ assert abs(res[1] - 0.0881) < 0.00001
++ assert res[2] == 3471609698139488
++ assert abs(res[3][0] - 2.19093829393386841) < 0.000000001
++ assert abs(res[3][1] - 41.43379028184083523) < 0.000000001
++
++ res = r.georadius('barcelona', 2.191, 41.433, 1, unit='km',
++ withdist=True, withcoord=True)[0]
++ assert res[0] == 'place1'
++ assert abs(res[1] - 0.0881) < 0.0001
++ assert abs(res[2][0] - 2.19093829393386841) < 0.0000001
++ assert abs(res[2][1] - 41.43379028184083523) < 0.0000001
++
++ res = r.georadius('barcelona', 2.191, 41.433, 1, unit='km',
++ withhash=True, withcoord=True)[0]
++ assert res[0] == 'place1'
++ assert res[1] == 3471609698139488
++ assert abs(res[2][0] - 2.19093829393386841) < 0.0000001
++ assert abs(res[2][1] - 41.43379028184083523) < 0.0000001
+
+ # test no values.
+ assert r.georadius('barcelona', 2, 1, 1, unit='km',
+@@ -1561,7 +1570,7 @@
+ r.georadius('barcelona', 2.191, 41.433, 1000,
+ store_dist='places_barcelona')
+ # instead of save the geo score, the distance is saved.
+- assert r.zscore('places_barcelona', 'place1') == 88.05060698409301
++ assert abs(r.zscore('places_barcelona', 'place1') - 88.05060698409301) < 0.00000001
+
+ @skip_if_server_version_lt('3.2.0')
+ def test_georadiusmember(self, r):
+@@ -1573,13 +1582,20 @@
+ ['place2', 'place1']
+ assert r.georadiusbymember('barcelona', 'place1', 10) == ['place1']
+
+- assert r.georadiusbymember('barcelona', 'place1', 4000,
++ res = r.georadiusbymember('barcelona', 'place1', 4000,
+ withdist=True, withcoord=True,
+- withhash=True) ==\
+- [['place2', 3067.4157, 3471609625421029,
+- (2.187376320362091, 41.40634178640635)],
+- ['place1', 0.0, 3471609698139488,
+- (2.1909382939338684, 41.433790281840835)]]
++ withhash=True)
++ r1 = [r for r in res if r[0] == 'place1'][0]
++ r2 = [r for r in res if r[0] == 'place2'][0]
++
++ assert abs(r1[1]) < 0.0001
++ assert r1[2] == 3471609698139488
++ assert abs(r1[3][0] - 2.1909382939338684) < 0.0000001
++ assert abs(r1[3][1] - 41.433790281840835) < 0.0000001
++ assert abs(r2[1] - 3067.4157) < 0.0001
++ assert r2[2] == 3471609625421029
++ assert abs(r2[3][0] - 2.187376320362091) < 0.0000001
++ assert abs(r2[3][1] - 41.40634178640635) < 0.0000001
+
+
+ class TestStrictCommands(object):
diff --git a/community/python-redis/tmp b/community/python-redis/tmp
new file mode 100644
index 00000000..6381b912
--- /dev/null
+++ b/community/python-redis/tmp
@@ -0,0 +1,68 @@
+# $Id$
+# Maintainer: Felix Yan <felixonmars@archlinux.org>
+# Contributor: Karol 'Kenji Takahashi' Woźniak <kenji.sx>
+# Contributor: Pierre Gueth <pierre.gueth@gmail.com>
+
+pkgbase=python-redis
+pkgname=('python-redis' 'python2-redis')
+pkgver=2.10.6
+pkgrel=1
+pkgdesc='The Python interface to the Redis key-value store'
+arch=('any')
+url="http://github.com/andymccurdy/redis-py"
+license=('MIT')
+makedepends=('python-setuptools' 'python2-setuptools')
+checkdepends=('python-pytest' 'python2-pytest' 'python-mock' 'python2-mock' 'python-pifpaf' 'redis')
+source=("https://pypi.io/packages/source/r/redis/redis-$pkgver.tar.gz" precision.patch)
+sha512sums=('e7df464bc3b26e23f6a0d2d2896306c1e4792b9a2a4ecaea6dd8690ffa17853cc85345f063307295dd3c2da399f7f203f4b21d785f7e073c0501732257419dad' 'SKIP')
+
+prepare() {
+ patch -p0 -i precision.patch
+ cp -a redis-$pkgver{,-py2}
+}
+
+build() {
+ cd redis-$pkgver
+ python setup.py build
+
+ cd ../redis-$pkgver-py2
+ python2 setup.py build
+}
+
+check() {
+ cd redis-$pkgver
+ pifpaf run redis py.test
+
+ cd ../redis-$pkgver-py2
+ pifpaf run redis py.test2
+}
+
+package_python-redis() {
+ depends=('python')
+
+ cd redis-$pkgver
+ python setup.py install --root="$pkgdir" --optimize=1
+ install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+}
+
+package_python2-redis() {
+ depends=('python2')
+
+ cd redis-$pkgver-py2
+ python2 setup.py install --root="$pkgdir" --optimize=1
+ install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+}
+
+# vim:set ts=2 sw=2 et:
+# see https://github.com/andymccurdy/redis-py/issues/899
+
+source+=('precision.patch')
+sha512sums+=('ccefada444c145f78098a37880bf7b1c7a2f2e24e92efc62f084610064c4391e4e0792a3e380ca940b73b15d703d5d0f166a8f7d8d17b9d84772b3e870fb74d5')
+
+eval "$(
+ declare -f prepare | \
+ sed '
+ /^{/ a \
+ patch -p0 -i precision.patch
+ '
+)"