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

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
%if 0%{?suse_version} > 1130
BuildRequires:  sane-backends-devel
BuildRequires:  sane-backends
%define pyver %(python -c 'import sys; print sys.version[:3]')
Version:        1.1.7
Release:        0
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

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


%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

    Andrew Kuchling
    Ralph Heinkel <>

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

# 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
# Build sane lib
cd Sane
python build
cd ..
# Build python things
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" 
python build_ext -i

python 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 \
cd Sane
python install --prefix=%{_prefix} --root=$RPM_BUILD_ROOT --record-rpm=../INSTALLED_FILES_SANE
cd ..

rm -rf ${RPM_BUILD_ROOT}

%doc CHANGES README Docs Scripts Images pil-handbook.pdf

%doc Sane/sanedoc.txt Sane/README Sane/CHANGES