15
0
forked from pool/python-Pillow

Accepting request 487684 from devel:languages:python:singlespec

1

OBS-URL: https://build.opensuse.org/request/show/487684
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Pillow?expand=0&rev=55
This commit is contained in:
Todd R
2017-04-12 18:20:07 +00:00
committed by Git OBS Bridge
parent 0bb3e57c4d
commit b2749c985e
5 changed files with 465 additions and 163 deletions

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-Pillow
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2017 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
@@ -16,22 +16,31 @@
#
%define oldpython python
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-Pillow
Version: 3.1.1
Version: 4.1.0
Release: 0
Summary: Python Imaging Library (Fork)
License: HPND
Group: Development/Languages/Python
Url: http://python-imaging.github.io/
Source: https://pypi.python.org/packages/source/P/Pillow/Pillow-%{version}.tar.gz
# PATCH-FIX-UPSTREAM python-Pillow-tests-update-epsilon-for-freetype27.patch gh#python-pillow/Pillow#2116 badshah400@gmail.com -- Fix buildfailures against freetype 2.7 by increasing the epsilon
Patch0: python-Pillow-tests-update-epsilon-for-freetype27.patch
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: python-tk
BuildRequires: %{python_module devel}
BuildRequires: %{python_module nose}
BuildRequires: %{python_module olefile}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module tk}
BuildRequires: fdupes
BuildRequires: freetype2-devel
BuildRequires: libtiff-devel
BuildRequires: python-rpm-macros
BuildRequires: tix
BuildRequires: tk-devel
BuildRequires: unzip
BuildRequires: zlib-devel
Requires: python-olefile
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1210
BuildRequires: libjpeg8-devel
BuildRequires: liblcms2-devel
@@ -42,31 +51,29 @@ BuildRequires: lcms2-devel
BuildRequires: libjpeg-turbo-devel
BuildRequires: libwebp-devel
%else
BuildRequires: python-unittest2
BuildRequires: %{python_module unittest2}
%endif
%endif
%if 0%{?suse_version} > 1315
BuildRequires: openjpeg2-devel
%endif
BuildRequires: freetype2-devel
BuildRequires: libtiff-devel
BuildRequires: python-nose
BuildRequires: zlib-devel
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitearch: %global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%endif
%ifpython2
Obsoletes: %{oldpython}-imaging-sane
Provides: %{oldpython}-imaging-sane
# Pillow is a friendly PIL fork which we package as 'imaging', the latter isn't obsolete though:
Conflicts: python-imaging < %{version}
# NOTE(saschpe): python-imaging should have never provided this and I'm a bit relucatant do it either.
# http://en.opensuse.org/openSUSE:Upgrade_dependencies_explanation#Replace_a_package_by_another_with_the_same_functionality
# ALSO NOTE (frispete): without providing python-imaging, all packages requiring it will break
Provides: python-imaging = %{version}
Obsoletes: python-imaging-sane
Provides: python-imaging-sane
Conflicts: %{oldpython}-imaging < %{version}
Provides: %{oldpython}-imaging = %{version}
%endif
# explicitly do this for python 2 and 3 but not other versions which never had an -imaging package
%ifpython3
Conflicts: python3-imaging < %{version}
Provides: python3-imaging = %{version}
%endif
%python_subpackages
%description
Pillow is the "friendly" PIL fork by Alex Clark and Contributors. PIL is the
@@ -76,13 +83,15 @@ Python Imaging Library by Fredrik Lundh and Contributors.
Summary: Python Imaging Library (Fork) - Tcl/Tk Module
Group: Development/Languages/Python
Requires: %{name} = %{version}
# NOTE: We don't need to conflict with python-imaging here,
%ifpython2
# NOTE: We don't need to conflict with python-imaging here,
# because this package depends on python-Pillow, which already conflicts with python-imaging,
# so this cannot be installed alongside python-imaging
# And we cannot conflict with python-imaging directly, since python-Pillow provides python-imaging
# Just in case, conflict with python-imaging-tk in case it is ever implemented.
Obsoletes: python-imaging-tk
Provides: python-imaging-tk
Obsoletes: %{oldpython}-imaging-tk
Provides: %{oldpython}-imaging-tk
%endif
%description tk
Pillow is the "friendly" PIL fork by Alex Clark and Contributors. PIL is the
@@ -93,105 +102,61 @@ Python Imaging Library by Fredrik Lundh and Contributors.
%prep
%setup -q -n Pillow-%{version}
%patch0 -p1
%build
# no need to build it here, as setup.py install will build it again, anyway
%python_build
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
%python_install
for p in pilconvert pildriver pilfile pilfont pilprint createfontdatachunk enhancer explode gifmaker painter player thresholder viewer; do
mv %{buildroot}%{_bindir}/$p.py %{buildroot}%{_bindir}/$p-%{py_ver}
ln -s -f %{_sysconfdir}/alternatives/$p %{buildroot}%{_bindir}/$p
touch %{buildroot}%{_sysconfdir}/alternatives/$p
# retain old alternative-based names
mv %{buildroot}%{_bindir}/$p.py %{buildroot}%{_bindir}/$p
done
%fdupes %{buildroot}%{_prefix}
# add missing path
echo "PIL" > %{buildroot}%{python_sitearch}/PIL.pth
%{python_expand echo "PIL" > %{buildroot}%{$python_sitearch}/PIL.pth}
%check
%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitearch}
%ifarch ppc ppc64 s390 s390x
PYTHONPATH=%{buildroot}/%{python_sitearch} python selftest.py --installed || \
$python selftest.py --installed || \
echo "WARNING ignore failure https://github.com/python-pillow/Pillow/issues/1204"
PYTHONPATH=%{buildroot}/%{python_sitearch} python test-installed.py || \
$python test-installed.py || \
echo "WARNING ignore failure https://github.com/python-pillow/Pillow/issues/1204"
%else
PYTHONPATH=%{buildroot}/%{python_sitearch} python selftest.py --installed
PYTHONPATH=%{buildroot}/%{python_sitearch} python test-installed.py
$python selftest.py --installed
$python test-installed.py
%endif
}
%post
update-alternatives \
--install %{_bindir}/pilconvert pilconvert %{_bindir}/pilconvert-%{py_ver} 20 \
--slave %{_bindir}/pildriver pildriver %{_bindir}/pildriver-%{py_ver} \
--slave %{_bindir}/pilfile pilfile %{_bindir}/pilfile-%{py_ver} \
--slave %{_bindir}/pilfont pilfont %{_bindir}/pilfont-%{py_ver} \
--slave %{_bindir}/pilprint pilprint %{_bindir}/pilprint-%{py_ver} \
--slave %{_bindir}/createfontdatachunk createfontdatachunk %{_bindir}/createfontdatachunk-%{py_ver} \
--slave %{_bindir}/enhancer enhancer %{_bindir}/enhancer-%{py_ver} \
--slave %{_bindir}/explode explode %{_bindir}/explode-%{py_ver} \
--slave %{_bindir}/gifmaker gifmaker %{_bindir}/gifmaker-%{py_ver} \
--slave %{_bindir}/painter painter %{_bindir}/painter-%{py_ver} \
--slave %{_bindir}/player player %{_bindir}/player-%{py_ver} \
--slave %{_bindir}/thresholder thresholder %{_bindir}/thresholder-%{py_ver} \
--slave %{_bindir}/viewer viewer %{_bindir}/viewer-%{py_ver}
%preun
if [ $1 -eq 0 ] ; then
update-alternatives --remove pilconvert %{_bindir}/pilconvert-%{py_ver}
fi
%files
%files %{python_files}
%defattr(-,root,root,-)
%doc CHANGES.rst README.rst LICENSE
%{_bindir}/pilconvert
%{_bindir}/pildriver
%{_bindir}/pilfile
%{_bindir}/pilfont
%{_bindir}/pilprint
%{_bindir}/createfontdatachunk
%{_bindir}/enhancer
%{_bindir}/explode
%{_bindir}/gifmaker
%{_bindir}/painter
%{_bindir}/player
%{_bindir}/thresholder
%{_bindir}/viewer
%{_bindir}/pilconvert-%{py_ver}
%{_bindir}/pildriver-%{py_ver}
%{_bindir}/pilfile-%{py_ver}
%{_bindir}/pilfont-%{py_ver}
%{_bindir}/pilprint-%{py_ver}
%{_bindir}/createfontdatachunk-%{py_ver}
%{_bindir}/enhancer-%{py_ver}
%{_bindir}/explode-%{py_ver}
%{_bindir}/gifmaker-%{py_ver}
%{_bindir}/painter-%{py_ver}
%{_bindir}/player-%{py_ver}
%{_bindir}/thresholder-%{py_ver}
%{_bindir}/viewer-%{py_ver}
%python3_only %{_bindir}/pilconvert
%python3_only %{_bindir}/pildriver
%python3_only %{_bindir}/pilfile
%python3_only %{_bindir}/pilfont
%python3_only %{_bindir}/pilprint
%python3_only %{_bindir}/createfontdatachunk
%python3_only %{_bindir}/enhancer
%python3_only %{_bindir}/explode
%python3_only %{_bindir}/gifmaker
%python3_only %{_bindir}/painter
%python3_only %{_bindir}/player
%python3_only %{_bindir}/thresholder
%python3_only %{_bindir}/viewer
%{python_sitearch}/PIL
%{python_sitearch}/PIL.pth
%{python_sitearch}/Pillow-%{version}-py%{py_ver}.egg-info
%{python_sitearch}/Pillow-%{version}-py%{python_version}.egg-info
%exclude %{python_sitearch}/PIL/ImageTk*
%exclude %{python_sitearch}/PIL/_imagingtk*
%ghost %{_sysconfdir}/alternatives/pilconvert
%ghost %{_sysconfdir}/alternatives/pildriver
%ghost %{_sysconfdir}/alternatives/pilfile
%ghost %{_sysconfdir}/alternatives/pilfont
%ghost %{_sysconfdir}/alternatives/pilprint
%ghost %{_sysconfdir}/alternatives/createfontdatachunk
%ghost %{_sysconfdir}/alternatives/enhancer
%ghost %{_sysconfdir}/alternatives/explode
%ghost %{_sysconfdir}/alternatives/gifmaker
%ghost %{_sysconfdir}/alternatives/painter
%ghost %{_sysconfdir}/alternatives/player
%ghost %{_sysconfdir}/alternatives/thresholder
%ghost %{_sysconfdir}/alternatives/viewer
%pycache_only %exclude %{python_sitearch}/PIL/__pycache__/ImageTk.*
%files tk
%files %{python_files tk}
%defattr(-,root,root,-)
%{python_sitearch}/PIL/ImageTk*
%{python_sitearch}/PIL/_imagingtk*
%pycache_only %{python_sitearch}/PIL/__pycache__/ImageTk.*
%changelog