diff --git a/0001-Increase-tolerance-for-new-FreeType.patch b/0001-Increase-tolerance-for-new-FreeType.patch index df38668..ac1188d 100644 --- a/0001-Increase-tolerance-for-new-FreeType.patch +++ b/0001-Increase-tolerance-for-new-FreeType.patch @@ -1,7 +1,7 @@ From 4b38cd074bcc3c9014926add54ea4ee331f3e47b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 26 Feb 2018 02:42:50 -0500 -Subject: [PATCH] Increase tolerance for new FreeType. +Subject: [PATCH 1/2] Increase tolerance for new FreeType. Signed-off-by: Elliott Sales de Andrade --- diff --git a/0002-Fix-tests-with-fiona-installed.patch b/0002-Fix-tests-with-fiona-installed.patch new file mode 100644 index 0000000..dff0395 --- /dev/null +++ b/0002-Fix-tests-with-fiona-installed.patch @@ -0,0 +1,87 @@ +From 8e7f0a6ae2eccc0ed2d654b00fe6690d843f9eea Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Sat, 17 Nov 2018 04:01:56 -0500 +Subject: [PATCH 2/2] Fix tests with fiona installed. + +Signed-off-by: Elliott Sales de Andrade +--- + lib/cartopy/io/shapereader.py | 2 +- + lib/cartopy/tests/test_coastline.py | 3 +-- + lib/cartopy/tests/test_shapereader.py | 22 +++++++++++++++------- + 3 files changed, 17 insertions(+), 10 deletions(-) + +diff --git a/lib/cartopy/io/shapereader.py b/lib/cartopy/io/shapereader.py +index 4621245..f5173df 100644 +--- a/lib/cartopy/io/shapereader.py ++++ b/lib/cartopy/io/shapereader.py +@@ -29,7 +29,7 @@ geometry representation of shapely: + 3 + >>> records = list(reader.records()) + >>> print(type(records[0])) +- ++ + >>> print(', '.join(str(r) for r in sorted(records[0].attributes.keys()))) + comment, ... name, name_alt, ... region, ... + >>> print(records[0].attributes['name']) +diff --git a/lib/cartopy/tests/test_coastline.py b/lib/cartopy/tests/test_coastline.py +index d1eb76d..75bb3b2 100644 +--- a/lib/cartopy/tests/test_coastline.py ++++ b/lib/cartopy/tests/test_coastline.py +@@ -39,5 +39,4 @@ class TestCoastline(object): + # geometries += all_geometries[72:73] # GB + # for geometry in geometries: + for i, geometry in enumerate(geometries[93:]): +- for line_string in geometry: +- projection.project_geometry(line_string) ++ projection.project_geometry(geometry) +diff --git a/lib/cartopy/tests/test_shapereader.py b/lib/cartopy/tests/test_shapereader.py +index 5a5e3ed..0ce1b17 100644 +--- a/lib/cartopy/tests/test_shapereader.py ++++ b/lib/cartopy/tests/test_shapereader.py +@@ -43,10 +43,13 @@ class TestLakes(object): + + def test_geometry(self): + lake_geometry = self.test_lake_geometry +- assert lake_geometry.type == 'MultiPolygon' +- assert len(lake_geometry) == 1 +- +- polygon = lake_geometry[0] ++ if shp._HAS_FIONA: ++ assert lake_geometry.type == 'Polygon' ++ polygon = lake_geometry ++ else: ++ assert lake_geometry.type == 'MultiPolygon' ++ assert len(lake_geometry) == 1 ++ polygon = lake_geometry[0] + + expected = np.array([(-84.85548682324658, 11.147898667846633), + (-85.29013729525353, 11.176165676310276), +@@ -70,6 +73,7 @@ class TestLakes(object): + assert actual == expected + assert lake_record.geometry == self.test_lake_geometry + ++ @pytest.mark.skipif(shp._HAS_FIONA, reason='Lazy loading not implemented.') + def test_bounds(self): + # tests that a file which has a record with a bbox can + # use the bbox without first creating the geometry +@@ -99,10 +103,14 @@ class TestRivers(object): + + def test_geometry(self): + geometry = self.test_river_geometry +- assert geometry.type == 'MultiLineString' +- assert len(geometry) == 1 ++ if shp._HAS_FIONA: ++ assert geometry.type == 'LineString' ++ linestring = geometry ++ else: ++ assert geometry.type == 'MultiLineString' ++ assert len(geometry) == 1 ++ linestring = geometry[0] + +- linestring = geometry[0] + coords = linestring.coords + assert round(abs(coords[0][0] - -124.83563045947423), 7) == 0 + assert round(abs(coords[0][1] - 56.75692352968272), 7) == 0 +-- +2.17.2 + diff --git a/python-cartopy.spec b/python-cartopy.spec index e807ef2..159cf8a 100644 --- a/python-cartopy.spec +++ b/python-cartopy.spec @@ -13,6 +13,7 @@ Source0: https://files.pythonhosted.org/packages/source/C/%{Srcname}/%{Sr Source1: siteconfig.py # Might not go upstream in current form. Patch0004: 0001-Increase-tolerance-for-new-FreeType.patch +Patch0005: 0002-Fix-tests-with-fiona-installed.patch BuildRequires: gcc-c++ BuildRequires: geos-devel >= 3.3.3 @@ -42,6 +43,7 @@ BuildRequires: python2-six >= 1.3.0 BuildRequires: python2-numpy >= 1.10 BuildRequires: python2-shapely >= 1.5.6 BuildRequires: python2-pyshp >= 1.1.4 +BuildRequires: python2-fiona >= 1.0 # OWS requirements BuildRequires: python2-owslib >= 0.8.11 BuildRequires: python2-pillow >= 1.7.8 @@ -64,6 +66,7 @@ Requires: python2-six >= 1.3.0 Requires: python2-numpy >= 1.10 Requires: python2-shapely >= 1.5.6 Requires: python2-pyshp >= 1.1.4 +Requires: python2-fiona >= 1.0 Requires: python2-setuptools >= 0.7.2 # OWS requirements Recommends: python2-owslib >= 0.8.11 @@ -88,6 +91,7 @@ BuildRequires: python3-six >= 1.3.0 BuildRequires: python3-numpy >= 1.10 BuildRequires: python3-shapely >= 1.5.6 BuildRequires: python3-pyshp >= 1.1.4 +BuildRequires: python3-fiona >= 1.0 # OWS requirements BuildRequires: python3-OWSLib >= 0.8.11 BuildRequires: python3-pillow >= 1.7.8 @@ -112,6 +116,7 @@ Requires: python3-six >= 1.3.0 Requires: python3-numpy >= 1.10 Requires: python3-shapely >= 1.5.6 Requires: python3-pyshp >= 1.1.4 +Requires: python3-fiona >= 1.0 # OWS requirements Recommends: python3-OWSLib >= 0.8.11 Recommends: python3-pillow >= 1.7.8