diff options
| -rw-r--r-- | community/py3-cu2qu/3bd978bf0f011d8c7ee6ff21fb04815d6d80427d.patch | 68 | ||||
| -rw-r--r-- | community/py3-cu2qu/APKBUILD | 8 |
2 files changed, 73 insertions, 3 deletions
diff --git a/community/py3-cu2qu/3bd978bf0f011d8c7ee6ff21fb04815d6d80427d.patch b/community/py3-cu2qu/3bd978bf0f011d8c7ee6ff21fb04815d6d80427d.patch new file mode 100644 index 0000000000..01cf3f23a2 --- /dev/null +++ b/community/py3-cu2qu/3bd978bf0f011d8c7ee6ff21fb04815d6d80427d.patch @@ -0,0 +1,68 @@ +Fixes tests on x86; commit from upstream + +From 3bd978bf0f011d8c7ee6ff21fb04815d6d80427d Mon Sep 17 00:00:00 2001 +From: Cosimo Lupo <clupo@google.com> +Date: Thu, 24 Oct 2019 12:17:34 +0100 +Subject: [PATCH] pens_test: compare float coordinates up to 12 decimal + precision + +Fixes #186 +--- + tests/pens_test.py | 2 +- + tests/utils.py | 16 +++++++++++----- + 2 files changed, 12 insertions(+), 6 deletions(-) + +diff --git a/tests/pens_test.py b/tests/pens_test.py +index c861934..18e63a8 100644 +--- a/tests/pens_test.py ++++ b/tests/pens_test.py +@@ -39,7 +39,7 @@ def convert_glyph(self, glyph, **kwargs): + def expect_glyph(self, source, expected): + converted = self.convert_glyph(source) + self.assertNotEqual(converted, source) +- if converted != expected: ++ if not converted.approx(expected): + print(self.diff(expected, converted)) + self.fail("converted glyph is different from expected") + +diff --git a/tests/utils.py b/tests/utils.py +index 2706a71..b0d6c11 100644 +--- a/tests/utils.py ++++ b/tests/utils.py +@@ -112,7 +112,7 @@ def __ne__(self, other): + """Return True if 'other' glyph's outline is different from self.""" + return not (self == other) + +- def approx(self, other): ++ def approx(self, other, rel_tol=1e-12): + if hasattr(other, 'outline'): + outline2 == other.outline + elif hasattr(other, 'draw'): +@@ -132,7 +132,10 @@ def approx(self, other): + if not arg2 or not isinstance(arg2[0], tuple): + return False + for (x1, y1), (x2, y2) in zip(arg1, arg2): +- if not isclose(x1, x2) or not isclose(y1, y2): ++ if ( ++ not isclose(x1, x2, rel_tol=rel_tol) or ++ not isclose(y1, y2, rel_tol=rel_tol) ++ ): + return False + elif arg1 != arg2: + return False +@@ -208,9 +211,12 @@ def _repr_pen_commands(commands): + for cmd, args, kwargs in commands: + if args: + if isinstance(args[0], tuple): +- # cast float to int if there're no digits after decimal point +- args = [tuple((int(v) if int(v) == v else v) for v in pt) +- for pt in args] ++ # cast float to int if there're no digits after decimal point, ++ # and round floats to 12 decimal digits (more than enough) ++ args = [ ++ tuple((int(v) if int(v) == v else round(v, 12)) for v in pt) ++ for pt in args ++ ] + args = ", ".join(repr(a) for a in args) + if kwargs: + kwargs = ", ".join("%s=%r" % (k, v) diff --git a/community/py3-cu2qu/APKBUILD b/community/py3-cu2qu/APKBUILD index ea59025403..1c24dca8b5 100644 --- a/community/py3-cu2qu/APKBUILD +++ b/community/py3-cu2qu/APKBUILD @@ -5,12 +5,13 @@ pkgver=1.6.6 pkgrel=0 pkgdesc="Cubic-to-quadratic bezier curve conversion" url="https://github.com/googlefonts/cu2qu" -arch="all !x86" +arch="all" license="Apache-2.0" depends="python3 py3-fonttools py3-defcon" makedepends="py3-setuptools python3-dev cython" checkdepends="py3-pytest py3-coverage" -source="$pkgname-$pkgver.tar.gz::https://github.com/googlefonts/cu2qu/archive/v$pkgver.tar.gz" +source="$pkgname-$pkgver.tar.gz::https://github.com/googlefonts/cu2qu/archive/v$pkgver.tar.gz + 3bd978bf0f011d8c7ee6ff21fb04815d6d80427d.patch" builddir="$srcdir/cu2qu-$pkgver" build() { @@ -27,4 +28,5 @@ package() { python3 setup.py install --prefix=/usr --root="$pkgdir" } -sha512sums="419ed7b822b2d5fc5237d33ba56882d27501c24c5000be23468a20f79be8af27637e8104ecaebc32898da067c55f3e1343d59c7b804da2f28765cee12def4ccf py3-cu2qu-1.6.6.tar.gz" +sha512sums="419ed7b822b2d5fc5237d33ba56882d27501c24c5000be23468a20f79be8af27637e8104ecaebc32898da067c55f3e1343d59c7b804da2f28765cee12def4ccf py3-cu2qu-1.6.6.tar.gz +cc4fe15fc65bc13e1668e968890dd2c78a578b4f20385b1994c51b2d4783200f8d902c371a9f8e1ebfe7b251b5b5ad87621d11ff807d42c472bd00f095302c18 3bd978bf0f011d8c7ee6ff21fb04815d6d80427d.patch" |
