python-cartopy/python-cartopy.spec
Elliott Sales de Andrade df34ae2b61 Make setup quiet.
2018-02-28 18:56:59 -05:00

214 lines
6.8 KiB
RPMSpec

%global srcname cartopy
%global Srcname Cartopy
# Natural Earth data may not packaged be yet.
%global test_natural_earth 1
Name: python-%{srcname}
Version: 0.16.0
Release: 2%{?dist}
Summary: Cartographic Python library with Matplotlib visualisations
License: LGPLv3
URL: http://scitools.org.uk/cartopy/docs/latest/
Source0: https://files.pythonhosted.org/packages/source/C/%{Srcname}/%{Srcname}-%{version}.tar.gz
# Set location of Fedora-provided pre-existing data.
Source1: siteconfig.py
# https://github.com/SciTools/cartopy/pull/1032
Patch0001: 0001-Merge-pull-request-1032-from-QuLogic-test-updates.patch
# Probably won't go upstream.
Patch0002: 0002-Skip-doctest-that-uses-the-network.patch
# https://github.com/SciTools/cartopy/pull/1037
Patch0003: 0003-Add-ne_-prefix-to-NaturalEarth-cache-files.patch
# Might not go upstream in current form.
Patch0004: 0004-Increase-tolerance-for-new-FreeType.patch
# https://github.com/SciTools/cartopy/pull/1042
Patch0005: 0005-Normalize-grid-coordinates-used-for-interpolation.patch
Source5: %{Srcname}-norm-images.tar.xz
# Might not go upstream.
Patch0006: 0006-Increase-some-tolerances-for-32-bit-systems.patch
# Due to https://github.com/matplotlib/matplotlib/issues/7797; not necessary
# with Matplotlib 2.1.0.
Patch0007: 0007-Increase-tolerance-for-non-x86-systems.patch
BuildRequires: geos-devel >= 3.3.3
BuildRequires: proj-devel >= 4.9.0
%global _description \
Cartopy is a Python package designed to make drawing maps for data analysis \
and visualisation easy. It features: \
* object oriented projection definitions \
* point, line, polygon and image transformations between projections \
* integration to expose advanced mapping in matplotlib with a simple and \
intuitive interface \
* powerful vector data handling by integrating shapefile reading with Shapely \
capabilities
%description %{_description}
%package -n python2-%{srcname}
Summary: %{summary}
%{?python_provide:%python_provide python2-%{srcname}}
BuildRequires: python2-devel
BuildRequires: python2-setuptools >= 0.7.2
BuildRequires: python2-Cython >= 0.15.1
BuildRequires: python2-six >= 1.3.0
BuildRequires: python2-numpy >= 1.6
BuildRequires: python-shapely >= 1.5.6
BuildRequires: python2-pyshp >= 1.1.4
# OWS requirements
BuildRequires: python-OWSLib >= 0.8.11
BuildRequires: python2-pillow >= 1.7.8
# Plotting requirements
BuildRequires: python2-matplotlib >= 1.3.0
BuildRequires: gdal-python >= 1.10.0
BuildRequires: python2-pillow >= 1.7.8
BuildRequires: python2-scipy >= 0.10
# Testing requirements
BuildRequires: python2-mock >= 1.0.1
BuildRequires: python2-pytest >= 3.0.0
%if %{fedora} < 28
# For old matplotlib
BuildRequires: python2-nose
%endif
Requires: python-%{srcname}-common = %{version}-%{release}
Requires: python2-six >= 1.3.0
Requires: python2-numpy >= 1.6
Requires: python-shapely >= 1.5.6
Requires: python2-pyshp >= 1.1.4
Requires: python2-setuptools >= 0.7.2
# OWS requirements
Recommends: python-OWSLib >= 0.8.11
Recommends: python2-pillow >= 1.7.8
# Plotting requirements
Recommends: python2-matplotlib >= 1.3.0
Recommends: gdal-python >= 1.10.0
Recommends: python2-pillow >= 1.7.8
Recommends: python2-scipy >= 0.10
%description -n python2-%{srcname} %{_description}
%package -n python3-%{srcname}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{srcname}}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-Cython >= 0.15.1
BuildRequires: python3-six >= 1.3.0
BuildRequires: python3-numpy >= 1.6
BuildRequires: python3-shapely >= 1.5.6
BuildRequires: python3-pyshp >= 1.1.4
# OWS requirements
BuildRequires: python3-OWSLib >= 0.8.11
BuildRequires: python3-pillow >= 1.7.8
# Plotting requirements
BuildRequires: python3-matplotlib >= 1.3.0
BuildRequires: gdal-python3 >= 1.10.0
BuildRequires: python3-pillow >= 1.7.8
BuildRequires: python3-scipy >= 0.10
# Testing requirements
BuildRequires: python3-mock >= 1.0.1
BuildRequires: python3-pytest >= 3.0.0
%if %{fedora} < 28
# For old matplotlib
BuildRequires: python3-nose
%endif
Requires: python-%{srcname}-common = %{version}-%{release}
Requires: python3-setuptools >= 0.7.2
Requires: python3-six >= 1.3.0
Requires: python3-numpy >= 1.6
Requires: python3-shapely >= 1.5.6
Requires: python3-pyshp >= 1.1.4
# OWS requirements
Recommends: python3-OWSLib >= 0.8.11
Recommends: python3-pillow >= 1.7.8
# Plotting requirements
Recommends: python3-matplotlib >= 1.3.0
Recommends: gdal-python3 >= 1.10.0
Recommends: python3-pillow >= 1.7.8
Recommends: python3-scipy >= 0.10
%description -n python3-%{srcname} %{_description}
%package -n python-%{srcname}-common
Summary: Data files for %{srcname}
BuildArch: noarch
%if 0%{?test_natural_earth}
BuildRequires: natural-earth-map-data-110m
BuildRequires: natural-earth-map-data-50m
%endif
Recommends: natural-earth-map-data-110m
Suggests: natural-earth-map-data-50m
Suggests: natural-earth-map-data-10m
%description -n python-%{srcname}-common
Data files for %{srcname}.
%prep
%autosetup -n %{Srcname}-%{version} -p1
cp -a %SOURCE1 lib/cartopy/
%setup -q -n %{Srcname}-%{version} -D -T -a 5
# Remove bundled egg-info
rm -rf %{srcname}.egg-info
%build
%py2_build
# Purge generated Cython files.
rm -f lib/cartopy/trace.cpp lib/cartopy/trace.pyd
rm -f lib/cartopy/_crs.c lib/cartopy/_crs.pyd
rm -f lib/cartopy/geodesic/_geodesic.c lib/cartopy/geodesic/_geodesic.pyd
%py3_build
%install
%py3_install
%py2_install
mkdir -p %{buildroot}%{_datadir}/cartopy/shapefiles/natural_earth/
for theme in physical cultural; do
ln -s %{_datadir}/natural-earth-map-data/${theme} \
%{buildroot}%{_datadir}/cartopy/shapefiles/natural_earth/${theme}
done
%check
PYTHONPATH="%{buildroot}%{python2_sitearch}" MPLBACKEND=Agg \
pytest-2 --doctest-modules --pyargs cartopy -m "not network%{!?test_natural_earth: and not natural_earth}"
PYTHONPATH="%{buildroot}%{python3_sitearch}" MPLBACKEND=Agg \
pytest-3 --doctest-modules --pyargs cartopy -m "not network%{!?test_natural_earth: and not natural_earth}"
%files -n python-%{srcname}-common
%doc README.rst
%license COPYING.LESSER lib/cartopy/data/LICENSE
%{_datadir}/cartopy/
%files -n python2-%{srcname}
%{python2_sitearch}/cartopy
%{python2_sitearch}/%{Srcname}-%{version}-py?.?.egg-info
%files -n python3-%{srcname}
%{python3_sitearch}/cartopy
%{python3_sitearch}/%{Srcname}-%{version}-py?.?.egg-info
%changelog
* Sun Feb 25 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.16.0-2
- Enable testing with now-packaged Natural Earth data.
* Fri Feb 23 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.16.0-1
- Initial package.