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