Blob Blame History Raw
%global srcname sane

# RHEL-7 doesn't have python 3
%if 0%{?rhel} == 7
  %global with_python3 0
%else
  %global with_python3 1
%endif

Name:           python-%{srcname}
Version:        2.8.3
Release:        5%{?dist}
Summary:        Python SANE interface

License:        MIT
URL:            https://github.com/python-pillow/Sane
Source0:        https://github.com/python-pillow/Sane/archive/v%{version}/Sane-%{version}.tar.gz

BuildRequires:  sane-backends-devel

BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
BuildRequires:  python2-sphinx

%if %{with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-sphinx
%endif

%filter_provides_in %{python2_sitearch}
%filter_provides_in %{python3_sitearch}
%filter_setup

%description
This package contains the sane module for Python which provides access to
various raster scanning devices such as flatbed scanners and digital cameras.


%package -n python2-%{srcname}
Summary:        Python 2 module for using scanners
Requires:       python2-pillow
Requires:       python2-numpy
%{?python_provide:%python_provide python2-%{srcname}}

%description -n python2-%{srcname}
This package contains the sane module for Python which provides access to
various raster scanning devices such as flatbed scanners and digital cameras.


%if %{with_python3}
%package -n python3-%{srcname}
Summary:        Python 3 module for using scanners
Requires:       python3-pillow
Requires:       python3-numpy
%{?python_provide:%python_provide python3-%{srcname}}

%description -n python3-%{srcname}
This package contains the sane module for Python which provides access to
various raster scanning devices such as flatbed scanners and digital cameras.
%endif


%prep
%setup -q -n Sane-%{version}


%build
# Build Python 2 modules
%py2_build

make -C doc html BUILDDIR=_build_py2 SPHINXBUILD=sphinx-build-%python2_version
rm -f doc/_build_py2/html/.buildinfo

%if %{with_python3}
# Build Python 3 modules
%py3_build

make -C doc html BUILDDIR=_build_py3 SPHINXBUILD=sphinx-build-%python3_version
rm -f doc/_build_py3/html/.buildinfo
%endif


%install
# Install Python 2 modules
%py2_install

# Fix non-standard-executable-perm
chmod 0755 %{buildroot}%{python2_sitearch}/*.so

%if %{with_python3}
# Install Python 3 modules
%py3_install

# Fix non-standard-executable-perm
chmod 0755 %{buildroot}%{python3_sitearch}/*.so
%endif


%files -n python2-%{srcname}
%doc CHANGES.rst sanedoc.txt example.py doc/_build_py2/html
%license COPYING
%{python2_sitearch}/*

%if %{with_python3}
%files -n python3-%{srcname}
%doc CHANGES.rst sanedoc.txt example.py doc/_build_py3/html
%license COPYING
%{python3_sitearch}/*
%endif


%changelog
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.3-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Fri Jul 07 2017 Igor Gnatenko <ignatenko@redhat.com> - 2.8.3-3
- Rebuild due to bug in RPM (RHBZ #1468476)

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Jan 02 2017 Sandro Mani <manisandro@gmail.com> - 2.8.3-1
- Update to 2.8.3

* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 2.8.2-6
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.8.2-5
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Sat Jul 02 2016 Sandro Mani <manisandro@gmail.com> - 2.8.2-4
- Modernize spec

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.8.2-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Sat Aug 08 2015 Sandro Mani <manisandro@gmail.com> - 2.8.2-1
- Update to 2.8.2

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.8.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Fri Mar 27 2015 Sandro Mani <manisandro@gmail.com> - 2.8.1-1
- Update to 2.8.1

* Sat Mar 07 2015 Sandro Mani <manisandro@gmail.com> - 2.8.0-1
- Update to 2.8.0

* Fri Jan 02 2015 Sandro Mani <manisandro@gmail.com> - 2.7.0-1
- Initial package