File python3-Pillow.spec of Package python3-Pillow

#
# spec file for package python3-Pillow
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


Name:           python3-Pillow
Version:        2.9.0
Release:        0
Summary:        Python Imaging Library (Fork)
License:        HPND
Group:          Development/Languages/Python
Url:            http://python-pillow.github.io/
Source:         https://pypi.python.org/packages/source/P/Pillow/Pillow-%{version}.tar.gz
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-tk
BuildRequires:  tix
BuildRequires:  tk-devel
BuildRequires:  unzip
%if 0%{?suse_version} > 1210
BuildRequires:  libjpeg8-devel
BuildRequires:  liblcms2-devel
BuildRequires:  libwebp-devel
%endif
%if 0%{?suse_version} > 1315
BuildRequires:  openjpeg2-devel
%endif
BuildRequires:  freetype2-devel
BuildRequires:  libtiff-devel
BuildRequires:  python3-nose
BuildRequires:  zlib-devel
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Pillow is the "friendly" PIL fork by Alex Clark and Contributors. PIL is the
Python Imaging Library by Fredrik Lundh and Contributors.

%package tk
Summary:        Python Imaging Library (Fork) - Tcl/Tk Module
Group:          Development/Languages/Python
Requires:       %{name} = %{version}

%description tk
Pillow is the "friendly" PIL fork by Alex Clark and Contributors. PIL is the
Python Imaging Library by Fredrik Lundh and Contributors.

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

%build
# no need to build it here, as setup.py install will build it again, anyway

%install
python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
for p in pilconvert pildriver pilfile pilfont pilprint ; do
  mv %{buildroot}%{_bindir}/$p.py %{buildroot}%{_bindir}/$p-%{py3_ver}
  ln -s %{_bindir}/$p-%{py3_ver} %{buildroot}%{_bindir}/$p
  ln -s %{_bindir}/$p-%{py3_ver} %{buildroot}%{_sysconfdir}/alternatives/$p
done

%check
PYTHONPATH=%{buildroot}/%{python3_sitearch} python3 selftest.py --installed
PYTHONPATH=%{buildroot}/%{python3_sitearch} python3 test-installed.py

%post
update-alternatives \
    --install %{_bindir}/pilconvert pilconvert %{_bindir}/pilconvert-%{py3_ver} 30 \
    --slave %{_bindir}/pildriver pildriver %{_bindir}/pildriver-%{py3_ver} \
    --slave %{_bindir}/pilfile pilfile %{_bindir}/pilfile-%{py3_ver} \
    --slave %{_bindir}/pilfont pilfont %{_bindir}/pilfont-%{py3_ver} \
    --slave %{_bindir}/pilprint pilprint %{_bindir}/pilprint-%{py3_ver}

%preun
if [ $1 -eq 0 ] ; then
    update-alternatives --remove pilconvert %{_bindir}/pilconvert-%{py3_ver}
fi

%files
%defattr(-,root,root,-)
%doc CHANGES.rst README.rst
%ghost %{_bindir}/pilconvert
%{_bindir}/pilconvert-%{py3_ver}
%ghost %{_bindir}/pildriver
%{_bindir}/pildriver-%{py3_ver}
%ghost %{_bindir}/pilfile
%{_bindir}/pilfile-%{py3_ver}
%ghost %{_bindir}/pilfont
%{_bindir}/pilfont-%{py3_ver}
%ghost %{_bindir}/pilprint
%{_bindir}/pilprint-%{py3_ver}
%{python3_sitearch}/PIL
%{python3_sitearch}/Pillow-%{version}-py%{py3_ver}.egg-info
%if 0%{?suse_version} != 1315
%exclude %{python3_sitearch}/PIL/ImageTk*
%exclude %{python3_sitearch}/PIL/_imagingtk*
%exclude %{python3_sitearch}/PIL/__pycache__/ImageTk.*.pyc
%endif
%if 0%{?suse_version} > 1210
%ghost %{_sysconfdir}/alternatives/pilconvert
%ghost %{_sysconfdir}/alternatives/pildriver
%ghost %{_sysconfdir}/alternatives/pilfile
%ghost %{_sysconfdir}/alternatives/pilfont
%ghost %{_sysconfdir}/alternatives/pilprint
%endif

%if 0%{?suse_version} != 1315
%files tk
%defattr(-,root,root,-)
%{python3_sitearch}/PIL/ImageTk*
%{python3_sitearch}/PIL/_imagingtk*
%{python3_sitearch}/PIL/__pycache__/ImageTk.*.pyc
%endif

%changelog
openSUSE Build Service is sponsored by