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