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