blob: d699f592995d397454c9df388ed9d77e89431105 [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
9%define config_binsuffix 2.3
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#################################
29# End of user-modifiable configs
30#################################
31
32%define name python
Martin v. Löwisd3c810e2004-02-15 21:27:03 +000033%define version 2.3.3
Guido van Rossum2ef777f2003-02-24 01:09:53 +000034%define libvers 2.3
Guido van Rossum0f698332003-02-24 17:55:37 +000035%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öwisd3c810e2004-02-15 21:27:03 +0000130* Sat Feb 07 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.3-2pydotorg]
131- Adding code to remove "#!/usr/local/bin/python" from particular files and
132 causing the RPM build to terminate if there are any unexpected files
133 which have that line in them.
134
Martin v. Löwis52da4492003-10-19 18:34:52 +0000135* Mon Oct 13 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-1pydotorg]
136- Adding code to detect wether documentation is available to build.
137
138* Fri Sep 19 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.1-1pydotorg]
139- Updating to the 2.3.1 release.
140
Guido van Rossum0f698332003-02-24 17:55:37 +0000141* Mon Feb 24 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3b1-1pydotorg]
142- Updating to 2.3b1 release.
143
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000144* Mon Feb 17 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3a1-1]
145- Updating to 2.3 release.
146
147* Sun Dec 23 2001 Sean Reifschneider <jafo-rpms@tummy.com>
148[Release 2.2-2]
149- Added -docs package.
150- Added "auto" config_tkinter setting which only enables tk if
151 /usr/bin/wish exists.
152
153* Sat Dec 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
154[Release 2.2-1]
155- Updated to 2.2.
156- Changed the extension to "2" from "2.2".
157
158* Tue Nov 18 2001 Sean Reifschneider <jafo-rpms@tummy.com>
159[Release 2.2c1-1]
160- Updated to 2.2c1.
161
162* Thu Nov 1 2001 Sean Reifschneider <jafo-rpms@tummy.com>
163[Release 2.2b1-3]
164- Changed the way the sed for fixing the #! in pydoc works.
165
166* Wed Oct 24 2001 Sean Reifschneider <jafo-rpms@tummy.com>
167[Release 2.2b1-2]
168- Fixed missing "email" package, thanks to anonymous report on sourceforge.
169- Fixed missing "compiler" package.
170
171* Mon Oct 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
172[Release 2.2b1-1]
173- Updated to 2.2b1.
174
175* Mon Oct 9 2001 Sean Reifschneider <jafo-rpms@tummy.com>
176[Release 2.2a4-4]
177- otto@balinor.mat.unimi.it mentioned that the license file is missing.
178
179* Sun Sep 30 2001 Sean Reifschneider <jafo-rpms@tummy.com>
180[Release 2.2a4-3]
181- Ignacio Vazquez-Abrams pointed out that I had a spruious double-quote in
182 the spec files. Thanks.
183
184* Wed Jul 25 2001 Sean Reifschneider <jafo-rpms@tummy.com>
185[Release 2.2a1-1]
186- Updated to 2.2a1 release.
187- Changed idle and pydoc to use binsuffix macro
188
189#######
190# PREP
191#######
192%prep
193%setup -n Python-%{version}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000194
195########
196# BUILD
197########
198%build
Martin v. Löwis52da4492003-10-19 18:34:52 +0000199./configure --enable-unicode=ucs4 %{ipv6} %{pymalloc} --prefix=%{__prefix}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000200make
201
202##########
203# INSTALL
204##########
205%install
206# set the install path
207echo '[install_scripts]' >setup.cfg
208echo 'install_dir='"${RPM_BUILD_ROOT}/usr/bin" >>setup.cfg
209
210[ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
211mkdir -p $RPM_BUILD_ROOT%{__prefix}/lib/python%{libvers}/lib-dynload
212make prefix=$RPM_BUILD_ROOT%{__prefix} install
213
214# REPLACE PATH IN PYDOC
215if [ ! -z "%{binsuffix}" ]
216then
217 (
218 cd $RPM_BUILD_ROOT%{__prefix}/bin
219 mv pydoc pydoc.old
220 sed 's|#!.*|#!/usr/bin/env python'%{binsuffix}'|' \
221 pydoc.old >pydoc
222 chmod 755 pydoc
223 rm -f pydoc.old
224 )
225fi
226
227# add the binsuffix
228if [ ! -z "%{binsuffix}" ]
229then
230 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; rm -f python[0-9a-zA-Z]*;
231 mv -f python python"%{binsuffix}" )
232 ( cd $RPM_BUILD_ROOT%{__prefix}/man/man1; mv python.1 python%{binsuffix}.1 )
233 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f pydoc pydoc"%{binsuffix}" )
234 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f idle idle"%{binsuffix}" )
235fi
236
237########
238# Tools
239echo '#!/bin/bash' >${RPM_BUILD_ROOT}%{_bindir}/idle%{binsuffix}
Martin v. Löwis52da4492003-10-19 18:34:52 +0000240echo '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 +0000241chmod 755 $RPM_BUILD_ROOT%{_bindir}/idle%{binsuffix}
242cp -a Tools $RPM_BUILD_ROOT%{_prefix}/lib/python%{libvers}
243
244# MAKE FILE LISTS
245rm -f mainpkg.files
246find "$RPM_BUILD_ROOT""%{__prefix}"/lib/python%{libvers}/lib-dynload -type f |
247 sed "s|^${RPM_BUILD_ROOT}|/|" |
248 grep -v -e '_tkinter.so$' >mainpkg.files
249find "$RPM_BUILD_ROOT""%{__prefix}"/bin -type f |
250 sed "s|^${RPM_BUILD_ROOT}|/|" |
251 grep -v -e '/bin/idle%{binsuffix}$' >>mainpkg.files
252
253rm -f tools.files
Martin v. Löwis52da4492003-10-19 18:34:52 +0000254find "$RPM_BUILD_ROOT""%{__prefix}"/lib/python%{libvers}/idlelib \
255 "$RPM_BUILD_ROOT""%{__prefix}"/lib/python%{libvers}/Tools -type f |
256 sed "s|^${RPM_BUILD_ROOT}|/|" >tools.files
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000257echo "%{__prefix}"/bin/idle%{binsuffix} >>tools.files
258
259######
260# Docs
Martin v. Löwis52da4492003-10-19 18:34:52 +0000261%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000262mkdir -p "$RPM_BUILD_ROOT"/var/www/html/python
263(
264 cd "$RPM_BUILD_ROOT"/var/www/html/python
265 bunzip2 < %{SOURCE1} | tar x
266)
Martin v. Löwis52da4492003-10-19 18:34:52 +0000267%endif
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000268
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000269# fix the #! line in installed files
270for file in \
271 usr/lib/python2.3/Tools/scripts/parseentities.py \
272 usr/lib/python2.3/cgi.py \
273 usr/lib/python2.3/Tools/faqwiz/faqw.py
274do
275 sed 's|^#!.*python|#!/usr/bin/env python'"%{binsuffix}"'|' \
276 "$RPM_BUILD_ROOT"/"$file" >/tmp/fix-python-path.$$
277 cat /tmp/fix-python-path.$$ >"$RPM_BUILD_ROOT"/"$file"
278 rm -f /tmp/fix-python-path.$$
279done
280
281# check to see if there are any straggling #! lines
282find "$RPM_BUILD_ROOT" -type f | xargs egrep -n '^#! */usr/local/bin/python' \
283 | grep ':1:#!' >/tmp/python-rpm-files.$$ || true
284if [ -s /tmp/python-rpm-files.$$ ]
285then
286 echo '*****************************************************'
287 cat /tmp/python-rpm-files.$$
288 cat <<@EOF
289 *****************************************************
290 There are still files referencing /usr/local/bin/python in the
291 install directory. They are listed above. Please fix the .spec
292 file and try again. If you are an end-user, you probably want
293 to report this to jafo-rpms@tummy.com as well.
294 *****************************************************
295@EOF
296 rm -f /tmp/python-rpm-files.$$
297 exit 1
298fi
299rm -f /tmp/python-rpm-files.$$
300
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000301########
302# CLEAN
303########
304%clean
Martin v. Löwis52da4492003-10-19 18:34:52 +0000305[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000306rm -f mainpkg.files tools.files
307
308########
309# FILES
310########
311%files -f mainpkg.files
312%defattr(-,root,root)
313%doc Misc/README Misc/cheatsheet Misc/Porting
314%doc LICENSE Misc/ACKS Misc/HISTORY Misc/NEWS
315%{__prefix}/man/man1/python%{binsuffix}.1.gz
316
317%dir %{__prefix}/include/python%{libvers}
318%dir %{__prefix}/lib/python%{libvers}/
319%{__prefix}/lib/python%{libvers}/*.txt
320%{__prefix}/lib/python%{libvers}/*.py*
321%{__prefix}/lib/python%{libvers}/pdb.doc
322%{__prefix}/lib/python%{libvers}/profile.doc
323%{__prefix}/lib/python%{libvers}/curses
324%{__prefix}/lib/python%{libvers}/distutils
325%{__prefix}/lib/python%{libvers}/encodings
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000326%{__prefix}/lib/python%{libvers}/plat-linux2
327%{__prefix}/lib/python%{libvers}/site-packages
328%{__prefix}/lib/python%{libvers}/test
329%{__prefix}/lib/python%{libvers}/xml
330%{__prefix}/lib/python%{libvers}/email
331%{__prefix}/lib/python%{libvers}/compiler
332%{__prefix}/lib/python%{libvers}/bsddb
333%{__prefix}/lib/python%{libvers}/hotshot
334%{__prefix}/lib/python%{libvers}/logging
335%{__prefix}/lib/python%{libvers}/lib-old
336
337%files devel
338%defattr(-,root,root)
339%{__prefix}/include/python%{libvers}/*.h
340%{__prefix}/lib/python%{libvers}/config
341
342%files -f tools.files tools
343%defattr(-,root,root)
344
345%if %{include_tkinter}
346%files tkinter
347%defattr(-,root,root)
348%{__prefix}/lib/python%{libvers}/lib-tk
349%{__prefix}/lib/python%{libvers}/lib-dynload/_tkinter.so*
350%endif
351
Martin v. Löwis52da4492003-10-19 18:34:52 +0000352%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000353%files docs
354%defattr(-,root,root)
355/var/www/html/python/*
Martin v. Löwis52da4492003-10-19 18:34:52 +0000356%endif