From f8dced07cbaa5959a39d5d5e1069cb5f8bfe54a2 Mon Sep 17 00:00:00 2001 From: Benjamin A. Beasley Date: Jul 24 2022 16:01:48 +0000 Subject: Update parallel offset test for GEOS 3.11 Backport a workaround commit from upstream. --- diff --git a/ef380ba8796702a56e05138ed8599e89f617d2c9.patch b/ef380ba8796702a56e05138ed8599e89f617d2c9.patch new file mode 100644 index 0000000..9beb863 --- /dev/null +++ b/ef380ba8796702a56e05138ed8599e89f617d2c9.patch @@ -0,0 +1,27 @@ +From ef380ba8796702a56e05138ed8599e89f617d2c9 Mon Sep 17 00:00:00 2001 +From: Joris Van den Bossche +Date: Sun, 10 Jul 2022 11:14:30 +0200 +Subject: [PATCH] update parallel offset test for GEOS 3.11 + +--- + tests/test_parallel_offset.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/tests/test_parallel_offset.py b/tests/test_parallel_offset.py +index 7dbbe55c..661291a5 100644 +--- a/tests/test_parallel_offset.py ++++ b/tests/test_parallel_offset.py +@@ -9,9 +9,11 @@ def test_parallel_offset_linestring(self): + left = line1.parallel_offset(5, 'left') + self.assertEqual(left, LineString([(0, 5), (10, 5)])) + right = line1.parallel_offset(5, 'right') +- self.assertEqual(right, LineString([(10, -5), (0, -5)])) ++ # using spatial equality because the order of coordinates is not guaranteed ++ # (GEOS 3.11 changed this, see https://github.com/shapely/shapely/issues/1436) ++ assert right.equals(LineString([(10, -5), (0, -5)])) + right = line1.parallel_offset(-5, 'left') +- self.assertEqual(right, LineString([(10, -5), (0, -5)])) ++ assert right.equals(LineString([(10, -5), (0, -5)])) + left = line1.parallel_offset(-5, 'right') + self.assertEqual(left, LineString([(0, 5), (10, 5)])) + diff --git a/python-shapely.spec b/python-shapely.spec index b1dbeae..f7684c6 100644 --- a/python-shapely.spec +++ b/python-shapely.spec @@ -13,6 +13,15 @@ License: BSD URL: https://github.com/shapely/shapely Source0: %{url}/archive/%{version}/shapely-%{version}.tar.gz +# update parallel offset test for GEOS 3.11 +# https://github.com/shapely/shapely/commit/ef380ba8796702a56e05138ed8599e89f617d2c9 +# +# Works around: +# +# Shapely relying on inconsistent GEOS behavior? (Using geos 3.11.0) +# https://github.com/shapely/shapely/issues/1436 +Patch: %{url}/commit/ef380ba8796702a56e05138ed8599e89f617d2c9.patch + BuildRequires: gcc BuildRequires: geos-devel @@ -57,7 +66,7 @@ BuildArch: noarch %prep -%autosetup -n shapely-%{version} +%autosetup -n shapely-%{version} -p1 # Remove vendored python-packaging rm -rvf _vendor