|
1 ########################## |
|
2 # User-modifiable configs |
|
3 ########################## |
|
4 |
|
5 # Is the resulting package and the installed binary named "python" or |
|
6 # "python2"? |
|
7 #WARNING: Commenting out doesn't work. Last line is what's used. |
|
8 %define config_binsuffix none |
|
9 %define config_binsuffix 2.6 |
|
10 |
|
11 # Build tkinter? "auto" enables it if /usr/bin/wish exists. |
|
12 #WARNING: Commenting out doesn't work. Last line is what's used. |
|
13 %define config_tkinter no |
|
14 %define config_tkinter yes |
|
15 %define config_tkinter auto |
|
16 |
|
17 # Use pymalloc? The last line (commented or not) determines wether |
|
18 # pymalloc is used. |
|
19 #WARNING: Commenting out doesn't work. Last line is what's used. |
|
20 %define config_pymalloc no |
|
21 %define config_pymalloc yes |
|
22 |
|
23 # Enable IPV6? |
|
24 #WARNING: Commenting out doesn't work. Last line is what's used. |
|
25 %define config_ipv6 yes |
|
26 %define config_ipv6 no |
|
27 |
|
28 # Location of the HTML directory. |
|
29 %define config_htmldir /var/www/html/python |
|
30 |
|
31 ################################# |
|
32 # End of user-modifiable configs |
|
33 ################################# |
|
34 |
|
35 %define name python |
|
36 #--start constants-- |
|
37 %define version 2.6.1 |
|
38 %define libver 2.6 |
|
39 #--end constants-- |
|
40 %define release 1pydotorg |
|
41 %define __prefix /usr |
|
42 |
|
43 # kludge to get around rpm <percent>define weirdness |
|
44 %define ipv6 %(if [ "%{config_ipv6}" = yes ]; then echo --enable-ipv6; else echo --disable-ipv6; fi) |
|
45 %define pymalloc %(if [ "%{config_pymalloc}" = yes ]; then echo --with-pymalloc; else echo --without-pymalloc; fi) |
|
46 %define binsuffix %(if [ "%{config_binsuffix}" = none ]; then echo ; else echo "%{config_binsuffix}"; fi) |
|
47 %define include_tkinter %(if [ \\( "%{config_tkinter}" = auto -a -f /usr/bin/wish \\) -o "%{config_tkinter}" = yes ]; then echo 1; else echo 0; fi) |
|
48 %define libdirname %(( uname -m | egrep -q '_64$' && [ -d /usr/lib64 ] && echo lib64 ) || echo lib) |
|
49 |
|
50 # detect if documentation is available |
|
51 %define include_docs %(if [ -f "%{_sourcedir}/html-%{version}.tar.bz2" ]; then echo 1; else echo 0; fi) |
|
52 |
|
53 Summary: An interpreted, interactive, object-oriented programming language. |
|
54 Name: %{name}%{binsuffix} |
|
55 Version: %{version} |
|
56 Release: %{release} |
|
57 Copyright: Modified CNRI Open Source License |
|
58 Group: Development/Languages |
|
59 Source: Python-%{version}.tar.bz2 |
|
60 %if %{include_docs} |
|
61 Source1: html-%{version}.tar.bz2 |
|
62 %endif |
|
63 BuildRoot: %{_tmppath}/%{name}-%{version}-root |
|
64 BuildPrereq: expat-devel |
|
65 BuildPrereq: db4-devel |
|
66 BuildPrereq: gdbm-devel |
|
67 BuildPrereq: sqlite-devel |
|
68 Prefix: %{__prefix} |
|
69 Packager: Sean Reifschneider <jafo-rpms@tummy.com> |
|
70 |
|
71 %description |
|
72 Python is an interpreted, interactive, object-oriented programming |
|
73 language. It incorporates modules, exceptions, dynamic typing, very high |
|
74 level dynamic data types, and classes. Python combines remarkable power |
|
75 with very clear syntax. It has interfaces to many system calls and |
|
76 libraries, as well as to various window systems, and is extensible in C or |
|
77 C++. It is also usable as an extension language for applications that need |
|
78 a programmable interface. Finally, Python is portable: it runs on many |
|
79 brands of UNIX, on PCs under Windows, MS-DOS, and OS/2, and on the |
|
80 Mac. |
|
81 |
|
82 %package devel |
|
83 Summary: The libraries and header files needed for Python extension development. |
|
84 Prereq: python%{binsuffix} = %{PACKAGE_VERSION} |
|
85 Group: Development/Libraries |
|
86 |
|
87 %description devel |
|
88 The Python programming language's interpreter can be extended with |
|
89 dynamically loaded extensions and can be embedded in other programs. |
|
90 This package contains the header files and libraries needed to do |
|
91 these types of tasks. |
|
92 |
|
93 Install python-devel if you want to develop Python extensions. The |
|
94 python package will also need to be installed. You'll probably also |
|
95 want to install the python-docs package, which contains Python |
|
96 documentation. |
|
97 |
|
98 %if %{include_tkinter} |
|
99 %package tkinter |
|
100 Summary: A graphical user interface for the Python scripting language. |
|
101 Group: Development/Languages |
|
102 Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release} |
|
103 |
|
104 %description tkinter |
|
105 The Tkinter (Tk interface) program is an graphical user interface for |
|
106 the Python scripting language. |
|
107 |
|
108 You should install the tkinter package if you'd like to use a graphical |
|
109 user interface for Python programming. |
|
110 %endif |
|
111 |
|
112 %package tools |
|
113 Summary: A collection of development tools included with Python. |
|
114 Group: Development/Tools |
|
115 Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release} |
|
116 |
|
117 %description tools |
|
118 The Python package includes several development tools that are used |
|
119 to build python programs. This package contains a selection of those |
|
120 tools, including the IDLE Python IDE. |
|
121 |
|
122 Install python-tools if you want to use these tools to develop |
|
123 Python programs. You will also need to install the python and |
|
124 tkinter packages. |
|
125 |
|
126 %if %{include_docs} |
|
127 %package docs |
|
128 Summary: Python-related documentation. |
|
129 Group: Development/Documentation |
|
130 |
|
131 %description docs |
|
132 Documentation relating to the Python programming language in HTML and info |
|
133 formats. |
|
134 %endif |
|
135 |
|
136 %changelog |
|
137 * Mon Dec 20 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.4-2pydotorg] |
|
138 - Changing the idle wrapper so that it passes arguments to idle. |
|
139 |
|
140 * Tue Oct 19 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.4b1-1pydotorg] |
|
141 - Updating to 2.4. |
|
142 |
|
143 * Thu Jul 22 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.4-3pydotorg] |
|
144 - Paul Tiemann fixes for %{prefix}. |
|
145 - Adding permission changes for directory as suggested by reimeika.ca |
|
146 - Adding code to detect when it should be using lib64. |
|
147 - Adding a define for the location of /var/www/html for docs. |
|
148 |
|
149 * Thu May 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.4-2pydotorg] |
|
150 - Including changes from Ian Holsman to build under Red Hat 7.3. |
|
151 - Fixing some problems with the /usr/local path change. |
|
152 |
|
153 * Sat Mar 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-3pydotorg] |
|
154 - Being more agressive about finding the paths to fix for |
|
155 #!/usr/local/bin/python. |
|
156 |
|
157 * Sat Feb 07 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.3-2pydotorg] |
|
158 - Adding code to remove "#!/usr/local/bin/python" from particular files and |
|
159 causing the RPM build to terminate if there are any unexpected files |
|
160 which have that line in them. |
|
161 |
|
162 * Mon Oct 13 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-1pydotorg] |
|
163 - Adding code to detect wether documentation is available to build. |
|
164 |
|
165 * Fri Sep 19 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.1-1pydotorg] |
|
166 - Updating to the 2.3.1 release. |
|
167 |
|
168 * Mon Feb 24 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3b1-1pydotorg] |
|
169 - Updating to 2.3b1 release. |
|
170 |
|
171 * Mon Feb 17 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3a1-1] |
|
172 - Updating to 2.3 release. |
|
173 |
|
174 * Sun Dec 23 2001 Sean Reifschneider <jafo-rpms@tummy.com> |
|
175 [Release 2.2-2] |
|
176 - Added -docs package. |
|
177 - Added "auto" config_tkinter setting which only enables tk if |
|
178 /usr/bin/wish exists. |
|
179 |
|
180 * Sat Dec 22 2001 Sean Reifschneider <jafo-rpms@tummy.com> |
|
181 [Release 2.2-1] |
|
182 - Updated to 2.2. |
|
183 - Changed the extension to "2" from "2.2". |
|
184 |
|
185 * Tue Nov 18 2001 Sean Reifschneider <jafo-rpms@tummy.com> |
|
186 [Release 2.2c1-1] |
|
187 - Updated to 2.2c1. |
|
188 |
|
189 * Thu Nov 1 2001 Sean Reifschneider <jafo-rpms@tummy.com> |
|
190 [Release 2.2b1-3] |
|
191 - Changed the way the sed for fixing the #! in pydoc works. |
|
192 |
|
193 * Wed Oct 24 2001 Sean Reifschneider <jafo-rpms@tummy.com> |
|
194 [Release 2.2b1-2] |
|
195 - Fixed missing "email" package, thanks to anonymous report on sourceforge. |
|
196 - Fixed missing "compiler" package. |
|
197 |
|
198 * Mon Oct 22 2001 Sean Reifschneider <jafo-rpms@tummy.com> |
|
199 [Release 2.2b1-1] |
|
200 - Updated to 2.2b1. |
|
201 |
|
202 * Mon Oct 9 2001 Sean Reifschneider <jafo-rpms@tummy.com> |
|
203 [Release 2.2a4-4] |
|
204 - otto@balinor.mat.unimi.it mentioned that the license file is missing. |
|
205 |
|
206 * Sun Sep 30 2001 Sean Reifschneider <jafo-rpms@tummy.com> |
|
207 [Release 2.2a4-3] |
|
208 - Ignacio Vazquez-Abrams pointed out that I had a spruious double-quote in |
|
209 the spec files. Thanks. |
|
210 |
|
211 * Wed Jul 25 2001 Sean Reifschneider <jafo-rpms@tummy.com> |
|
212 [Release 2.2a1-1] |
|
213 - Updated to 2.2a1 release. |
|
214 - Changed idle and pydoc to use binsuffix macro |
|
215 |
|
216 ####### |
|
217 # PREP |
|
218 ####### |
|
219 %prep |
|
220 %setup -n Python-%{version} |
|
221 |
|
222 ######## |
|
223 # BUILD |
|
224 ######## |
|
225 %build |
|
226 ./configure --enable-unicode=ucs4 %{ipv6} %{pymalloc} --prefix=%{__prefix} |
|
227 make |
|
228 |
|
229 ########## |
|
230 # INSTALL |
|
231 ########## |
|
232 %install |
|
233 # set the install path |
|
234 echo '[install_scripts]' >setup.cfg |
|
235 echo 'install_dir='"${RPM_BUILD_ROOT}%{__prefix}/bin" >>setup.cfg |
|
236 |
|
237 [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT |
|
238 mkdir -p $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload |
|
239 make prefix=$RPM_BUILD_ROOT%{__prefix} install |
|
240 |
|
241 # REPLACE PATH IN PYDOC |
|
242 if [ ! -z "%{binsuffix}" ] |
|
243 then |
|
244 ( |
|
245 cd $RPM_BUILD_ROOT%{__prefix}/bin |
|
246 mv pydoc pydoc.old |
|
247 sed 's|#!.*|#!%{__prefix}/bin/env python'%{binsuffix}'|' \ |
|
248 pydoc.old >pydoc |
|
249 chmod 755 pydoc |
|
250 rm -f pydoc.old |
|
251 ) |
|
252 fi |
|
253 |
|
254 # add the binsuffix |
|
255 if [ ! -z "%{binsuffix}" ] |
|
256 then |
|
257 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; rm -f python[0-9a-zA-Z]*; |
|
258 mv -f python python"%{binsuffix}" ) |
|
259 ( cd $RPM_BUILD_ROOT%{__prefix}/man/man1; mv python.1 python%{binsuffix}.1 ) |
|
260 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f pydoc pydoc"%{binsuffix}" ) |
|
261 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f idle idle"%{binsuffix}" ) |
|
262 fi |
|
263 |
|
264 ######## |
|
265 # Tools |
|
266 echo '#!%{__prefix}/bin/env python%{binsuffix}' >${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix} |
|
267 echo 'import os, sys' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix} |
|
268 echo 'os.execvp("%{__prefix}/bin/python%{binsuffix}", ["%{__prefix}/bin/python%{binsuffix}", "%{__prefix}/lib/python%{libvers}/idlelib/idle.py"] + sys.argv[1:])' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix} |
|
269 echo 'print "Failed to exec Idle"' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix} |
|
270 echo 'sys.exit(1)' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix} |
|
271 chmod 755 $RPM_BUILD_ROOT%{__prefix}/bin/idle%{binsuffix} |
|
272 cp -a Tools $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers} |
|
273 |
|
274 # MAKE FILE LISTS |
|
275 rm -f mainpkg.files |
|
276 find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/lib-dynload -type f | |
|
277 sed "s|^${RPM_BUILD_ROOT}|/|" | |
|
278 grep -v -e '_tkinter.so$' >mainpkg.files |
|
279 find "$RPM_BUILD_ROOT""%{__prefix}"/bin -type f | |
|
280 sed "s|^${RPM_BUILD_ROOT}|/|" | |
|
281 grep -v -e '/bin/idle%{binsuffix}$' >>mainpkg.files |
|
282 |
|
283 rm -f tools.files |
|
284 find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/idlelib \ |
|
285 "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/Tools -type f | |
|
286 sed "s|^${RPM_BUILD_ROOT}|/|" >tools.files |
|
287 echo "%{__prefix}"/bin/idle%{binsuffix} >>tools.files |
|
288 |
|
289 ###### |
|
290 # Docs |
|
291 %if %{include_docs} |
|
292 mkdir -p "$RPM_BUILD_ROOT"%{config_htmldir} |
|
293 ( |
|
294 cd "$RPM_BUILD_ROOT"%{config_htmldir} |
|
295 bunzip2 < %{SOURCE1} | tar x |
|
296 ) |
|
297 %endif |
|
298 |
|
299 # fix the #! line in installed files |
|
300 find "$RPM_BUILD_ROOT" -type f -print0 | |
|
301 xargs -0 grep -l /usr/local/bin/python | while read file |
|
302 do |
|
303 FIXFILE="$file" |
|
304 sed 's|^#!.*python|#!%{__prefix}/bin/env python'"%{binsuffix}"'|' \ |
|
305 "$FIXFILE" >/tmp/fix-python-path.$$ |
|
306 cat /tmp/fix-python-path.$$ >"$FIXFILE" |
|
307 rm -f /tmp/fix-python-path.$$ |
|
308 done |
|
309 |
|
310 # check to see if there are any straggling #! lines |
|
311 find "$RPM_BUILD_ROOT" -type f | xargs egrep -n '^#! */usr/local/bin/python' \ |
|
312 | grep ':1:#!' >/tmp/python-rpm-files.$$ || true |
|
313 if [ -s /tmp/python-rpm-files.$$ ] |
|
314 then |
|
315 echo '*****************************************************' |
|
316 cat /tmp/python-rpm-files.$$ |
|
317 cat <<@EOF |
|
318 ***************************************************** |
|
319 There are still files referencing /usr/local/bin/python in the |
|
320 install directory. They are listed above. Please fix the .spec |
|
321 file and try again. If you are an end-user, you probably want |
|
322 to report this to jafo-rpms@tummy.com as well. |
|
323 ***************************************************** |
|
324 @EOF |
|
325 rm -f /tmp/python-rpm-files.$$ |
|
326 exit 1 |
|
327 fi |
|
328 rm -f /tmp/python-rpm-files.$$ |
|
329 |
|
330 ######## |
|
331 # CLEAN |
|
332 ######## |
|
333 %clean |
|
334 [ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT |
|
335 rm -f mainpkg.files tools.files |
|
336 |
|
337 ######## |
|
338 # FILES |
|
339 ######## |
|
340 %files -f mainpkg.files |
|
341 %defattr(-,root,root) |
|
342 %doc Misc/README Misc/cheatsheet Misc/Porting |
|
343 %doc LICENSE Misc/ACKS Misc/HISTORY Misc/NEWS |
|
344 %{__prefix}/man/man1/python%{binsuffix}.1* |
|
345 |
|
346 %attr(755,root,root) %dir %{__prefix}/include/python%{libvers} |
|
347 %attr(755,root,root) %dir %{__prefix}/%{libdirname}/python%{libvers}/ |
|
348 %{__prefix}/%{libdirname}/python%{libvers}/*.txt |
|
349 %{__prefix}/%{libdirname}/python%{libvers}/*.py* |
|
350 %{__prefix}/%{libdirname}/python%{libvers}/pdb.doc |
|
351 %{__prefix}/%{libdirname}/python%{libvers}/profile.doc |
|
352 %{__prefix}/%{libdirname}/python%{libvers}/curses |
|
353 %{__prefix}/%{libdirname}/python%{libvers}/distutils |
|
354 %{__prefix}/%{libdirname}/python%{libvers}/encodings |
|
355 %{__prefix}/%{libdirname}/python%{libvers}/plat-linux2 |
|
356 %{__prefix}/%{libdirname}/python%{libvers}/site-packages |
|
357 %{__prefix}/%{libdirname}/python%{libvers}/test |
|
358 %{__prefix}/%{libdirname}/python%{libvers}/xml |
|
359 %{__prefix}/%{libdirname}/python%{libvers}/email |
|
360 %{__prefix}/%{libdirname}/python%{libvers}/email/mime |
|
361 %{__prefix}/%{libdirname}/python%{libvers}/sqlite3 |
|
362 %{__prefix}/%{libdirname}/python%{libvers}/compiler |
|
363 %{__prefix}/%{libdirname}/python%{libvers}/bsddb |
|
364 %{__prefix}/%{libdirname}/python%{libvers}/hotshot |
|
365 %{__prefix}/%{libdirname}/python%{libvers}/logging |
|
366 %{__prefix}/%{libdirname}/python%{libvers}/lib-old |
|
367 |
|
368 %files devel |
|
369 %defattr(-,root,root) |
|
370 %{__prefix}/include/python%{libvers}/*.h |
|
371 %{__prefix}/%{libdirname}/python%{libvers}/config |
|
372 |
|
373 %files -f tools.files tools |
|
374 %defattr(-,root,root) |
|
375 |
|
376 %if %{include_tkinter} |
|
377 %files tkinter |
|
378 %defattr(-,root,root) |
|
379 %{__prefix}/%{libdirname}/python%{libvers}/lib-tk |
|
380 %{__prefix}/%{libdirname}/python%{libvers}/lib-dynload/_tkinter.so* |
|
381 %endif |
|
382 |
|
383 %if %{include_docs} |
|
384 %files docs |
|
385 %defattr(-,root,root) |
|
386 %{config_htmldir}/* |
|
387 %endif |