blob: 1f2741bdee99d9782bc08463b7268f9dc74b3714 [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öwis52da4492003-10-19 18:34:52 +000033%define version 2.3.2
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öwis52da4492003-10-19 18:34:52 +0000130* Mon Oct 13 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-1pydotorg]
131- Adding code to detect wether documentation is available to build.
132
133* Fri Sep 19 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.1-1pydotorg]
134- Updating to the 2.3.1 release.
135
Guido van Rossum0f698332003-02-24 17:55:37 +0000136* Mon Feb 24 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3b1-1pydotorg]
137- Updating to 2.3b1 release.
138
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000139* Mon Feb 17 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3a1-1]
140- Updating to 2.3 release.
141
142* Sun Dec 23 2001 Sean Reifschneider <jafo-rpms@tummy.com>
143[Release 2.2-2]
144- Added -docs package.
145- Added "auto" config_tkinter setting which only enables tk if
146 /usr/bin/wish exists.
147
148* Sat Dec 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
149[Release 2.2-1]
150- Updated to 2.2.
151- Changed the extension to "2" from "2.2".
152
153* Tue Nov 18 2001 Sean Reifschneider <jafo-rpms@tummy.com>
154[Release 2.2c1-1]
155- Updated to 2.2c1.
156
157* Thu Nov 1 2001 Sean Reifschneider <jafo-rpms@tummy.com>
158[Release 2.2b1-3]
159- Changed the way the sed for fixing the #! in pydoc works.
160
161* Wed Oct 24 2001 Sean Reifschneider <jafo-rpms@tummy.com>
162[Release 2.2b1-2]
163- Fixed missing "email" package, thanks to anonymous report on sourceforge.
164- Fixed missing "compiler" package.
165
166* Mon Oct 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
167[Release 2.2b1-1]
168- Updated to 2.2b1.
169
170* Mon Oct 9 2001 Sean Reifschneider <jafo-rpms@tummy.com>
171[Release 2.2a4-4]
172- otto@balinor.mat.unimi.it mentioned that the license file is missing.
173
174* Sun Sep 30 2001 Sean Reifschneider <jafo-rpms@tummy.com>
175[Release 2.2a4-3]
176- Ignacio Vazquez-Abrams pointed out that I had a spruious double-quote in
177 the spec files. Thanks.
178
179* Wed Jul 25 2001 Sean Reifschneider <jafo-rpms@tummy.com>
180[Release 2.2a1-1]
181- Updated to 2.2a1 release.
182- Changed idle and pydoc to use binsuffix macro
183
184#######
185# PREP
186#######
187%prep
188%setup -n Python-%{version}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000189
190########
191# BUILD
192########
193%build
Martin v. Löwis52da4492003-10-19 18:34:52 +0000194./configure --enable-unicode=ucs4 %{ipv6} %{pymalloc} --prefix=%{__prefix}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000195make
196
197##########
198# INSTALL
199##########
200%install
201# set the install path
202echo '[install_scripts]' >setup.cfg
203echo 'install_dir='"${RPM_BUILD_ROOT}/usr/bin" >>setup.cfg
204
205[ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
206mkdir -p $RPM_BUILD_ROOT%{__prefix}/lib/python%{libvers}/lib-dynload
207make prefix=$RPM_BUILD_ROOT%{__prefix} install
208
209# REPLACE PATH IN PYDOC
210if [ ! -z "%{binsuffix}" ]
211then
212 (
213 cd $RPM_BUILD_ROOT%{__prefix}/bin
214 mv pydoc pydoc.old
215 sed 's|#!.*|#!/usr/bin/env python'%{binsuffix}'|' \
216 pydoc.old >pydoc
217 chmod 755 pydoc
218 rm -f pydoc.old
219 )
220fi
221
222# add the binsuffix
223if [ ! -z "%{binsuffix}" ]
224then
225 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; rm -f python[0-9a-zA-Z]*;
226 mv -f python python"%{binsuffix}" )
227 ( cd $RPM_BUILD_ROOT%{__prefix}/man/man1; mv python.1 python%{binsuffix}.1 )
228 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f pydoc pydoc"%{binsuffix}" )
229 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f idle idle"%{binsuffix}" )
230fi
231
232########
233# Tools
234echo '#!/bin/bash' >${RPM_BUILD_ROOT}%{_bindir}/idle%{binsuffix}
Martin v. Löwis52da4492003-10-19 18:34:52 +0000235echo '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 +0000236chmod 755 $RPM_BUILD_ROOT%{_bindir}/idle%{binsuffix}
237cp -a Tools $RPM_BUILD_ROOT%{_prefix}/lib/python%{libvers}
238
239# MAKE FILE LISTS
240rm -f mainpkg.files
241find "$RPM_BUILD_ROOT""%{__prefix}"/lib/python%{libvers}/lib-dynload -type f |
242 sed "s|^${RPM_BUILD_ROOT}|/|" |
243 grep -v -e '_tkinter.so$' >mainpkg.files
244find "$RPM_BUILD_ROOT""%{__prefix}"/bin -type f |
245 sed "s|^${RPM_BUILD_ROOT}|/|" |
246 grep -v -e '/bin/idle%{binsuffix}$' >>mainpkg.files
247
248rm -f tools.files
Martin v. Löwis52da4492003-10-19 18:34:52 +0000249find "$RPM_BUILD_ROOT""%{__prefix}"/lib/python%{libvers}/idlelib \
250 "$RPM_BUILD_ROOT""%{__prefix}"/lib/python%{libvers}/Tools -type f |
251 sed "s|^${RPM_BUILD_ROOT}|/|" >tools.files
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000252echo "%{__prefix}"/bin/idle%{binsuffix} >>tools.files
253
254######
255# Docs
Martin v. Löwis52da4492003-10-19 18:34:52 +0000256%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000257mkdir -p "$RPM_BUILD_ROOT"/var/www/html/python
258(
259 cd "$RPM_BUILD_ROOT"/var/www/html/python
260 bunzip2 < %{SOURCE1} | tar x
261)
Martin v. Löwis52da4492003-10-19 18:34:52 +0000262%endif
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000263
264########
265# CLEAN
266########
267%clean
Martin v. Löwis52da4492003-10-19 18:34:52 +0000268[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000269rm -f mainpkg.files tools.files
270
271########
272# FILES
273########
274%files -f mainpkg.files
275%defattr(-,root,root)
276%doc Misc/README Misc/cheatsheet Misc/Porting
277%doc LICENSE Misc/ACKS Misc/HISTORY Misc/NEWS
278%{__prefix}/man/man1/python%{binsuffix}.1.gz
279
280%dir %{__prefix}/include/python%{libvers}
281%dir %{__prefix}/lib/python%{libvers}/
282%{__prefix}/lib/python%{libvers}/*.txt
283%{__prefix}/lib/python%{libvers}/*.py*
284%{__prefix}/lib/python%{libvers}/pdb.doc
285%{__prefix}/lib/python%{libvers}/profile.doc
286%{__prefix}/lib/python%{libvers}/curses
287%{__prefix}/lib/python%{libvers}/distutils
288%{__prefix}/lib/python%{libvers}/encodings
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000289%{__prefix}/lib/python%{libvers}/plat-linux2
290%{__prefix}/lib/python%{libvers}/site-packages
291%{__prefix}/lib/python%{libvers}/test
292%{__prefix}/lib/python%{libvers}/xml
293%{__prefix}/lib/python%{libvers}/email
294%{__prefix}/lib/python%{libvers}/compiler
295%{__prefix}/lib/python%{libvers}/bsddb
296%{__prefix}/lib/python%{libvers}/hotshot
297%{__prefix}/lib/python%{libvers}/logging
298%{__prefix}/lib/python%{libvers}/lib-old
299
300%files devel
301%defattr(-,root,root)
302%{__prefix}/include/python%{libvers}/*.h
303%{__prefix}/lib/python%{libvers}/config
304
305%files -f tools.files tools
306%defattr(-,root,root)
307
308%if %{include_tkinter}
309%files tkinter
310%defattr(-,root,root)
311%{__prefix}/lib/python%{libvers}/lib-tk
312%{__prefix}/lib/python%{libvers}/lib-dynload/_tkinter.so*
313%endif
314
Martin v. Löwis52da4492003-10-19 18:34:52 +0000315%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000316%files docs
317%defattr(-,root,root)
318/var/www/html/python/*
Martin v. Löwis52da4492003-10-19 18:34:52 +0000319%endif