blob: 1e4e8518c8f94cdeebeccccef3f8c7a0391e5a0b [file] [log] [blame]
Guido van Rossum2ef777f2003-02-24 01:09:53 +00001##########################
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
Martin v. Löwis173ecb62004-05-31 19:40:57 +00009%define config_binsuffix 2.4
Guido van Rossum2ef777f2003-02-24 01:09:53 +000010
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#################################
29# End of user-modifiable configs
30#################################
31
32%define name python
Anthony Baxter6a587c12004-10-15 08:07:21 +000033%define version 2.4b1
Martin v. Löwis173ecb62004-05-31 19:40:57 +000034%define libvers 2.4
35%define release 1pydotorg
Guido van Rossum2ef777f2003-02-24 01:09:53 +000036%define __prefix /usr
37
38# kludge to get around rpm <percent>define weirdness
39%define ipv6 %(if [ "%{config_ipv6}" = yes ]; then echo --enable-ipv6; else echo --disable-ipv6; fi)
40%define pymalloc %(if [ "%{config_pymalloc}" = yes ]; then echo --with-pymalloc; else echo --without-pymalloc; fi)
41%define binsuffix %(if [ "%{config_binsuffix}" = none ]; then echo ; else echo "%{config_binsuffix}"; fi)
42%define include_tkinter %(if [ \\( "%{config_tkinter}" = auto -a -f /usr/bin/wish \\) -o "%{config_tkinter}" = yes ]; then echo 1; else echo 0; fi)
43
Martin v. Löwis52da4492003-10-19 18:34:52 +000044# detect if documentation is available
45%define include_docs %(if [ -f "%{_sourcedir}/html-%{version}.tar.bz2" ]; then echo 1; else echo 0; fi)
46
Guido van Rossum2ef777f2003-02-24 01:09:53 +000047Summary: An interpreted, interactive, object-oriented programming language.
48Name: %{name}%{binsuffix}
49Version: %{version}
50Release: %{release}
51Copyright: Modified CNRI Open Source License
52Group: Development/Languages
53Source: Python-%{version}.tgz
Martin v. Löwis52da4492003-10-19 18:34:52 +000054%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +000055Source1: html-%{version}.tar.bz2
Martin v. Löwis52da4492003-10-19 18:34:52 +000056%endif
57BuildRoot: %{_tmppath}/%{name}-%{version}-root
Guido van Rossum2ef777f2003-02-24 01:09:53 +000058BuildPrereq: expat-devel
59BuildPrereq: db4-devel
60BuildPrereq: gdbm-devel
61Prefix: %{__prefix}
62Packager: Sean Reifschneider <jafo-rpms@tummy.com>
63
64%description
65Python is an interpreted, interactive, object-oriented programming
66language. It incorporates modules, exceptions, dynamic typing, very high
67level dynamic data types, and classes. Python combines remarkable power
68with very clear syntax. It has interfaces to many system calls and
69libraries, as well as to various window systems, and is extensible in C or
70C++. It is also usable as an extension language for applications that need
71a programmable interface. Finally, Python is portable: it runs on many
72brands of UNIX, on PCs under Windows, MS-DOS, and OS/2, and on the
73Mac.
74
75%package devel
76Summary: The libraries and header files needed for Python extension development.
77Prereq: python%{binsuffix} = %{PACKAGE_VERSION}
78Group: Development/Libraries
79
80%description devel
81The Python programming language's interpreter can be extended with
82dynamically loaded extensions and can be embedded in other programs.
83This package contains the header files and libraries needed to do
84these types of tasks.
85
86Install python-devel if you want to develop Python extensions. The
87python package will also need to be installed. You'll probably also
88want to install the python-docs package, which contains Python
89documentation.
90
91%if %{include_tkinter}
92%package tkinter
93Summary: A graphical user interface for the Python scripting language.
94Group: Development/Languages
95Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release}
96
97%description tkinter
98The Tkinter (Tk interface) program is an graphical user interface for
99the Python scripting language.
100
101You should install the tkinter package if you'd like to use a graphical
102user interface for Python programming.
103%endif
104
105%package tools
106Summary: A collection of development tools included with Python.
107Group: Development/Tools
108Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release}
109
110%description tools
111The Python package includes several development tools that are used
112to build python programs. This package contains a selection of those
113tools, including the IDLE Python IDE.
114
115Install python-tools if you want to use these tools to develop
116Python programs. You will also need to install the python and
117tkinter packages.
118
Martin v. Löwis52da4492003-10-19 18:34:52 +0000119%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000120%package docs
121Summary: Python-related documentation.
122Group: Development/Documentation
123
124%description docs
125Documentation relating to the Python programming language in HTML and info
126formats.
Martin v. Löwis52da4492003-10-19 18:34:52 +0000127%endif
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000128
129%changelog
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000130* Thu May 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.4-2pydotorg]
131- Including changes from Ian Holsman to build under Red Hat 7.3.
132- Fixing some problems with the /usr/local path change.
133
Skip Montanarobeddfcb2004-05-17 13:17:38 +0000134* Sat Mar 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-3pydotorg]
Martin v. Löwisfb66cd22004-03-31 18:59:04 +0000135- Being more agressive about finding the paths to fix for
136 #!/usr/local/bin/python.
137
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000138* Sat Feb 07 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.3-2pydotorg]
139- Adding code to remove "#!/usr/local/bin/python" from particular files and
140 causing the RPM build to terminate if there are any unexpected files
141 which have that line in them.
142
Martin v. Löwis52da4492003-10-19 18:34:52 +0000143* Mon Oct 13 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-1pydotorg]
144- Adding code to detect wether documentation is available to build.
145
146* Fri Sep 19 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.1-1pydotorg]
147- Updating to the 2.3.1 release.
148
Guido van Rossum0f698332003-02-24 17:55:37 +0000149* Mon Feb 24 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3b1-1pydotorg]
150- Updating to 2.3b1 release.
151
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000152* Mon Feb 17 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3a1-1]
153- Updating to 2.3 release.
154
155* Sun Dec 23 2001 Sean Reifschneider <jafo-rpms@tummy.com>
156[Release 2.2-2]
157- Added -docs package.
158- Added "auto" config_tkinter setting which only enables tk if
159 /usr/bin/wish exists.
160
161* Sat Dec 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
162[Release 2.2-1]
163- Updated to 2.2.
164- Changed the extension to "2" from "2.2".
165
166* Tue Nov 18 2001 Sean Reifschneider <jafo-rpms@tummy.com>
167[Release 2.2c1-1]
168- Updated to 2.2c1.
169
170* Thu Nov 1 2001 Sean Reifschneider <jafo-rpms@tummy.com>
171[Release 2.2b1-3]
172- Changed the way the sed for fixing the #! in pydoc works.
173
174* Wed Oct 24 2001 Sean Reifschneider <jafo-rpms@tummy.com>
175[Release 2.2b1-2]
176- Fixed missing "email" package, thanks to anonymous report on sourceforge.
177- Fixed missing "compiler" package.
178
179* Mon Oct 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
180[Release 2.2b1-1]
181- Updated to 2.2b1.
182
183* Mon Oct 9 2001 Sean Reifschneider <jafo-rpms@tummy.com>
184[Release 2.2a4-4]
185- otto@balinor.mat.unimi.it mentioned that the license file is missing.
186
187* Sun Sep 30 2001 Sean Reifschneider <jafo-rpms@tummy.com>
188[Release 2.2a4-3]
189- Ignacio Vazquez-Abrams pointed out that I had a spruious double-quote in
190 the spec files. Thanks.
191
192* Wed Jul 25 2001 Sean Reifschneider <jafo-rpms@tummy.com>
193[Release 2.2a1-1]
194- Updated to 2.2a1 release.
195- Changed idle and pydoc to use binsuffix macro
196
197#######
198# PREP
199#######
200%prep
201%setup -n Python-%{version}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000202
203########
204# BUILD
205########
206%build
Martin v. Löwis52da4492003-10-19 18:34:52 +0000207./configure --enable-unicode=ucs4 %{ipv6} %{pymalloc} --prefix=%{__prefix}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000208make
209
210##########
211# INSTALL
212##########
213%install
214# set the install path
215echo '[install_scripts]' >setup.cfg
216echo 'install_dir='"${RPM_BUILD_ROOT}/usr/bin" >>setup.cfg
217
218[ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
219mkdir -p $RPM_BUILD_ROOT%{__prefix}/lib/python%{libvers}/lib-dynload
220make prefix=$RPM_BUILD_ROOT%{__prefix} install
221
222# REPLACE PATH IN PYDOC
223if [ ! -z "%{binsuffix}" ]
224then
225 (
226 cd $RPM_BUILD_ROOT%{__prefix}/bin
227 mv pydoc pydoc.old
228 sed 's|#!.*|#!/usr/bin/env python'%{binsuffix}'|' \
229 pydoc.old >pydoc
230 chmod 755 pydoc
231 rm -f pydoc.old
232 )
233fi
234
235# add the binsuffix
236if [ ! -z "%{binsuffix}" ]
237then
238 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; rm -f python[0-9a-zA-Z]*;
239 mv -f python python"%{binsuffix}" )
240 ( cd $RPM_BUILD_ROOT%{__prefix}/man/man1; mv python.1 python%{binsuffix}.1 )
241 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f pydoc pydoc"%{binsuffix}" )
242 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f idle idle"%{binsuffix}" )
243fi
244
245########
246# Tools
247echo '#!/bin/bash' >${RPM_BUILD_ROOT}%{_bindir}/idle%{binsuffix}
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000248echo 'exec %{__prefix}/bin/python%{binsuffix} /usr/lib/python%{libvers}/idlelib/idle.py' >>$RPM_BUILD_ROOT%{_bindir}/idle%{binsuffix}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000249chmod 755 $RPM_BUILD_ROOT%{_bindir}/idle%{binsuffix}
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000250cp -a Tools $RPM_BUILD_ROOT%{__prefix}/lib/python%{libvers}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000251
252# MAKE FILE LISTS
253rm -f mainpkg.files
254find "$RPM_BUILD_ROOT""%{__prefix}"/lib/python%{libvers}/lib-dynload -type f |
255 sed "s|^${RPM_BUILD_ROOT}|/|" |
256 grep -v -e '_tkinter.so$' >mainpkg.files
257find "$RPM_BUILD_ROOT""%{__prefix}"/bin -type f |
258 sed "s|^${RPM_BUILD_ROOT}|/|" |
259 grep -v -e '/bin/idle%{binsuffix}$' >>mainpkg.files
260
261rm -f tools.files
Martin v. Löwis52da4492003-10-19 18:34:52 +0000262find "$RPM_BUILD_ROOT""%{__prefix}"/lib/python%{libvers}/idlelib \
263 "$RPM_BUILD_ROOT""%{__prefix}"/lib/python%{libvers}/Tools -type f |
264 sed "s|^${RPM_BUILD_ROOT}|/|" >tools.files
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000265echo "%{__prefix}"/bin/idle%{binsuffix} >>tools.files
266
267######
268# Docs
Martin v. Löwis52da4492003-10-19 18:34:52 +0000269%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000270mkdir -p "$RPM_BUILD_ROOT"/var/www/html/python
271(
272 cd "$RPM_BUILD_ROOT"/var/www/html/python
273 bunzip2 < %{SOURCE1} | tar x
274)
Martin v. Löwis52da4492003-10-19 18:34:52 +0000275%endif
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000276
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000277# fix the #! line in installed files
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000278find "$RPM_BUILD_ROOT" -type f -print0 |
279 xargs -0 grep -l /usr/local/bin/python | while read file
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000280do
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000281 FIXFILE="$file"
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000282 sed 's|^#!.*python|#!/usr/bin/env python'"%{binsuffix}"'|' \
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000283 "$FIXFILE" >/tmp/fix-python-path.$$
284 cat /tmp/fix-python-path.$$ >"$FIXFILE"
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000285 rm -f /tmp/fix-python-path.$$
286done
287
288# check to see if there are any straggling #! lines
289find "$RPM_BUILD_ROOT" -type f | xargs egrep -n '^#! */usr/local/bin/python' \
290 | grep ':1:#!' >/tmp/python-rpm-files.$$ || true
291if [ -s /tmp/python-rpm-files.$$ ]
292then
293 echo '*****************************************************'
294 cat /tmp/python-rpm-files.$$
295 cat <<@EOF
296 *****************************************************
297 There are still files referencing /usr/local/bin/python in the
298 install directory. They are listed above. Please fix the .spec
299 file and try again. If you are an end-user, you probably want
300 to report this to jafo-rpms@tummy.com as well.
301 *****************************************************
302@EOF
303 rm -f /tmp/python-rpm-files.$$
304 exit 1
305fi
306rm -f /tmp/python-rpm-files.$$
307
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000308########
309# CLEAN
310########
311%clean
Martin v. Löwis52da4492003-10-19 18:34:52 +0000312[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000313rm -f mainpkg.files tools.files
314
315########
316# FILES
317########
318%files -f mainpkg.files
319%defattr(-,root,root)
320%doc Misc/README Misc/cheatsheet Misc/Porting
321%doc LICENSE Misc/ACKS Misc/HISTORY Misc/NEWS
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000322%{__prefix}/man/man1/python%{binsuffix}.1*
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000323
324%dir %{__prefix}/include/python%{libvers}
325%dir %{__prefix}/lib/python%{libvers}/
326%{__prefix}/lib/python%{libvers}/*.txt
327%{__prefix}/lib/python%{libvers}/*.py*
328%{__prefix}/lib/python%{libvers}/pdb.doc
329%{__prefix}/lib/python%{libvers}/profile.doc
330%{__prefix}/lib/python%{libvers}/curses
331%{__prefix}/lib/python%{libvers}/distutils
332%{__prefix}/lib/python%{libvers}/encodings
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000333%{__prefix}/lib/python%{libvers}/plat-linux2
334%{__prefix}/lib/python%{libvers}/site-packages
335%{__prefix}/lib/python%{libvers}/test
336%{__prefix}/lib/python%{libvers}/xml
337%{__prefix}/lib/python%{libvers}/email
338%{__prefix}/lib/python%{libvers}/compiler
339%{__prefix}/lib/python%{libvers}/bsddb
340%{__prefix}/lib/python%{libvers}/hotshot
341%{__prefix}/lib/python%{libvers}/logging
342%{__prefix}/lib/python%{libvers}/lib-old
343
344%files devel
345%defattr(-,root,root)
346%{__prefix}/include/python%{libvers}/*.h
347%{__prefix}/lib/python%{libvers}/config
348
349%files -f tools.files tools
350%defattr(-,root,root)
351
352%if %{include_tkinter}
353%files tkinter
354%defattr(-,root,root)
355%{__prefix}/lib/python%{libvers}/lib-tk
356%{__prefix}/lib/python%{libvers}/lib-dynload/_tkinter.so*
357%endif
358
Martin v. Löwis52da4492003-10-19 18:34:52 +0000359%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000360%files docs
361%defattr(-,root,root)
362/var/www/html/python/*
Martin v. Löwis52da4492003-10-19 18:34:52 +0000363%endif