8ac5cc
%global py2_incdir %{_includedir}/python%{python_version}
8ac5cc
%global py3_incdir %{_includedir}/python%{python3_version}
8ac5cc
8ac5cc
%global name3 python3-pillow
8ac5cc
8ac5cc
# RHEL-7 doesn't have python 3
8ac5cc
%if 0%{?rhel} == 7
8ac5cc
  %global with_python3 0
8ac5cc
%else
8ac5cc
  %global with_python3 1
8ac5cc
%endif
8ac5cc
8ac5cc
# Refer to the comment for Source0 below on how to obtain the source tarball
8ac5cc
# The saved file has format python-imaging-Pillow-$version-$ahead-g$shortcommit.tar.gz
8ac5cc
%global commit d1c6db88d4dee462c6bbf4e22555e3ddd410d06a
8ac5cc
%global shortcommit %(c=%{commit}; echo ${c:0:7})
8ac5cc
%global ahead 105
8ac5cc
8ac5cc
# If ahead is 0, the tarball corresponds to a release version, otherwise to a git snapshot
8ac5cc
%if %{ahead} > 0
8ac5cc
%global snap .git%{shortcommit}
8ac5cc
%endif
8ac5cc
8ac5cc
Name:           python-pillow
8ac5cc
Version:        2.0.0
8ac5cc
Release:        12%{?snap}%{?dist}
8ac5cc
Summary:        Python image processing library
8ac5cc
8ac5cc
# License: see http://www.pythonware.com/products/pil/license.htm
8ac5cc
License:        MIT
8ac5cc
URL:            http://python-imaging.github.com/Pillow/
8ac5cc
8ac5cc
# Obtain the tarball for a certain commit via:
8ac5cc
#  wget --content-disposition https://github.com/python-imaging/Pillow/tarball/$commit
8ac5cc
Source0:        https://github.com/python-imaging/Pillow/tarball/%{commit}/python-imaging-Pillow-%{version}-%{ahead}-g%{shortcommit}.tar.gz
8ac5cc
8ac5cc
# Add s390* and ppc* archs
8ac5cc
Patch0:         python-pillow-archs.patch
8ac5cc
# Fix test hardcoded for little-endian
8ac5cc
Patch1:         python-pillow_endian.patch
8ac5cc
8ac5cc
BuildRequires:  python2-devel
8ac5cc
BuildRequires:  python-setuptools
8ac5cc
BuildRequires:  tkinter
8ac5cc
BuildRequires:  tk-devel
8ac5cc
BuildRequires:  python-sphinx
8ac5cc
BuildRequires:  libjpeg-devel
8ac5cc
BuildRequires:  zlib-devel
8ac5cc
BuildRequires:  freetype-devel
8ac5cc
BuildRequires:  sane-backends-devel
8ac5cc
# Don't build with webp support on s390* and ppc* archs
8ac5cc
# see bug #962091
8ac5cc
%ifnarch s390 s390x ppc ppc64
8ac5cc
BuildRequires:  libwebp-devel
8ac5cc
%endif
8ac5cc
BuildRequires:  PyQt4
8ac5cc
BuildRequires:  numpy
8ac5cc
8ac5cc
%if %{with_python3}
8ac5cc
BuildRequires:  python3-devel
8ac5cc
BuildRequires:  python3-setuptools
8ac5cc
BuildRequires:  python3-tkinter
8ac5cc
BuildRequires:  python3-PyQt4
8ac5cc
BuildRequires:  python3-numpy
8ac5cc
%endif
8ac5cc
8ac5cc
Provides:       python-imaging = %{version}-%{release}
8ac5cc
Obsoletes:      python-imaging <= 1.1.7-12
8ac5cc
8ac5cc
%if %{with_python3}
8ac5cc
Provides:       python3-imaging = %{version}-%{release}
8ac5cc
%endif
8ac5cc
8ac5cc
%filter_provides_in %{python_sitearch}
8ac5cc
%filter_provides_in %{python3_sitearch}
8ac5cc
%filter_setup
8ac5cc
8ac5cc
%description
8ac5cc
Python image processing library, fork of the Python Imaging Library (PIL)
8ac5cc
8ac5cc
This library provides extensive file format support, an efficient
8ac5cc
internal representation, and powerful image processing capabilities.
8ac5cc
8ac5cc
There are five subpackages: tk (tk interface), qt (PIL image wrapper for Qt),
8ac5cc
sane (scanning devices interface), devel (development) and doc (documentation).
8ac5cc
8ac5cc
8ac5cc
%package devel
8ac5cc
Summary:        Development files for %{name}
8ac5cc
Group:          Development/Libraries
8ac5cc
Requires:       %{name}%{?_isa} = %{version}-%{release}
8ac5cc
Requires:       python-devel, libjpeg-devel, zlib-devel
8ac5cc
Provides:       python-imaging-devel = %{version}-%{release}
8ac5cc
Obsoletes:      python-imaging-devel <= 1.1.7-12
8ac5cc
8ac5cc
%description devel
8ac5cc
Development files for %{name}.
8ac5cc
8ac5cc
8ac5cc
%package doc
8ac5cc
Summary:        Documentation for %{name}
8ac5cc
Group:          Documentation
8ac5cc
Requires:       %{name} = %{version}-%{release}
8ac5cc
8ac5cc
%description doc
8ac5cc
Documentation for %{name}.
8ac5cc
8ac5cc
8ac5cc
%package sane
8ac5cc
Summary:        Python module for using scanners
8ac5cc
Group:          System Environment/Libraries
8ac5cc
Requires:       %{name}%{?_isa} = %{version}-%{release}
8ac5cc
Provides:       python-imaging-sane = %{version}-%{release}
8ac5cc
Obsoletes:      python-imaging-sane <= 1.1.7-12
8ac5cc
8ac5cc
%description sane
8ac5cc
This package contains the sane module for Python which provides access to
8ac5cc
various raster scanning devices such as flatbed scanners and digital cameras.
8ac5cc
8ac5cc
8ac5cc
%package tk
8ac5cc
Summary:        Tk interface for %{name}
8ac5cc
Group:          System Environment/Libraries
8ac5cc
Requires:       %{name}%{?_isa} = %{version}-%{release}
8ac5cc
Requires:       tkinter
8ac5cc
Provides:       python-imaging-tk = %{version}-%{release}
8ac5cc
Obsoletes:      python-imaging-tk <= 1.1.7-12
8ac5cc
8ac5cc
%description tk
8ac5cc
Tk interface for %{name}.
8ac5cc
8ac5cc
%package qt
8ac5cc
Summary:        PIL image wrapper for Qt
8ac5cc
Group:          System Environment/Libraries
8ac5cc
Requires:       %{name}%{?_isa} = %{version}-%{release}
8ac5cc
Requires:       PyQt4
8ac5cc
Provides:       python-imaging-qt = %{version}-%{release}
8ac5cc
8ac5cc
%description qt
8ac5cc
PIL image wrapper for Qt.
8ac5cc
8ac5cc
8ac5cc
%if %{with_python3}
8ac5cc
%package -n %{name3}
8ac5cc
Summary:        Python 3 image processing library
8ac5cc
8ac5cc
%description -n %{name3}
8ac5cc
%{_description}
8ac5cc
8ac5cc
8ac5cc
%package -n %{name3}-devel
8ac5cc
Summary:        Development files for %{name3}
8ac5cc
Group:          Development/Libraries
8ac5cc
Requires:       %{name3}%{?_isa} = %{version}-%{release}
8ac5cc
Requires:       python3-devel, libjpeg-devel, zlib-devel
8ac5cc
8ac5cc
%description -n %{name3}-devel
8ac5cc
Development files for %{name3}.
8ac5cc
8ac5cc
8ac5cc
%package -n %{name3}-doc
8ac5cc
Summary:        Documentation for %{name3}
8ac5cc
Group:          Documentation
8ac5cc
Requires:       %{name3} = %{version}-%{release}
8ac5cc
8ac5cc
%description -n %{name3}-doc
8ac5cc
Documentation for %{name3}.
8ac5cc
8ac5cc
8ac5cc
%package -n %{name3}-sane
8ac5cc
Summary:        Python module for using scanners
8ac5cc
Group:          System Environment/Libraries
8ac5cc
Requires:       %{name3}%{?_isa} = %{version}-%{release}
8ac5cc
8ac5cc
%description -n %{name3}-sane
8ac5cc
This package contains the sane module for Python which provides access to
8ac5cc
various raster scanning devices such as flatbed scanners and digital cameras.
8ac5cc
8ac5cc
8ac5cc
%package -n %{name3}-tk
8ac5cc
Summary:        Tk interface for %{name3}
8ac5cc
Group:          System Environment/Libraries
8ac5cc
Requires:       %{name3}%{?_isa} = %{version}-%{release}
8ac5cc
Requires:       tkinter
8ac5cc
8ac5cc
%description -n %{name3}-tk
8ac5cc
Tk interface for %{name3}.
8ac5cc
8ac5cc
%package -n %{name3}-qt
8ac5cc
Summary:        PIL image wrapper for Qt
8ac5cc
Group:          System Environment/Libraries
8ac5cc
Obsoletes:      %{name3} <= 2.0.0-5.git93a488e8
8ac5cc
Requires:       %{name3}%{?_isa} = %{version}-%{release}
8ac5cc
Requires:       python3-PyQt4
8ac5cc
8ac5cc
%description -n %{name3}-qt
8ac5cc
PIL image wrapper for Qt.
8ac5cc
8ac5cc
%endif
8ac5cc
8ac5cc
8ac5cc
%prep
8ac5cc
%setup -q -n python-imaging-Pillow-%{shortcommit}
8ac5cc
%patch0 -p1 -b .archs
8ac5cc
%patch1 -p1 -b .endian
8ac5cc
8ac5cc
%if %{with_python3}
8ac5cc
# Create Python 3 source tree
8ac5cc
rm -rf %{py3dir}
8ac5cc
cp -a . %{py3dir}
8ac5cc
%endif
8ac5cc
8ac5cc
8ac5cc
%build
8ac5cc
# Build Python 2 modules
8ac5cc
find -name '*.py' | xargs sed -i '1s|^#!.*python|#!%{__python}|'
8ac5cc
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
8ac5cc
8ac5cc
pushd Sane
8ac5cc
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
8ac5cc
popd
8ac5cc
8ac5cc
pushd docs
8ac5cc
PYTHONPATH=$PWD/.. make html
8ac5cc
rm -f _build/html/.buildinfo
8ac5cc
popd
8ac5cc
8ac5cc
%if %{with_python3}
8ac5cc
# Build Python 3 modules
8ac5cc
pushd %{py3dir}
8ac5cc
find -name '*.py' | xargs sed -i '1s|^#!.*python|#!%{__python3}|'
8ac5cc
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
8ac5cc
8ac5cc
pushd Sane
8ac5cc
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
8ac5cc
popd
8ac5cc
8ac5cc
pushd docs
8ac5cc
PYTHONPATH=$PWD/.. make html
8ac5cc
rm -f _build/html/.buildinfo
8ac5cc
popd
8ac5cc
popd
8ac5cc
%endif
8ac5cc
8ac5cc
8ac5cc
%install
8ac5cc
rm -rf $RPM_BUILD_ROOT
8ac5cc
8ac5cc
# Install Python 2 modules
8ac5cc
install -d $RPM_BUILD_ROOT/%{py2_incdir}/Imaging
8ac5cc
install -m 644 libImaging/*.h $RPM_BUILD_ROOT/%{py2_incdir}/Imaging
8ac5cc
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
8ac5cc
pushd Sane
8ac5cc
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
8ac5cc
popd
8ac5cc
8ac5cc
%if %{with_python3}
8ac5cc
# Install Python 3 modules
8ac5cc
pushd %{py3dir}
8ac5cc
install -d $RPM_BUILD_ROOT/%{py3_incdir}/Imaging
8ac5cc
install -m 644 libImaging/*.h $RPM_BUILD_ROOT/%{py3_incdir}/Imaging
8ac5cc
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
8ac5cc
pushd Sane
8ac5cc
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
8ac5cc
popd
8ac5cc
popd
8ac5cc
%endif
8ac5cc
8ac5cc
# The scripts are packaged in %%doc
8ac5cc
rm -rf $RPM_BUILD_ROOT%{_bindir}
8ac5cc
8ac5cc
8ac5cc
%check
8ac5cc
# Check Python 2 modules
8ac5cc
ln -s $PWD/Images $RPM_BUILD_ROOT%{python_sitearch}/Images
8ac5cc
ln -s $PWD/Tests $RPM_BUILD_ROOT%{python_sitearch}/Tests
8ac5cc
ln -s $PWD/selftest.py $RPM_BUILD_ROOT%{python_sitearch}/selftest.py
8ac5cc
pushd $RPM_BUILD_ROOT%{python_sitearch}
8ac5cc
%{__python} selftest.py
8ac5cc
%{__python} Tests/run.py
8ac5cc
popd
8ac5cc
rm $RPM_BUILD_ROOT%{python_sitearch}/Images
8ac5cc
rm $RPM_BUILD_ROOT%{python_sitearch}/Tests
8ac5cc
rm $RPM_BUILD_ROOT%{python_sitearch}/selftest.py*
8ac5cc
8ac5cc
%if %{with_python3}
8ac5cc
# Check Python 3 modules
8ac5cc
pushd %{py3dir}
8ac5cc
ln -s $PWD/Images $RPM_BUILD_ROOT%{python3_sitearch}/Images
8ac5cc
ln -s $PWD/Tests $RPM_BUILD_ROOT%{python3_sitearch}/Tests
8ac5cc
ln -s $PWD/selftest.py $RPM_BUILD_ROOT%{python3_sitearch}/selftest.py
8ac5cc
pushd $RPM_BUILD_ROOT%{python3_sitearch}
8ac5cc
%{__python3} selftest.py
8ac5cc
%{__python3} Tests/run.py
8ac5cc
popd
8ac5cc
rm $RPM_BUILD_ROOT%{python3_sitearch}/Images
8ac5cc
rm $RPM_BUILD_ROOT%{python3_sitearch}/Tests
8ac5cc
rm $RPM_BUILD_ROOT%{python3_sitearch}/selftest.py*
8ac5cc
popd
8ac5cc
%endif
8ac5cc
8ac5cc
8ac5cc
%files
8ac5cc
%doc README.rst docs/HISTORY.txt COPYING
8ac5cc
%{python_sitearch}/*
8ac5cc
# These are in subpackages
8ac5cc
%exclude %{python_sitearch}/*sane*
8ac5cc
%exclude %{python_sitearch}/_imagingtk*
8ac5cc
%exclude %{python_sitearch}/PIL/ImageTk*
8ac5cc
%exclude %{python_sitearch}/PIL/SpiderImagePlugin*
8ac5cc
%exclude %{python_sitearch}/PIL/ImageQt*
8ac5cc
8ac5cc
%files devel
8ac5cc
%{py2_incdir}/Imaging/
8ac5cc
8ac5cc
%files doc
8ac5cc
%doc Scripts Images docs/_build/html
8ac5cc
8ac5cc
%files sane
8ac5cc
%doc Sane/CHANGES Sane/demo*.py Sane/sanedoc.txt
8ac5cc
%{python_sitearch}/*sane*
8ac5cc
8ac5cc
%files tk
8ac5cc
%{python_sitearch}/_imagingtk*
8ac5cc
%{python_sitearch}/PIL/ImageTk*
8ac5cc
%{python_sitearch}/PIL/SpiderImagePlugin*
8ac5cc
8ac5cc
%files qt
8ac5cc
%{python_sitearch}/PIL/ImageQt*
8ac5cc
8ac5cc
%if %{with_python3}
8ac5cc
%files -n %{name3}
8ac5cc
%doc README.rst docs/HISTORY.txt COPYING
8ac5cc
%{python3_sitearch}/*
8ac5cc
# These are in subpackages
8ac5cc
%exclude %{python3_sitearch}/*sane*
8ac5cc
%exclude %{python3_sitearch}/_imagingtk*
8ac5cc
%exclude %{python3_sitearch}/PIL/ImageTk*
8ac5cc
%exclude %{python3_sitearch}/PIL/SpiderImagePlugin*
8ac5cc
%exclude %{python3_sitearch}/PIL/ImageQt*
8ac5cc
8ac5cc
%files -n %{name3}-devel
8ac5cc
%{py3_incdir}/Imaging/
8ac5cc
8ac5cc
%files -n %{name3}-doc
8ac5cc
%doc Scripts Images docs/_build/html
8ac5cc
8ac5cc
%files -n %{name3}-sane
8ac5cc
%doc Sane/CHANGES Sane/demo*.py Sane/sanedoc.txt
8ac5cc
%{python3_sitearch}/*sane*
8ac5cc
8ac5cc
%files -n %{name3}-tk
8ac5cc
%{python3_sitearch}/_imagingtk*
8ac5cc
%{python3_sitearch}/PIL/ImageTk*
8ac5cc
%{python3_sitearch}/PIL/SpiderImagePlugin*
8ac5cc
8ac5cc
%files -n %{name3}-qt
8ac5cc
%{python3_sitearch}/PIL/ImageQt*
8ac5cc
8ac5cc
%endif
8ac5cc
8ac5cc
%changelog
8ac5cc
* Mon Jul 29 2013 Roman Rakus <rrakus@redhat.com> - 2.0.0-12
8ac5cc
- Mark doc subpackage arch dependent. Docs are built depending on supported
8ac5cc
  features, which are different across archs.
8ac5cc
  Resolves: rhbz#987839
8ac5cc
8ac5cc
* Wed Jul 24 2013 Roman Rakus <rrakus@redhat.com> - 2.0.0-11
8ac5cc
- Drop lcms support
8ac5cc
  Resolves: rhbz#987839
8ac5cc
8ac5cc
* Mon May 13 2013 Roman Rakus <rrakus@redhat.com> - 2.0.0-10
8ac5cc
- Build without webp support on s390* archs
8ac5cc
  Resolves: rhbz#962059
8ac5cc
8ac5cc
* Sat May 11 2013 Roman Rakus <rrakus@redhat.com> - 2.0.0-9.gitd1c6db8
8ac5cc
- Conditionaly disable build of python3 parts on RHEL system
8ac5cc
8ac5cc
* Wed May 08 2013 Sandro Mani <manisandro@gmail.com> - 2.0.0-8.gitd1c6db8
8ac5cc
- Add patch to fix test failure on big-endian
8ac5cc
8ac5cc
* Thu Apr 25 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 2.0.0-7.gitd1c6db8
8ac5cc
- Remove Obsoletes in the python-pillow-qt subpackage. Obsoletes isn't
8ac5cc
  appropriate since qt support didn't exist in the previous python-pillow
8ac5cc
  package so there's no reason to drag in python-pillow-qt when updating
8ac5cc
  python-pillow.
8ac5cc
8ac5cc
* Fri Apr 19 2013 Sandro Mani <manisandro@gmail.com> - 2.0.0-6.gitd1c6db8
8ac5cc
- Update to latest git
8ac5cc
- python-pillow_quantization.patch now upstream
8ac5cc
- python-pillow_endianness.patch now upstream
8ac5cc
- Add subpackage for ImageQt module, with correct dependencies
8ac5cc
- Add PyQt4 and numpy BR (for generating docs / running tests)
8ac5cc
8ac5cc
* Mon Apr 08 2013 Sandro Mani <manisandro@gmail.com> - 2.0.0-5.git93a488e
8ac5cc
- Reenable tests on bigendian, add patches for #928927
8ac5cc
8ac5cc
* Sun Apr 07 2013 Sandro Mani <manisandro@gmail.com> - 2.0.0-4.git93a488e
8ac5cc
- Update to latest git
8ac5cc
- disable tests on bigendian (PPC*, S390*) until rhbz#928927 is fixed
8ac5cc
8ac5cc
* Fri Mar 22 2013 Sandro Mani <manisandro@gmail.com> - 2.0.0-3.gitde210a2
8ac5cc
- python-pillow_tempfile.patch now upstream
8ac5cc
- Add python3-imaging provides (bug #924867)
8ac5cc
8ac5cc
* Fri Mar 22 2013 Sandro Mani <manisandro@gmail.com> - 2.0.0-2.git2e88848
8ac5cc
- Update to latest git
8ac5cc
- Remove python-pillow-disable-test.patch, gcc is now fixed
8ac5cc
- Add python-pillow_tempfile.patch to prevent a temporary file from getting packaged
8ac5cc
8ac5cc
* Tue Mar 19 2013 Sandro Mani <manisandro@gmail.com> - 2.0.0-1.git2f4207c
8ac5cc
- Update to 2.0.0 git snapshot
8ac5cc
- Enable python3 packages
8ac5cc
- Add libwebp-devel BR for Pillow 2.0.0
8ac5cc
8ac5cc
* Wed Mar 13 2013 Peter Robinson <pbrobinson@fedoraproject.org> 1.7.8-6.20130305git
8ac5cc
- Add ARM support
8ac5cc
8ac5cc
* Tue Mar 12 2013 Karsten Hopp <karsten@redhat.com> 1.7.8-5.20130305git
8ac5cc
- add s390* and ppc* to arch detection
8ac5cc
8ac5cc
* Tue Mar 05 2013 Sandro Mani <manisandro@gmail.com> - 1.7.8-4.20130305git7866759
8ac5cc
- Update to latest git snapshot
8ac5cc
- 0001-Cast-hash-table-values-to-unsigned-long.patch now upstream
8ac5cc
- Pillow-1.7.8-selftest.patch now upstream
8ac5cc
8ac5cc
* Mon Feb 25 2013 Sandro Mani <manisandro@gmail.com> - 1.7.8-3.20130210gite09ff61
8ac5cc
- Really remove -fno-strict-aliasing
8ac5cc
- Place comment on how to retreive source just above the Source0 line
8ac5cc
8ac5cc
* Mon Feb 18 2013 Sandro Mani <manisandro@gmail.com> - 1.7.8-2.20130210gite09ff61
8ac5cc
- Rebuild without -fno-strict-aliasing
8ac5cc
- Add patch for upstream issue #52
8ac5cc
8ac5cc
* Sun Feb 10 2013 Sandro Mani <manisandro@gmail.com> - 1.7.8-1.20130210gite09ff61
8ac5cc
- Initial RPM package