File python-rasterio.spec of Package python-rasterio

#
# spec file for package python-rasterio
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%{?!python_module:%define python_module() python3-%{**}}
%define pythons python3
Name:           python-rasterio
Version:        1.4.3
Release:        0
Summary:        Raster I/O package for use with Numpy and SciPy
License:        BSD-3-Clause
Group:          Development/Languages/Python
URL:            https://github.com/mapbox/rasterio
# pypi source lack test data
Source:         https://github.com/mapbox/rasterio/archive/%{version}.tar.gz#/rasterio-%{version}.tar.gz
Patch0:         v1.4.3-transform-hotfix.patch
BuildRequires:  %{python_module Cython}
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module fsspec}
BuildRequires:  %{python_module numpy-devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  pkgconfig
BuildRequires:  python-rpm-macros
BuildRequires:  pkgconfig(gdal) >= 3.1
Requires:       python-GDAL
Requires:       python-affine
Requires:       python-attrs
Requires:       python-certifi
Requires:       python-click >= 4.0
Requires:       python-click-plugins
Requires:       python-cligj >= 0.7.2
Requires:       python-numpy
Requires(post): update-alternatives
Requires(postun): update-alternatives
Recommends:     python-boto3
Recommends:     python-ipython >= 2.0
Recommends:     python-matplotlib
# SECTION test requirements
BuildRequires:  %{python_module GDAL}
BuildRequires:  %{python_module affine}
BuildRequires:  %{python_module attrs}
BuildRequires:  %{python_module boto3 >= 1.2.4}
BuildRequires:  %{python_module certifi}
BuildRequires:  %{python_module click >= 4.0}
BuildRequires:  %{python_module click-plugins}
BuildRequires:  %{python_module cligj >= 0.7.2}
BuildRequires:  %{python_module hypothesis}
BuildRequires:  %{python_module matplotlib}
BuildRequires:  %{python_module packaging}
BuildRequires:  %{python_module pytest >= 2.8.2}
BuildRequires:  %{python_module shapely}
BuildRequires:  %{python_module snuggs >= 1.4.1}
BuildRequires:  proj >= 6.0
# /SECTION
%python_subpackages

%description
Rasterio is raster I/O package for use with Numpy and SciPy. It
employs GDAL under the hood for file I/O and raster formatting. Its
functions typically accept and return Numpy ndarrays.

%prep
%setup -q -n rasterio-%{version}
%autopatch -p1

%build
%python_build

%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitearch}
%python_clone -a %{buildroot}%{_bindir}/rio

%post
%python_install_alternative rio

%postun
%python_uninstall_alternative rio

%check
mv rasterio rasterio_temp
# We need to exclude tests which require a network connection and tests dependent on specific paths
%pytest_arch -rs -m 'not (wheel or network)'
mv rasterio_temp rasterio

%files %{python_files}
%doc AUTHORS.txt CHANGES.txt README.rst
%license LICENSE.txt
%python_alternative %{_bindir}/rio
%{python_sitearch}/rasterio
%{python_sitearch}/rasterio-%{version}*-info

%changelog
openSUSE Build Service is sponsored by