08526f0
%global py2_incdir %{_includedir}/python%{python_version}
08526f0
%global py3_incdir %{_includedir}/python%{python3_version}
08526f0
08526f0
%global name3 python3-pillow
08526f0
%global with_python3 0
08526f0
08526f0
# Refer to the comment for Source0 below on how to obtain the source tarball
08526f0
# The saved file has format python-imaging-Pillow-$version-$ahead-g$shortcommit.tar.gz
08526f0
%global commit 78667598270a78dc9eb4cf05c85d09f39be2e394
08526f0
%global shortcommit %(c=%{commit}; echo ${c:0:7})
08526f0
%global ahead 137
08526f0
08526f0
Name:           python-pillow
08526f0
Version:        1.7.8
08526f0
Release:        4.20130305git%{shortcommit}%{?dist}
08526f0
Summary:        Python 2 image processing library
08526f0
08526f0
# License: see http://www.pythonware.com/products/pil/license.htm
08526f0
License:        MIT
08526f0
URL:            http://python-imaging.github.com/Pillow/
08526f0
08526f0
# Obtain the tarball for a certain commit via:
08526f0
#  wget --content-disposition https://github.com/python-imaging/Pillow/tarball/$commit
08526f0
Source0:        https://github.com/python-imaging/Pillow/tarball/%{commit}/python-imaging-Pillow-%{version}-%{ahead}-g%{shortcommit}.tar.gz
08526f0
08526f0
BuildRequires:  python2-devel
08526f0
BuildRequires:  python-setuptools
08526f0
BuildRequires:  tkinter
08526f0
BuildRequires:  tk-devel
08526f0
BuildRequires:  python-sphinx
08526f0
BuildRequires:  libjpeg-devel
08526f0
BuildRequires:  zlib-devel
08526f0
BuildRequires:  freetype-devel
08526f0
BuildRequires:  lcms-devel
08526f0
BuildRequires:  sane-backends-devel
08526f0
08526f0
%if %{with_python3}
08526f0
BuildRequires:  python3-devel
08526f0
BuildRequires:  python3-setuptools
08526f0
BuildRequires:  python3-tkinter
08526f0
%endif
08526f0
08526f0
Provides:       python-imaging = %{version}-%{release}
08526f0
Obsoletes:      python-imaging <= 1.1.7-12
08526f0
08526f0
%filter_provides_in %{python_sitearch}
08526f0
%filter_provides_in %{python3_sitearch}
08526f0
%filter_setup
08526f0
08526f0
%description
08526f0
Python image processing library, fork of the Python Imaging Library (PIL)
08526f0
08526f0
This library provides extensive file format support, an efficient
08526f0
internal representation, and powerful image processing capabilities.
08526f0
08526f0
Notice that in order to reduce the package dependencies there are
08526f0
three subpackages: devel (for development); tk (to interact with the
08526f0
tk interface) and sane (scanning devices interface).
08526f0
08526f0
08526f0
%package devel
08526f0
Summary:        Development files for %{name}
08526f0
Group:          Development/Libraries
08526f0
Requires:       %{name}%{?_isa} = %{version}-%{release}
08526f0
Requires:       python-devel, libjpeg-devel, zlib-devel
08526f0
Provides:       python-imaging-devel = %{version}-%{release}
08526f0
Obsoletes:      python-imaging-devel <= 1.1.7-12
08526f0
08526f0
%description devel
08526f0
Development files for %{name}.
08526f0
08526f0
08526f0
%package doc
08526f0
Summary:        Documentation for %{name}
08526f0
Group:          Documentation
08526f0
Requires:       %{name} = %{version}-%{release}
08526f0
BuildArch:      noarch
08526f0
08526f0
%description doc
08526f0
Documentation for %{name}.
08526f0
08526f0
08526f0
%package sane
08526f0
Summary:        Python module for using scanners
08526f0
Group:          System Environment/Libraries
08526f0
Requires:       %{name}%{?_isa} = %{version}-%{release}
08526f0
Provides:       python-imaging-sane = %{version}-%{release}
08526f0
Obsoletes:      python-imaging-sane <= 1.1.7-12
08526f0
08526f0
%description sane
08526f0
This package contains the sane module for Python which provides access to
08526f0
various raster scanning devices such as flatbed scanners and digital cameras.
08526f0
08526f0
08526f0
%package tk
08526f0
Summary:        Tk interface for %{name}
08526f0
Group:          System Environment/Libraries
08526f0
Requires:       %{name}%{?_isa} = %{version}-%{release}
08526f0
Requires:       tkinter
08526f0
Provides:       python-imaging-tk = %{version}-%{release}
08526f0
Obsoletes:      python-imaging-tk <= 1.1.7-12
08526f0
08526f0
%description tk
08526f0
Tk interface for %{name}.
08526f0
08526f0
08526f0
%if %{with_python3}
08526f0
%package -n %{name3}
08526f0
Summary:        Python 3 image processing library
08526f0
08526f0
%description -n %{name3}
08526f0
%{_description}
08526f0
08526f0
08526f0
%package -n %{name3}-devel
08526f0
Summary:        Development files for %{name3}
08526f0
Group:          Development/Libraries
08526f0
Requires:       %{name3}%{?_isa} = %{version}-%{release}
08526f0
Requires:       python3-devel, libjpeg-devel, zlib-devel
08526f0
08526f0
%description -n %{name3}-devel
08526f0
Development files for %{name3}.
08526f0
08526f0
08526f0
%package -n %{name3}-doc
08526f0
Summary:        Documentation for %{name3}
08526f0
Group:          Documentation
08526f0
Requires:       %{name3} = %{version}-%{release}
08526f0
BuildArch:      noarch
08526f0
08526f0
%description -n %{name3}-doc
08526f0
Documentation for %{name3}.
08526f0
08526f0
08526f0
%package -n %{name3}-sane
08526f0
Summary:        Python module for using scanners
08526f0
Group:          System Environment/Libraries
08526f0
Requires:       %{name3}%{?_isa} = %{version}-%{release}
08526f0
08526f0
%description -n %{name3}-sane
08526f0
This package contains the sane module for Python which provides access to
08526f0
various raster scanning devices such as flatbed scanners and digital cameras.
08526f0
08526f0
08526f0
%package -n %{name3}-tk
08526f0
Summary:        Tk interface for %{name3}
08526f0
Group:          System Environment/Libraries
08526f0
Requires:       %{name3}%{?_isa} = %{version}-%{release}
08526f0
Requires:       tkinter
08526f0
08526f0
%description -n %{name3}-tk
08526f0
Tk interface for %{name3}.
08526f0
%endif
08526f0
08526f0
08526f0
%prep
08526f0
%setup -q -n python-imaging-Pillow-%{shortcommit}
08526f0
08526f0
%if %{with_python3}
08526f0
# Create Python 3 source tree
08526f0
rm -rf %{py3dir}
08526f0
cp -a . %{py3dir}
08526f0
%endif
08526f0
08526f0
08526f0
%build
08526f0
# Build Python 2 modules
08526f0
find -name '*.py' | xargs sed -i '1s|^#!.*python|#!%{__python}|'
08526f0
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
08526f0
08526f0
pushd Sane
08526f0
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
08526f0
popd
08526f0
08526f0
pushd docs
08526f0
make html
08526f0
rm -f _build/html/.buildinfo
08526f0
popd
08526f0
08526f0
%if %{with_python3}
08526f0
# Build Python 3 modules
08526f0
pushd %{py3dir}
08526f0
find -name '*.py' | xargs sed -i '1s|^#!.*python|#!%{__python3}|'
08526f0
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
08526f0
08526f0
pushd Sane
08526f0
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
08526f0
popd
08526f0
08526f0
pushd docs
08526f0
make html
08526f0
rm -f _build/html/.buildinfo
08526f0
popd
08526f0
popd
08526f0
%endif
08526f0
08526f0
08526f0
%install
08526f0
rm -rf $RPM_BUILD_ROOT
08526f0
08526f0
# Install Python 2 modules
08526f0
install -d $RPM_BUILD_ROOT/%{py2_incdir}/Imaging
08526f0
install -m 644 libImaging/*.h $RPM_BUILD_ROOT/%{py2_incdir}/Imaging
08526f0
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
08526f0
pushd Sane
08526f0
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
08526f0
popd
08526f0
08526f0
%if %{with_python3}
08526f0
# Install Python 3 modules
08526f0
pushd %{py3dir}
08526f0
install -d $RPM_BUILD_ROOT/%{py3_incdir}/Imaging
08526f0
install -m 644 libImaging/*.h $RPM_BUILD_ROOT/%{py3_incdir}/Imaging
08526f0
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
08526f0
pushd Sane
08526f0
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
08526f0
popd
08526f0
popd
08526f0
%endif
08526f0
08526f0
# The scripts are packaged in %%doc
08526f0
rm -rf $RPM_BUILD_ROOT%{_bindir}
08526f0
08526f0
08526f0
%check
08526f0
# Check Python 2 modules
08526f0
ln -s $PWD/Images $RPM_BUILD_ROOT%{python_sitearch}/Images
08526f0
ln -s $PWD/selftest.py $RPM_BUILD_ROOT%{python_sitearch}/selftest.py
08526f0
pushd $RPM_BUILD_ROOT%{python_sitearch}
08526f0
%{__python} selftest.py
08526f0
popd
08526f0
rm $RPM_BUILD_ROOT%{python_sitearch}/Images
08526f0
rm $RPM_BUILD_ROOT%{python_sitearch}/selftest.py*
08526f0
08526f0
%if %{with_python3}
08526f0
# Check Python 3 modules
08526f0
pushd %{py3dir}
08526f0
ln -s $PWD/Images $RPM_BUILD_ROOT%{python3_sitearch}/Images
08526f0
ln -s $PWD/selftest.py $RPM_BUILD_ROOT%{python3_sitearch}/selftest.py
08526f0
pushd $RPM_BUILD_ROOT%{python3_sitearch}
08526f0
%{__python3} selftest.py
08526f0
popd
08526f0
rm $RPM_BUILD_ROOT%{python3_sitearch}/Images
08526f0
rm $RPM_BUILD_ROOT%{python3_sitearch}/selftest.py*
08526f0
popd
08526f0
%endif
08526f0
08526f0
08526f0
%files
08526f0
%doc README.rst docs/CHANGES docs/HISTORY.txt COPYING
08526f0
%{python_sitearch}/*
08526f0
%exclude %{python_sitearch}/*sane*
08526f0
%exclude %{python_sitearch}/_imagingtk*
08526f0
%exclude %{python_sitearch}/PIL/ImageTk*
08526f0
%exclude %{python_sitearch}/PIL/SpiderImagePlugin*
08526f0
08526f0
%files devel
08526f0
%{py2_incdir}/Imaging/
08526f0
08526f0
%files doc
08526f0
%doc Scripts Images docs/_build/html
08526f0
08526f0
%files sane
08526f0
%doc Sane/CHANGES Sane/demo*.py Sane/sanedoc.txt
08526f0
%{python_sitearch}/*sane*
08526f0
08526f0
%files tk
08526f0
%{python_sitearch}/_imagingtk*
08526f0
%{python_sitearch}/PIL/ImageTk*
08526f0
%{python_sitearch}/PIL/SpiderImagePlugin*
08526f0
08526f0
%if %{with_python3}
08526f0
%files -n %{name3}
08526f0
%doc README.rst docs/CHANGES docs/HISTORY.txt COPYING
08526f0
%{python3_sitearch}/*
08526f0
%exclude %{python3_sitearch}/*sane*
08526f0
%exclude %{python3_sitearch}/_imagingtk*
08526f0
%exclude %{python3_sitearch}/PIL/ImageTk*
08526f0
%exclude %{python3_sitearch}/PIL/SpiderImagePlugin*
08526f0
08526f0
%files -n %{name3}-devel
08526f0
%{py3_incdir}/Imaging/
08526f0
08526f0
%files -n %{name3}-doc
08526f0
%doc Scripts Images docs/_build/html
08526f0
08526f0
%files -n %{name3}-sane
08526f0
%doc Sane/CHANGES Sane/demo*.py Sane/sanedoc.txt
08526f0
%{python3_sitearch}/*sane*
08526f0
08526f0
%files -n %{name3}-tk
08526f0
%{python3_sitearch}/_imagingtk*
08526f0
%{python3_sitearch}/PIL/ImageTk*
08526f0
%{python3_sitearch}/PIL/SpiderImagePlugin*
08526f0
%endif
08526f0
08526f0
%changelog
08526f0
* Tue Mar 05 2013 Sandro Mani <manisandro@gmail.com> - 1.7.8-4.20130305git7866759
08526f0
- Update to latest git snapshot
08526f0
- 0001-Cast-hash-table-values-to-unsigned-long.patch now upstream
08526f0
- Pillow-1.7.8-selftest.patch now upstream
08526f0
08526f0
* Mon Feb 25 2013 Sandro Mani <manisandro@gmail.com> - 1.7.8-3.20130210gite09ff61
08526f0
- Really remove -fno-strict-aliasing
08526f0
- Place comment on how to retreive source just above the Source0 line
08526f0
08526f0
* Mon Feb 18 2013 Sandro Mani <manisandro@gmail.com> - 1.7.8-2.20130210gite09ff61
08526f0
- Rebuild without -fno-strict-aliasing
08526f0
- Add patch for upstream issue #52
08526f0
08526f0
* Sun Feb 10 2013 Sandro Mani <manisandro@gmail.com> - 1.7.8-1.20130210gite09ff61
08526f0
- Initial RPM package