- make sane conditional, default: off
[packages/python-PIL.git] / python-PIL.spec
1 #
2 # Conditional build:
3 %bcond_without  tk      # build without tkinter support
4 %bcond_with     sane    # build with sane support
5
6 %define         module  PIL
7 Summary:        Python's own image processing library
8 Summary(pl.UTF-8):      Biblioteka do przetwarzania obrazu w Pythonie
9 Name:           python-%{module}
10 Version:        1.1.7
11 Release:        8
12 Epoch:          1
13 License:        BSD-like
14 Group:          Libraries/Python
15 Source0:        http://effbot.org/downloads/Imaging-%{version}.tar.gz
16 # Source0-md5:  fc14a54e1ce02a0225be8854bfba478e
17 Patch0:         %{name}-lib64.patch
18 Patch1:         %{name}-viewer.patch
19 Patch2:         python-imaging-1.1.6-sane-types.patch
20 Patch3:         python-imaging-giftrans.patch
21 URL:            http://www.pythonware.com/products/pil/
22 BuildRequires:  freetype-devel >= 1:2.3.9
23 BuildRequires:  lcms-devel >= 1.1.5
24 BuildRequires:  libjpeg-devel >= 6a
25 BuildRequires:  python >= 1:2.5
26 BuildRequires:  python-devel >= 1:2.5
27 %{?with_tk:BuildRequires:       python-tkinter}
28 BuildRequires:  rpm-pythonprov
29 BuildRequires:  rpmbuild(macros) >= 1.219
30 %{?with_sane:BuildRequires:     sane-backends-devel}
31 %{?with_tk:BuildRequires:       tk-devel}
32 BuildRequires:  zlib-devel >= 1.2.3
33 %pyrequires_eq  python-libs
34 Requires:       freetype >= 1:2.3.9
35 Requires:       lcms >= 1.1.5
36 Requires:       zlib >= 1.2.3
37 Obsoletes:      python-Imaging
38 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
39
40 %description
41 The Python Imaging Library (PIL) adds image processing capabilities to
42 your Python interpreter. This library provides extensive file format
43 support, an efficient internal representation, and powerful image
44 processing capabilities.
45
46 %description -l pl.UTF-8
47 Python Imaging Library (PIL) dodaje możliwość przetwarzania obrazu do
48 interpretera Pythona. Biblioteka ma obsługę wielu formatów plików,
49 wydajną reprezentację wewnętrzną i duże możliwości obróbki.
50
51 %package sane
52 Summary:        Python Module for using scanners
53 Summary(pl.UTF-8):      Moduły Pythona do używania skanerów
54 Group:          Libraries
55 Requires:       %{name} = %{epoch}:%{version}-%{release}
56
57 %description sane
58 This package contains the sane module for Python which provides access
59 to various raster scanning devices such as flatbed scanners and
60 digital cameras.
61
62 %description sane -l pl.UTF-8
63 Ten pakiet zawiera moduł sane dla Pythona, dający dostęp do wielu
64 rastrowych urządzeń skanujących, takich jak skanery płaskie i aparaty
65 cyfrowe.
66
67 %package tk
68 Summary:        Tk interface for python-imaging
69 Summary(pl.UTF-8):      Interfejs Tk do modułów python-imaging
70 Group:          Libraries
71 Requires:       %{name} = %{epoch}:%{version}-%{release}
72 Requires:       python-tkinter
73 Conflicts:      %{name} < 1:1.1.6-6
74
75 %description tk
76 This package contains a Tk interface for python-imaging.
77
78 %description tk -l pl.UTF-8
79 Ten pakiet zawiera interfejs Tk do modułów python-imaging.
80
81 %package devel
82 Summary:        Python's own image processing library header files
83 Summary(pl.UTF-8):      Pliki nagłówkowe do biblioteki obróbki obrazu w Pythonie
84 Group:          Development/Languages/Python
85 Requires:       %{name} = %{epoch}:%{version}-%{release}
86 Requires:       libjpeg-devel
87 Requires:       python-devel
88 Requires:       zlib-devel
89 Obsoletes:      python-Imaging-devel
90
91 %description devel
92 Python's own image processing library header files.
93
94 %description devel -l pl.UTF-8
95 Pliki nagłówkowe do biblioteki obróbki obrazu w Pythonie.
96
97 %prep
98 %setup -q -n Imaging-%{version}
99 %if %{_lib} == "lib64"
100 %patch0 -p1
101 %endif
102 %patch1 -p1
103 %patch2 -p1
104 %patch3 -p1
105
106 # fix the interpreter path for Scripts/*.py
107 sed -i -e "s|/usr/local/bin/python|%{_bindir}/python|" Scripts/*.py
108
109 %build
110 export CFLAGS="%{rpmcflags}"
111 %{__python} setup.py build_ext -i
112 %{__python} selftest.py
113
114 %if %{with sane}
115 cd Sane
116 %{__python} setup.py build
117 %endif
118
119 %install
120 rm -rf $RPM_BUILD_ROOT
121 %{__python} setup.py install \
122         --optimize=2 \
123         --root=$RPM_BUILD_ROOT
124
125 %if %{with sane}
126 cd Sane
127 %{__python} setup.py install \
128         --optimize=2 \
129         --root=$RPM_BUILD_ROOT
130 cd ..
131 %endif
132
133 install -d $RPM_BUILD_ROOT%{py_incdir}
134 cp -a libImaging/Im{Platform,aging}.h $RPM_BUILD_ROOT%{py_incdir}
135
136 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
137 mv $RPM_BUILD_ROOT{%{_bindir}/pil*.py,%{_examplesdir}/%{name}-%{version}}
138
139 %py_ocomp $RPM_BUILD_ROOT%{py_sitedir}/%{module}
140
141 %py_postclean
142
143 %clean
144 rm -rf $RPM_BUILD_ROOT
145
146 %files
147 %defattr(644,root,root,755)
148 %doc CHANGES README
149 %{py_sitedir}/%{module}.pth
150 %dir %{py_sitedir}/%{module}
151 %{py_sitedir}/%{module}/*.py[co]
152 %attr(755,root,root) %{py_sitedir}/%{module}/_imaging*.so
153 %if "%{py_ver}" > "2.4"
154 %{py_sitedir}/%{module}/%{module}-*.egg-info
155 %endif
156
157 %{_examplesdir}/%{name}-%{version}
158
159 %if %{with tk}
160 %exclude %{py_sitedir}/%{module}/ImageTk.py[co]
161 %exclude %{py_sitedir}/%{module}/SpiderImagePlugin.py[co]
162 %exclude %{py_sitedir}/%{module}/_imagingtk.so
163 %endif
164
165 %if %{with sane}
166 %files sane
167 %defattr(644,root,root,755)
168 %doc Sane/CHANGES Sane/demo*.py Sane/sanedoc.txt
169 %{py_sitedir}/sane.py[co]
170 %attr(755,root,root) %{py_sitedir}/_sane.so
171 %if "%{py_ver}" > "2.4"
172 %{py_sitedir}/pysane-*.egg-info
173 %endif
174 %endif
175
176 %if %{with tk}
177 %files tk
178 %defattr(644,root,root,755)
179 %{py_sitedir}/%{module}/ImageTk.py[co]
180 %{py_sitedir}/%{module}/SpiderImagePlugin.py[co]
181 %attr(755,root,root) %{py_sitedir}/%{module}/_imagingtk.so
182 %endif
183
184 %files devel
185 %defattr(644,root,root,755)
186 %{py_incdir}/ImPlatform.h
187 %{py_incdir}/Imaging.h