diff --git a/fix-fp-issue.patch b/fix-fp-issue.patch new file mode 100644 index 0000000..4bd8d84 --- /dev/null +++ b/fix-fp-issue.patch @@ -0,0 +1,26 @@ +Subject: Fix floating point precission issue in tests +Author: Antonio Larrosa + +Depending on the computer where the tests run, the result of +estimateQuadraticCurveLength((0, 0), (50, 20), (100, 40)) +can be +107.70329614269009 +or +107.70329614269008 +so it's better to ignore the final digit + +Index: antonio/obs/home/alarrosa/branches/devel/languages/python/fonts/python-fontPens/fontPens-0.2.4/Lib/fontPens/penTools.py +=================================================================== +--- fontPens-0.2.4/Lib/fontPens/penTools.py ++++ fontPens-0.2.4.new/Lib/fontPens/penTools.py +@@ -160,8 +160,8 @@ def estimateQuadraticCurveLength(pt0, pt + 0.0 + >>> estimateQuadraticCurveLength((0, 0), (50, 0), (80, 0)) # collinear points + 80.0 +- >>> estimateQuadraticCurveLength((0, 0), (50, 20), (100, 40)) # collinear points +- 107.70329614269009 ++ >>> int(10000000000000 * estimateQuadraticCurveLength((0, 0), (50, 20), (100, 40))) # collinear points ++ 1077032961426900 + >>> estimateQuadraticCurveLength((0, 0), (0, 100), (100, 0)) + 153.6861437729263 + >>> estimateQuadraticCurveLength((0, 0), (50, -10), (80, 50)) diff --git a/python-fontPens.changes b/python-fontPens.changes index e523b6a..5ad7eac 100644 --- a/python-fontPens.changes +++ b/python-fontPens.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Jun 12 11:47:01 UTC 2020 - Antonio Larrosa + +- Add patch to fix floating point precission issue that made tests + fail depending on where the package is built + * fix-fp-issue.patch + ------------------------------------------------------------------- Wed May 20 10:25:48 UTC 2020 - Antonio Larrosa diff --git a/python-fontPens.spec b/python-fontPens.spec index 74168ed..3e7b6cf 100644 --- a/python-fontPens.spec +++ b/python-fontPens.spec @@ -24,6 +24,7 @@ Summary: A collection of classes implementing the pen protocol for manipu License: BSD-3-Clause URL: https://github.com/robofab-developers/fontPens Source: https://files.pythonhosted.org/packages/source/f/fontPens/fontPens-%{version}.zip +Patch0: fix-fp-issue.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -42,6 +43,7 @@ A collection of classes implementing the pen protocol for manipulating glyphs. %prep %setup -q -n fontPens-%{version} +%patch0 -p1 %build %python_build