blob: 73eba566a3792d0bc0ce8f83266677714338f18c [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
Thomas Wouters00ee7ba2006-08-21 19:07:27 +00009%define config_binsuffix 2.6
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
Sean Reifschneider054541e2004-10-21 23:35:45 +000028# Location of the HTML directory.
29%define config_htmldir /var/www/html/python
30
Guido van Rossum2ef777f2003-02-24 01:09:53 +000031#################################
32# End of user-modifiable configs
33#################################
34
35%define name python
Thomas Wouters00ee7ba2006-08-21 19:07:27 +000036%define version 2.6a1
37%define libvers 2.6
Thomas Wouters49fd7fa2006-04-21 10:40:58 +000038%define release 1pydotorg
Guido van Rossum2ef777f2003-02-24 01:09:53 +000039%define __prefix /usr
40
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)
Sean Reifschneider054541e2004-10-21 23:35:45 +000046%define libdirname %(( uname -m | egrep -q '_64$' && [ -d /usr/lib64 ] && echo lib64 ) || echo lib)
Guido van Rossum2ef777f2003-02-24 01:09:53 +000047
Martin v. Löwis52da4492003-10-19 18:34:52 +000048# detect if documentation is available
49%define include_docs %(if [ -f "%{_sourcedir}/html-%{version}.tar.bz2" ]; then echo 1; else echo 0; fi)
50
Guido van Rossum2ef777f2003-02-24 01:09:53 +000051Summary: An interpreted, interactive, object-oriented programming language.
52Name: %{name}%{binsuffix}
53Version: %{version}
54Release: %{release}
55Copyright: Modified CNRI Open Source License
56Group: Development/Languages
Sean Reifschneider054541e2004-10-21 23:35:45 +000057Source: Python-%{version}.tar.bz2
Martin v. Löwis52da4492003-10-19 18:34:52 +000058%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +000059Source1: html-%{version}.tar.bz2
Martin v. Löwis52da4492003-10-19 18:34:52 +000060%endif
61BuildRoot: %{_tmppath}/%{name}-%{version}-root
Guido van Rossum2ef777f2003-02-24 01:09:53 +000062BuildPrereq: expat-devel
63BuildPrereq: db4-devel
64BuildPrereq: gdbm-devel
Thomas Wouters49fd7fa2006-04-21 10:40:58 +000065BuildPrereq: sqlite-devel
Guido van Rossum2ef777f2003-02-24 01:09:53 +000066Prefix: %{__prefix}
67Packager: Sean Reifschneider <jafo-rpms@tummy.com>
68
69%description
70Python is an interpreted, interactive, object-oriented programming
71language. It incorporates modules, exceptions, dynamic typing, very high
72level dynamic data types, and classes. Python combines remarkable power
73with very clear syntax. It has interfaces to many system calls and
74libraries, as well as to various window systems, and is extensible in C or
75C++. It is also usable as an extension language for applications that need
76a programmable interface. Finally, Python is portable: it runs on many
77brands of UNIX, on PCs under Windows, MS-DOS, and OS/2, and on the
78Mac.
79
80%package devel
81Summary: The libraries and header files needed for Python extension development.
82Prereq: python%{binsuffix} = %{PACKAGE_VERSION}
83Group: Development/Libraries
84
85%description devel
86The Python programming language's interpreter can be extended with
87dynamically loaded extensions and can be embedded in other programs.
88This package contains the header files and libraries needed to do
89these types of tasks.
90
91Install python-devel if you want to develop Python extensions. The
92python package will also need to be installed. You'll probably also
93want to install the python-docs package, which contains Python
94documentation.
95
96%if %{include_tkinter}
97%package tkinter
98Summary: A graphical user interface for the Python scripting language.
99Group: Development/Languages
100Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release}
101
102%description tkinter
103The Tkinter (Tk interface) program is an graphical user interface for
104the Python scripting language.
105
106You should install the tkinter package if you'd like to use a graphical
107user interface for Python programming.
108%endif
109
110%package tools
111Summary: A collection of development tools included with Python.
112Group: Development/Tools
113Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release}
114
115%description tools
116The Python package includes several development tools that are used
117to build python programs. This package contains a selection of those
118tools, including the IDLE Python IDE.
119
120Install python-tools if you want to use these tools to develop
121Python programs. You will also need to install the python and
122tkinter packages.
123
Martin v. Löwis52da4492003-10-19 18:34:52 +0000124%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000125%package docs
126Summary: Python-related documentation.
127Group: Development/Documentation
128
129%description docs
130Documentation relating to the Python programming language in HTML and info
131formats.
Martin v. Löwis52da4492003-10-19 18:34:52 +0000132%endif
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000133
134%changelog
Sean Reifschneider7caafe72004-12-21 02:22:29 +0000135* Mon Dec 20 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.4-2pydotorg]
136- Changing the idle wrapper so that it passes arguments to idle.
137
Sean Reifschneider054541e2004-10-21 23:35:45 +0000138* Tue Oct 19 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.4b1-1pydotorg]
139- Updating to 2.4.
140
141* Thu Jul 22 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.4-3pydotorg]
142- Paul Tiemann fixes for %{prefix}.
143- Adding permission changes for directory as suggested by reimeika.ca
144- Adding code to detect when it should be using lib64.
145- Adding a define for the location of /var/www/html for docs.
146
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000147* Thu May 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.4-2pydotorg]
148- Including changes from Ian Holsman to build under Red Hat 7.3.
149- Fixing some problems with the /usr/local path change.
150
Skip Montanarobeddfcb2004-05-17 13:17:38 +0000151* Sat Mar 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-3pydotorg]
Martin v. Löwisfb66cd22004-03-31 18:59:04 +0000152- Being more agressive about finding the paths to fix for
153 #!/usr/local/bin/python.
154
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000155* Sat Feb 07 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.3-2pydotorg]
156- Adding code to remove "#!/usr/local/bin/python" from particular files and
157 causing the RPM build to terminate if there are any unexpected files
158 which have that line in them.
159
Martin v. Löwis52da4492003-10-19 18:34:52 +0000160* Mon Oct 13 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-1pydotorg]
161- Adding code to detect wether documentation is available to build.
162
163* Fri Sep 19 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.1-1pydotorg]
164- Updating to the 2.3.1 release.
165
Guido van Rossum0f698332003-02-24 17:55:37 +0000166* Mon Feb 24 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3b1-1pydotorg]
167- Updating to 2.3b1 release.
168
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000169* Mon Feb 17 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3a1-1]
170- Updating to 2.3 release.
171
172* Sun Dec 23 2001 Sean Reifschneider <jafo-rpms@tummy.com>
173[Release 2.2-2]
174- Added -docs package.
175- Added "auto" config_tkinter setting which only enables tk if
176 /usr/bin/wish exists.
177
178* Sat Dec 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
179[Release 2.2-1]
180- Updated to 2.2.
181- Changed the extension to "2" from "2.2".
182
183* Tue Nov 18 2001 Sean Reifschneider <jafo-rpms@tummy.com>
184[Release 2.2c1-1]
185- Updated to 2.2c1.
186
187* Thu Nov 1 2001 Sean Reifschneider <jafo-rpms@tummy.com>
188[Release 2.2b1-3]
189- Changed the way the sed for fixing the #! in pydoc works.
190
191* Wed Oct 24 2001 Sean Reifschneider <jafo-rpms@tummy.com>
192[Release 2.2b1-2]
193- Fixed missing "email" package, thanks to anonymous report on sourceforge.
194- Fixed missing "compiler" package.
195
196* Mon Oct 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
197[Release 2.2b1-1]
198- Updated to 2.2b1.
199
200* Mon Oct 9 2001 Sean Reifschneider <jafo-rpms@tummy.com>
201[Release 2.2a4-4]
202- otto@balinor.mat.unimi.it mentioned that the license file is missing.
203
204* Sun Sep 30 2001 Sean Reifschneider <jafo-rpms@tummy.com>
205[Release 2.2a4-3]
206- Ignacio Vazquez-Abrams pointed out that I had a spruious double-quote in
207 the spec files. Thanks.
208
209* Wed Jul 25 2001 Sean Reifschneider <jafo-rpms@tummy.com>
210[Release 2.2a1-1]
211- Updated to 2.2a1 release.
212- Changed idle and pydoc to use binsuffix macro
213
214#######
215# PREP
216#######
217%prep
218%setup -n Python-%{version}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000219
220########
221# BUILD
222########
223%build
Martin v. Löwis52da4492003-10-19 18:34:52 +0000224./configure --enable-unicode=ucs4 %{ipv6} %{pymalloc} --prefix=%{__prefix}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000225make
226
227##########
228# INSTALL
229##########
230%install
231# set the install path
232echo '[install_scripts]' >setup.cfg
Sean Reifschneider054541e2004-10-21 23:35:45 +0000233echo 'install_dir='"${RPM_BUILD_ROOT}%{__prefix}/bin" >>setup.cfg
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000234
235[ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
Sean Reifschneider054541e2004-10-21 23:35:45 +0000236mkdir -p $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000237make prefix=$RPM_BUILD_ROOT%{__prefix} install
238
239# REPLACE PATH IN PYDOC
240if [ ! -z "%{binsuffix}" ]
241then
242 (
243 cd $RPM_BUILD_ROOT%{__prefix}/bin
244 mv pydoc pydoc.old
Sean Reifschneider054541e2004-10-21 23:35:45 +0000245 sed 's|#!.*|#!%{__prefix}/bin/env python'%{binsuffix}'|' \
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000246 pydoc.old >pydoc
247 chmod 755 pydoc
248 rm -f pydoc.old
249 )
250fi
251
252# add the binsuffix
253if [ ! -z "%{binsuffix}" ]
254then
255 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; rm -f python[0-9a-zA-Z]*;
256 mv -f python python"%{binsuffix}" )
257 ( cd $RPM_BUILD_ROOT%{__prefix}/man/man1; mv python.1 python%{binsuffix}.1 )
258 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f pydoc pydoc"%{binsuffix}" )
259 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f idle idle"%{binsuffix}" )
260fi
261
262########
263# Tools
Sean Reifschneider7caafe72004-12-21 02:22:29 +0000264echo '#!%{__prefix}/bin/env python%{binsuffix}' >${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
265echo 'import os, sys' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
266echo '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}
267echo 'print "Failed to exec Idle"' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
268echo 'sys.exit(1)' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
Sean Reifschneider054541e2004-10-21 23:35:45 +0000269chmod 755 $RPM_BUILD_ROOT%{__prefix}/bin/idle%{binsuffix}
270cp -a Tools $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000271
272# MAKE FILE LISTS
273rm -f mainpkg.files
Sean Reifschneider054541e2004-10-21 23:35:45 +0000274find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/lib-dynload -type f |
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000275 sed "s|^${RPM_BUILD_ROOT}|/|" |
276 grep -v -e '_tkinter.so$' >mainpkg.files
277find "$RPM_BUILD_ROOT""%{__prefix}"/bin -type f |
278 sed "s|^${RPM_BUILD_ROOT}|/|" |
279 grep -v -e '/bin/idle%{binsuffix}$' >>mainpkg.files
280
281rm -f tools.files
Sean Reifschneider054541e2004-10-21 23:35:45 +0000282find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/idlelib \
283 "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/Tools -type f |
Martin v. Löwis52da4492003-10-19 18:34:52 +0000284 sed "s|^${RPM_BUILD_ROOT}|/|" >tools.files
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000285echo "%{__prefix}"/bin/idle%{binsuffix} >>tools.files
286
287######
288# Docs
Martin v. Löwis52da4492003-10-19 18:34:52 +0000289%if %{include_docs}
Sean Reifschneider054541e2004-10-21 23:35:45 +0000290mkdir -p "$RPM_BUILD_ROOT"%{config_htmldir}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000291(
Sean Reifschneider054541e2004-10-21 23:35:45 +0000292 cd "$RPM_BUILD_ROOT"%{config_htmldir}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000293 bunzip2 < %{SOURCE1} | tar x
294)
Martin v. Löwis52da4492003-10-19 18:34:52 +0000295%endif
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000296
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000297# fix the #! line in installed files
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000298find "$RPM_BUILD_ROOT" -type f -print0 |
299 xargs -0 grep -l /usr/local/bin/python | while read file
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000300do
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000301 FIXFILE="$file"
Sean Reifschneider054541e2004-10-21 23:35:45 +0000302 sed 's|^#!.*python|#!%{__prefix}/bin/env python'"%{binsuffix}"'|' \
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000303 "$FIXFILE" >/tmp/fix-python-path.$$
304 cat /tmp/fix-python-path.$$ >"$FIXFILE"
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000305 rm -f /tmp/fix-python-path.$$
306done
307
308# check to see if there are any straggling #! lines
309find "$RPM_BUILD_ROOT" -type f | xargs egrep -n '^#! */usr/local/bin/python' \
310 | grep ':1:#!' >/tmp/python-rpm-files.$$ || true
311if [ -s /tmp/python-rpm-files.$$ ]
312then
313 echo '*****************************************************'
314 cat /tmp/python-rpm-files.$$
315 cat <<@EOF
316 *****************************************************
317 There are still files referencing /usr/local/bin/python in the
318 install directory. They are listed above. Please fix the .spec
319 file and try again. If you are an end-user, you probably want
320 to report this to jafo-rpms@tummy.com as well.
321 *****************************************************
322@EOF
323 rm -f /tmp/python-rpm-files.$$
324 exit 1
325fi
326rm -f /tmp/python-rpm-files.$$
327
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000328########
329# CLEAN
330########
331%clean
Martin v. Löwis52da4492003-10-19 18:34:52 +0000332[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000333rm -f mainpkg.files tools.files
334
335########
336# FILES
337########
338%files -f mainpkg.files
339%defattr(-,root,root)
340%doc Misc/README Misc/cheatsheet Misc/Porting
341%doc LICENSE Misc/ACKS Misc/HISTORY Misc/NEWS
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000342%{__prefix}/man/man1/python%{binsuffix}.1*
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000343
Sean Reifschneider054541e2004-10-21 23:35:45 +0000344%attr(755,root,root) %dir %{__prefix}/include/python%{libvers}
345%attr(755,root,root) %dir %{__prefix}/%{libdirname}/python%{libvers}/
346%{__prefix}/%{libdirname}/python%{libvers}/*.txt
347%{__prefix}/%{libdirname}/python%{libvers}/*.py*
348%{__prefix}/%{libdirname}/python%{libvers}/pdb.doc
349%{__prefix}/%{libdirname}/python%{libvers}/profile.doc
350%{__prefix}/%{libdirname}/python%{libvers}/curses
351%{__prefix}/%{libdirname}/python%{libvers}/distutils
352%{__prefix}/%{libdirname}/python%{libvers}/encodings
353%{__prefix}/%{libdirname}/python%{libvers}/plat-linux2
354%{__prefix}/%{libdirname}/python%{libvers}/site-packages
355%{__prefix}/%{libdirname}/python%{libvers}/test
356%{__prefix}/%{libdirname}/python%{libvers}/xml
357%{__prefix}/%{libdirname}/python%{libvers}/email
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000358%{__prefix}/%{libdirname}/python%{libvers}/email/mime
359%{__prefix}/%{libdirname}/python%{libvers}/sqlite3
Sean Reifschneider054541e2004-10-21 23:35:45 +0000360%{__prefix}/%{libdirname}/python%{libvers}/compiler
361%{__prefix}/%{libdirname}/python%{libvers}/bsddb
362%{__prefix}/%{libdirname}/python%{libvers}/hotshot
363%{__prefix}/%{libdirname}/python%{libvers}/logging
364%{__prefix}/%{libdirname}/python%{libvers}/lib-old
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000365
366%files devel
367%defattr(-,root,root)
368%{__prefix}/include/python%{libvers}/*.h
Sean Reifschneider054541e2004-10-21 23:35:45 +0000369%{__prefix}/%{libdirname}/python%{libvers}/config
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000370
371%files -f tools.files tools
372%defattr(-,root,root)
373
374%if %{include_tkinter}
375%files tkinter
376%defattr(-,root,root)
Sean Reifschneider054541e2004-10-21 23:35:45 +0000377%{__prefix}/%{libdirname}/python%{libvers}/lib-tk
378%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload/_tkinter.so*
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000379%endif
380
Martin v. Löwis52da4492003-10-19 18:34:52 +0000381%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000382%files docs
383%defattr(-,root,root)
Sean Reifschneider054541e2004-10-21 23:35:45 +0000384%{config_htmldir}/*
Martin v. Löwis52da4492003-10-19 18:34:52 +0000385%endif