File python-imaging.spec of Package python-imaging

#
# spec file for package python-imaging
#
# Copyright (c) 2012 SUSE LINUX Products 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:           python-imaging
BuildRequires:  freetype2-devel
BuildRequires:  giflib-devel
BuildRequires:  libgphoto2-devel
BuildRequires:  liblcms-devel
BuildRequires:  libpng-devel
BuildRequires:  libtiff-devel
BuildRequires:  netpbm
BuildRequires:  python-devel
BuildRequires:  python-tk
BuildRequires:  tix
BuildRequires:  tk-devel
BuildRequires:  xorg-x11-devel
%if 0%{?suse_version} > 1210
BuildRequires:  libjpeg8-devel
%endif
%if 0%{?suse_version} > 1130
BuildRequires:  sane-backends-devel
%else
BuildRequires:  sane-backends
%endif
Url:            http://www.pythonware.com/products/pil/index.htm
%define pyver %(python -c 'import sys; print sys.version[:3]')
Version:        1.1.7
Release:        0
Provides:       _imaging.so
Provides:       _imagingtk.so
Provides:       pyimglib
Provides:       python_imaging_lib
Requires:       python < %{pyver}.99
Requires:       python >= %pyver
Requires:       python-tk
Requires:       tix
Requires:       tk
Obsoletes:      pyimglib
Summary:        The Python Imaging Library - PIL
License:        Python-2.0 ; MIT
Group:          Development/Libraries/Python
Source:         Imaging-%{version}.tar.bz2
Source1:        pil-handbook.pdf
Patch2:         Imaging-1.1.7-64bit.patch
Patch3:         Imaging-1.1.7-ssize.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The Python Imaging Library adds fairly powerful image processing
capabilities to the Python interpreter and provides extensive file
format support, and efficient internal representation.



Authors:
--------
    image-sig@python.org

%package sane
Provides:       python_imaging_sane
Summary:        Python SANE module
Group:          Development/Libraries/Python

%description sane
The SANE module provides an interface to the SANE scanner and frame
grabber interface for Linux. It is a part of the Python Imaging
Library.



Authors:
--------
    Andrew Kuchling
    Ralph Heinkel <rheinkel@email.de>

%prep
%setup -n Imaging-%{version}
%patch2
%patch3
cp %{S:1} .

%build
#
# Change python files header
for f in `find . -type f -exec grep -l /usr/local/bin/python \{\} \;` ; do
  rm -f tmp
  sed -e "s:^#!.*/usr/local/bin/python:#!/usr/bin/env python:g" $f > tmp
  cp -f tmp $f
done
#
# Build sane lib
cd Sane
python setup.py build
cd ..
#
# Build python things
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" 
python setup.py build_ext -i
python selftest.py

%install
python setup.py install --prefix=%{_prefix} --root=$RPM_BUILD_ROOT --record-rpm=INSTALLED_FILES
install -d -m 755 $RPM_BUILD_ROOT/usr/include/python%pyver
install -m 644 libImaging/Imaging.h \
    libImaging/ImPlatform.h \
    $RPM_BUILD_ROOT/usr/include/python%pyver
cd Sane
python setup.py install --prefix=%{_prefix} --root=$RPM_BUILD_ROOT --record-rpm=../INSTALLED_FILES_SANE
#cat INSTALLED_FILES >> ../INSTALLED_FILES
cd ..

%clean
rm -rf ${RPM_BUILD_ROOT}

%files -f INSTALLED_FILES
%defattr(-,root,root)
%doc CHANGES README Docs Scripts Images pil-handbook.pdf
/usr/include/python%pyver/*

%files sane -f INSTALLED_FILES_SANE
%defattr(-,root,root)
%doc Sane/sanedoc.txt Sane/README Sane/CHANGES

%changelog