blob: db1ab477fdd684e165fd518e4808c0ac20aae21d [file] [log] [blame]
Guido van Rossum23105d52002-01-06 03:29:16 +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
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 yes
21%define config_pymalloc no
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
33%define version 2.2
34%define libvers 2.2
35%define release 2
36%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
44Summary: An interpreted, interactive, object-oriented programming language.
45Name: %{name}%{binsuffix}
46Version: %{version}
47Release: %{release}
48Copyright: Modified CNRI Open Source License
49Group: Development/Languages
50Source: Python-%{version}.tgz
51Source1: html-%{version}.tar.bz2
52Source2: info-%{version}.tar.bz2
53Patch0: Python-2.1-pythonpath.patch
54Patch1: Python-2.1-expat.patch
55BuildRoot: /var/tmp/%{name}-%{version}-root
56BuildPrereq: expat-devel
57BuildPrereq: db1-devel
58BuildPrereq: gdbm-devel
59Prefix: %{__prefix}
60Packager: Sean Reifschneider <jafo-rpms@tummy.com>
61
62%description
63Python is an interpreted, interactive, object-oriented programming
64language. It incorporates modules, exceptions, dynamic typing, very high
65level dynamic data types, and classes. Python combines remarkable power
66with very clear syntax. It has interfaces to many system calls and
67libraries, as well as to various window systems, and is extensible in C or
68C++. It is also usable as an extension language for applications that need
69a programmable interface. Finally, Python is portable: it runs on many
70brands of UNIX, on PCs under Windows, MS-DOS, and OS/2, and on the
71Mac.
72
73%package devel
74Summary: The libraries and header files needed for Python extension development.
75Prereq: python%{binsuffix} = %{PACKAGE_VERSION}
76Group: Development/Libraries
77
78%description devel
79The Python programming language's interpreter can be extended with
80dynamically loaded extensions and can be embedded in other programs.
81This package contains the header files and libraries needed to do
82these types of tasks.
83
84Install python-devel if you want to develop Python extensions. The
85python package will also need to be installed. You'll probably also
86want to install the python-docs package, which contains Python
87documentation.
88
89%if %{include_tkinter}
90%package tkinter
91Summary: A graphical user interface for the Python scripting language.
92Group: Development/Languages
93Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release}
94
95%description tkinter
96The Tkinter (Tk interface) program is an graphical user interface for
97the Python scripting language.
98
99You should install the tkinter package if you'd like to use a graphical
100user interface for Python programming.
101%endif
102
103%package tools
104Summary: A collection of development tools included with Python.
105Group: Development/Tools
106Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release}
107
108%description tools
109The Python package includes several development tools that are used
110to build python programs. This package contains a selection of those
111tools, including the IDLE Python IDE.
112
113Install python-tools if you want to use these tools to develop
114Python programs. You will also need to install the python and
115tkinter packages.
116
117%package docs
118Summary: Python-related documentation.
119Group: Development/Documentation
120
121%description docs
122Documentation relating to the Python programming language in HTML and info
123formats.
124
125%changelog
126* Sun Dec 23 2001 Sean Reifschneider <jafo-rpms@tummy.com>
127[Release 2.2-2]
128- Added -docs package.
129- Added "auto" config_tkinter setting which only enables tk if
130 /usr/bin/wish exists.
131
132* Sat Dec 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
133[Release 2.2-1]
134- Updated to 2.2.
135- Changed the extension to "2" from "2.2".
136
137* Tue Nov 18 2001 Sean Reifschneider <jafo-rpms@tummy.com>
138[Release 2.2c1-1]
139- Updated to 2.2c1.
140
141* Thu Nov 1 2001 Sean Reifschneider <jafo-rpms@tummy.com>
142[Release 2.2b1-3]
143- Changed the way the sed for fixing the #! in pydoc works.
144
145* Wed Oct 24 2001 Sean Reifschneider <jafo-rpms@tummy.com>
146[Release 2.2b1-2]
147- Fixed missing "email" package, thanks to anonymous report on sourceforge.
148- Fixed missing "compiler" package.
149
150* Mon Oct 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
151[Release 2.2b1-1]
152- Updated to 2.2b1.
153
154* Mon Oct 9 2001 Sean Reifschneider <jafo-rpms@tummy.com>
155[Release 2.2a4-4]
156- otto@balinor.mat.unimi.it mentioned that the license file is missing.
157
158* Sun Sep 30 2001 Sean Reifschneider <jafo-rpms@tummy.com>
159[Release 2.2a4-3]
160- Ignacio Vazquez-Abrams pointed out that I had a spruious double-quote in
161 the spec files. Thanks.
162
163* Wed Jul 25 2001 Sean Reifschneider <jafo-rpms@tummy.com>
164[Release 2.2a1-1]
165- Updated to 2.2a1 release.
166- Changed idle and pydoc to use binsuffix macro
167
168#######
169# PREP
170#######
171%prep
172%setup -n Python-%{version}
173%patch0 -p1
174%patch1
175
176########
177# BUILD
178########
179%build
180./configure %{ipv6} %{pymalloc} --prefix=%{__prefix}
181make
182
183##########
184# INSTALL
185##########
186%install
187# set the install path
188echo '[install_scripts]' >setup.cfg
189echo 'install_dir='"${RPM_BUILD_ROOT}/usr/bin" >>setup.cfg
190
191[ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
192mkdir -p $RPM_BUILD_ROOT%{__prefix}/lib/python%{libvers}/lib-dynload
193make prefix=$RPM_BUILD_ROOT%{__prefix} install
194
195# REPLACE PATH IN PYDOC
196if [ ! -z "%{binsuffix}" ]
197then
198 (
199 cd $RPM_BUILD_ROOT%{__prefix}/bin
200 mv pydoc pydoc.old
201 sed 's|#!.*|#!/usr/bin/env python'%{binsuffix}'|' \
202 pydoc.old >pydoc
203 chmod 755 pydoc
204 rm -f pydoc.old
205 )
206fi
207
208# add the binsuffix
209if [ ! -z "%{binsuffix}" ]
210then
211 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; rm -f python[0-9a-zA-Z]*;
212 mv -f python python"%{binsuffix}" )
213 ( cd $RPM_BUILD_ROOT%{__prefix}/man/man1; mv python.1 python%{binsuffix}.1 )
214 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f pydoc pydoc"%{binsuffix}" )
215fi
216
217########
218# Tools
219echo '#!/bin/bash' >${RPM_BUILD_ROOT}%{_bindir}/idle%{binsuffix}
220echo 'exec %{_prefix}/bin/python%{binsuffix} /usr/lib/python%{libvers}/Tools/idle/idle.py' >>$RPM_BUILD_ROOT%{_bindir}/idle%{binsuffix}
221chmod 755 $RPM_BUILD_ROOT%{_bindir}/idle%{binsuffix}
222cp -a Tools $RPM_BUILD_ROOT%{_prefix}/lib/python%{libvers}
223
224# MAKE FILE LISTS
225rm -f mainpkg.files
226find "$RPM_BUILD_ROOT""%{__prefix}"/lib/python%{libvers}/lib-dynload -type f |
227 sed "s|^${RPM_BUILD_ROOT}|/|" |
228 grep -v -e '_tkinter.so$' >mainpkg.files
229find "$RPM_BUILD_ROOT""%{__prefix}"/bin -type f |
230 sed "s|^${RPM_BUILD_ROOT}|/|" |
231 grep -v -e '/bin/idle%{binsuffix}$' >>mainpkg.files
232
233rm -f tools.files
234find "$RPM_BUILD_ROOT""%{__prefix}"/lib/python%{libvers}/Tools -type f |
235 sed "s|^${RPM_BUILD_ROOT}|/|" >tools.files
236echo "%{__prefix}"/bin/idle%{binsuffix} >>tools.files
237
238######
239# Docs
240mkdir -p "$RPM_BUILD_ROOT"/var/www/html/python
241(
242 cd "$RPM_BUILD_ROOT"/var/www/html/python
243 bunzip2 < %{SOURCE1} | tar x
244)
245mkdir -p "$RPM_BUILD_ROOT"/usr/share/info
246(
247 cd "$RPM_BUILD_ROOT"/usr/share/info
248 bunzip2 < %{SOURCE2} | tar x
249)
250
251########
252# CLEAN
253########
254%clean
255rm -fr $RPM_BUILD_ROOT
256rm -f mainpkg.files tools.files
257
258########
259# FILES
260########
261%files -f mainpkg.files
262%defattr(-,root,root)
263%doc Misc/README Misc/HYPE Misc/cheatsheet Misc/unicode.txt Misc/Porting
264%doc LICENSE Misc/ACKS Misc/BLURB.* Misc/HISTORY Misc/NEWS
265%{__prefix}/man/man1/python%{binsuffix}.1.gz
266
267%dir %{__prefix}/include/python%{libvers}
268%dir %{__prefix}/lib/python%{libvers}/
269%{__prefix}/lib/python%{libvers}/*.txt
270%{__prefix}/lib/python%{libvers}/*.py*
271%{__prefix}/lib/python%{libvers}/pdb.doc
272%{__prefix}/lib/python%{libvers}/profile.doc
273%{__prefix}/lib/python%{libvers}/curses
274%{__prefix}/lib/python%{libvers}/distutils
275%{__prefix}/lib/python%{libvers}/encodings
276%dir %{__prefix}/lib/python%{libvers}/lib-old
277%{__prefix}/lib/python%{libvers}/plat-linux2
278%{__prefix}/lib/python%{libvers}/site-packages
279%{__prefix}/lib/python%{libvers}/test
280%{__prefix}/lib/python%{libvers}/xml
281%{__prefix}/lib/python%{libvers}/email
282%{__prefix}/lib/python%{libvers}/compiler
283
284%files devel
285%defattr(-,root,root)
286%{__prefix}/include/python%{libvers}/*.h
287%{__prefix}/lib/python%{libvers}/config
288
289%files -f tools.files tools
290%defattr(-,root,root)
291
292%if %{include_tkinter}
293%files tkinter
294%defattr(-,root,root)
295%{__prefix}/lib/python%{libvers}/lib-tk
296%{__prefix}/lib/python%{libvers}/lib-dynload/_tkinter.so*
297%endif
298
299%files docs
300%defattr(-,root,root)
301/var/www/html/python
302/usr/share/info