blob: bd4c7f73ad674c8f150fe6df2660ed2744f38dc6 [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
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
Anthony Baxtere48bad72004-11-29 01:40:31 +000036%define version 2.4
Martin v. Löwis173ecb62004-05-31 19:40:57 +000037%define libvers 2.4
Sean Reifschneider7caafe72004-12-21 02:22:29 +000038%define release 2pydotorg
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
65Prefix: %{__prefix}
66Packager: Sean Reifschneider <jafo-rpms@tummy.com>
67
68%description
69Python is an interpreted, interactive, object-oriented programming
70language. It incorporates modules, exceptions, dynamic typing, very high
71level dynamic data types, and classes. Python combines remarkable power
72with very clear syntax. It has interfaces to many system calls and
73libraries, as well as to various window systems, and is extensible in C or
74C++. It is also usable as an extension language for applications that need
75a programmable interface. Finally, Python is portable: it runs on many
76brands of UNIX, on PCs under Windows, MS-DOS, and OS/2, and on the
77Mac.
78
79%package devel
80Summary: The libraries and header files needed for Python extension development.
81Prereq: python%{binsuffix} = %{PACKAGE_VERSION}
82Group: Development/Libraries
83
84%description devel
85The Python programming language's interpreter can be extended with
86dynamically loaded extensions and can be embedded in other programs.
87This package contains the header files and libraries needed to do
88these types of tasks.
89
90Install python-devel if you want to develop Python extensions. The
91python package will also need to be installed. You'll probably also
92want to install the python-docs package, which contains Python
93documentation.
94
95%if %{include_tkinter}
96%package tkinter
97Summary: A graphical user interface for the Python scripting language.
98Group: Development/Languages
99Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release}
100
101%description tkinter
102The Tkinter (Tk interface) program is an graphical user interface for
103the Python scripting language.
104
105You should install the tkinter package if you'd like to use a graphical
106user interface for Python programming.
107%endif
108
109%package tools
110Summary: A collection of development tools included with Python.
111Group: Development/Tools
112Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release}
113
114%description tools
115The Python package includes several development tools that are used
116to build python programs. This package contains a selection of those
117tools, including the IDLE Python IDE.
118
119Install python-tools if you want to use these tools to develop
120Python programs. You will also need to install the python and
121tkinter packages.
122
Martin v. Löwis52da4492003-10-19 18:34:52 +0000123%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000124%package docs
125Summary: Python-related documentation.
126Group: Development/Documentation
127
128%description docs
129Documentation relating to the Python programming language in HTML and info
130formats.
Martin v. Löwis52da4492003-10-19 18:34:52 +0000131%endif
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000132
133%changelog
Sean Reifschneider7caafe72004-12-21 02:22:29 +0000134* Mon Dec 20 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.4-2pydotorg]
135- Changing the idle wrapper so that it passes arguments to idle.
136
Sean Reifschneider054541e2004-10-21 23:35:45 +0000137* Tue Oct 19 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.4b1-1pydotorg]
138- Updating to 2.4.
139
140* Thu Jul 22 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.4-3pydotorg]
141- Paul Tiemann fixes for %{prefix}.
142- Adding permission changes for directory as suggested by reimeika.ca
143- Adding code to detect when it should be using lib64.
144- Adding a define for the location of /var/www/html for docs.
145
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000146* Thu May 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.4-2pydotorg]
147- Including changes from Ian Holsman to build under Red Hat 7.3.
148- Fixing some problems with the /usr/local path change.
149
Skip Montanarobeddfcb2004-05-17 13:17:38 +0000150* Sat Mar 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-3pydotorg]
Martin v. Löwisfb66cd22004-03-31 18:59:04 +0000151- Being more agressive about finding the paths to fix for
152 #!/usr/local/bin/python.
153
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000154* Sat Feb 07 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.3-2pydotorg]
155- Adding code to remove "#!/usr/local/bin/python" from particular files and
156 causing the RPM build to terminate if there are any unexpected files
157 which have that line in them.
158
Martin v. Löwis52da4492003-10-19 18:34:52 +0000159* Mon Oct 13 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-1pydotorg]
160- Adding code to detect wether documentation is available to build.
161
162* Fri Sep 19 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.1-1pydotorg]
163- Updating to the 2.3.1 release.
164
Guido van Rossum0f698332003-02-24 17:55:37 +0000165* Mon Feb 24 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3b1-1pydotorg]
166- Updating to 2.3b1 release.
167
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000168* Mon Feb 17 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3a1-1]
169- Updating to 2.3 release.
170
171* Sun Dec 23 2001 Sean Reifschneider <jafo-rpms@tummy.com>
172[Release 2.2-2]
173- Added -docs package.
174- Added "auto" config_tkinter setting which only enables tk if
175 /usr/bin/wish exists.
176
177* Sat Dec 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
178[Release 2.2-1]
179- Updated to 2.2.
180- Changed the extension to "2" from "2.2".
181
182* Tue Nov 18 2001 Sean Reifschneider <jafo-rpms@tummy.com>
183[Release 2.2c1-1]
184- Updated to 2.2c1.
185
186* Thu Nov 1 2001 Sean Reifschneider <jafo-rpms@tummy.com>
187[Release 2.2b1-3]
188- Changed the way the sed for fixing the #! in pydoc works.
189
190* Wed Oct 24 2001 Sean Reifschneider <jafo-rpms@tummy.com>
191[Release 2.2b1-2]
192- Fixed missing "email" package, thanks to anonymous report on sourceforge.
193- Fixed missing "compiler" package.
194
195* Mon Oct 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
196[Release 2.2b1-1]
197- Updated to 2.2b1.
198
199* Mon Oct 9 2001 Sean Reifschneider <jafo-rpms@tummy.com>
200[Release 2.2a4-4]
201- otto@balinor.mat.unimi.it mentioned that the license file is missing.
202
203* Sun Sep 30 2001 Sean Reifschneider <jafo-rpms@tummy.com>
204[Release 2.2a4-3]
205- Ignacio Vazquez-Abrams pointed out that I had a spruious double-quote in
206 the spec files. Thanks.
207
208* Wed Jul 25 2001 Sean Reifschneider <jafo-rpms@tummy.com>
209[Release 2.2a1-1]
210- Updated to 2.2a1 release.
211- Changed idle and pydoc to use binsuffix macro
212
213#######
214# PREP
215#######
216%prep
217%setup -n Python-%{version}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000218
219########
220# BUILD
221########
222%build
Martin v. Löwis52da4492003-10-19 18:34:52 +0000223./configure --enable-unicode=ucs4 %{ipv6} %{pymalloc} --prefix=%{__prefix}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000224make
225
226##########
227# INSTALL
228##########
229%install
230# set the install path
231echo '[install_scripts]' >setup.cfg
Sean Reifschneider054541e2004-10-21 23:35:45 +0000232echo 'install_dir='"${RPM_BUILD_ROOT}%{__prefix}/bin" >>setup.cfg
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000233
234[ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
Sean Reifschneider054541e2004-10-21 23:35:45 +0000235mkdir -p $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000236make prefix=$RPM_BUILD_ROOT%{__prefix} install
237
238# REPLACE PATH IN PYDOC
239if [ ! -z "%{binsuffix}" ]
240then
241 (
242 cd $RPM_BUILD_ROOT%{__prefix}/bin
243 mv pydoc pydoc.old
Sean Reifschneider054541e2004-10-21 23:35:45 +0000244 sed 's|#!.*|#!%{__prefix}/bin/env python'%{binsuffix}'|' \
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000245 pydoc.old >pydoc
246 chmod 755 pydoc
247 rm -f pydoc.old
248 )
249fi
250
251# add the binsuffix
252if [ ! -z "%{binsuffix}" ]
253then
254 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; rm -f python[0-9a-zA-Z]*;
255 mv -f python python"%{binsuffix}" )
256 ( cd $RPM_BUILD_ROOT%{__prefix}/man/man1; mv python.1 python%{binsuffix}.1 )
257 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f pydoc pydoc"%{binsuffix}" )
258 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f idle idle"%{binsuffix}" )
259fi
260
261########
262# Tools
Sean Reifschneider7caafe72004-12-21 02:22:29 +0000263echo '#!%{__prefix}/bin/env python%{binsuffix}' >${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
264echo 'import os, sys' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
265echo '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}
266echo 'print "Failed to exec Idle"' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
267echo 'sys.exit(1)' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
Sean Reifschneider054541e2004-10-21 23:35:45 +0000268chmod 755 $RPM_BUILD_ROOT%{__prefix}/bin/idle%{binsuffix}
269cp -a Tools $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000270
271# MAKE FILE LISTS
272rm -f mainpkg.files
Sean Reifschneider054541e2004-10-21 23:35:45 +0000273find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/lib-dynload -type f |
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000274 sed "s|^${RPM_BUILD_ROOT}|/|" |
275 grep -v -e '_tkinter.so$' >mainpkg.files
276find "$RPM_BUILD_ROOT""%{__prefix}"/bin -type f |
277 sed "s|^${RPM_BUILD_ROOT}|/|" |
278 grep -v -e '/bin/idle%{binsuffix}$' >>mainpkg.files
279
280rm -f tools.files
Sean Reifschneider054541e2004-10-21 23:35:45 +0000281find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/idlelib \
282 "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/Tools -type f |
Martin v. Löwis52da4492003-10-19 18:34:52 +0000283 sed "s|^${RPM_BUILD_ROOT}|/|" >tools.files
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000284echo "%{__prefix}"/bin/idle%{binsuffix} >>tools.files
285
286######
287# Docs
Martin v. Löwis52da4492003-10-19 18:34:52 +0000288%if %{include_docs}
Sean Reifschneider054541e2004-10-21 23:35:45 +0000289mkdir -p "$RPM_BUILD_ROOT"%{config_htmldir}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000290(
Sean Reifschneider054541e2004-10-21 23:35:45 +0000291 cd "$RPM_BUILD_ROOT"%{config_htmldir}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000292 bunzip2 < %{SOURCE1} | tar x
293)
Martin v. Löwis52da4492003-10-19 18:34:52 +0000294%endif
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000295
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000296# fix the #! line in installed files
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000297find "$RPM_BUILD_ROOT" -type f -print0 |
298 xargs -0 grep -l /usr/local/bin/python | while read file
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000299do
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000300 FIXFILE="$file"
Sean Reifschneider054541e2004-10-21 23:35:45 +0000301 sed 's|^#!.*python|#!%{__prefix}/bin/env python'"%{binsuffix}"'|' \
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000302 "$FIXFILE" >/tmp/fix-python-path.$$
303 cat /tmp/fix-python-path.$$ >"$FIXFILE"
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000304 rm -f /tmp/fix-python-path.$$
305done
306
307# check to see if there are any straggling #! lines
308find "$RPM_BUILD_ROOT" -type f | xargs egrep -n '^#! */usr/local/bin/python' \
309 | grep ':1:#!' >/tmp/python-rpm-files.$$ || true
310if [ -s /tmp/python-rpm-files.$$ ]
311then
312 echo '*****************************************************'
313 cat /tmp/python-rpm-files.$$
314 cat <<@EOF
315 *****************************************************
316 There are still files referencing /usr/local/bin/python in the
317 install directory. They are listed above. Please fix the .spec
318 file and try again. If you are an end-user, you probably want
319 to report this to jafo-rpms@tummy.com as well.
320 *****************************************************
321@EOF
322 rm -f /tmp/python-rpm-files.$$
323 exit 1
324fi
325rm -f /tmp/python-rpm-files.$$
326
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000327########
328# CLEAN
329########
330%clean
Martin v. Löwis52da4492003-10-19 18:34:52 +0000331[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000332rm -f mainpkg.files tools.files
333
334########
335# FILES
336########
337%files -f mainpkg.files
338%defattr(-,root,root)
339%doc Misc/README Misc/cheatsheet Misc/Porting
340%doc LICENSE Misc/ACKS Misc/HISTORY Misc/NEWS
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000341%{__prefix}/man/man1/python%{binsuffix}.1*
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000342
Sean Reifschneider054541e2004-10-21 23:35:45 +0000343%attr(755,root,root) %dir %{__prefix}/include/python%{libvers}
344%attr(755,root,root) %dir %{__prefix}/%{libdirname}/python%{libvers}/
345%{__prefix}/%{libdirname}/python%{libvers}/*.txt
346%{__prefix}/%{libdirname}/python%{libvers}/*.py*
347%{__prefix}/%{libdirname}/python%{libvers}/pdb.doc
348%{__prefix}/%{libdirname}/python%{libvers}/profile.doc
349%{__prefix}/%{libdirname}/python%{libvers}/curses
350%{__prefix}/%{libdirname}/python%{libvers}/distutils
351%{__prefix}/%{libdirname}/python%{libvers}/encodings
352%{__prefix}/%{libdirname}/python%{libvers}/plat-linux2
353%{__prefix}/%{libdirname}/python%{libvers}/site-packages
354%{__prefix}/%{libdirname}/python%{libvers}/test
355%{__prefix}/%{libdirname}/python%{libvers}/xml
356%{__prefix}/%{libdirname}/python%{libvers}/email
357%{__prefix}/%{libdirname}/python%{libvers}/compiler
358%{__prefix}/%{libdirname}/python%{libvers}/bsddb
359%{__prefix}/%{libdirname}/python%{libvers}/hotshot
360%{__prefix}/%{libdirname}/python%{libvers}/logging
361%{__prefix}/%{libdirname}/python%{libvers}/lib-old
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000362
363%files devel
364%defattr(-,root,root)
365%{__prefix}/include/python%{libvers}/*.h
Sean Reifschneider054541e2004-10-21 23:35:45 +0000366%{__prefix}/%{libdirname}/python%{libvers}/config
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000367
368%files -f tools.files tools
369%defattr(-,root,root)
370
371%if %{include_tkinter}
372%files tkinter
373%defattr(-,root,root)
Sean Reifschneider054541e2004-10-21 23:35:45 +0000374%{__prefix}/%{libdirname}/python%{libvers}/lib-tk
375%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload/_tkinter.so*
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000376%endif
377
Martin v. Löwis52da4492003-10-19 18:34:52 +0000378%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000379%files docs
380%defattr(-,root,root)
Sean Reifschneider054541e2004-10-21 23:35:45 +0000381%{config_htmldir}/*
Martin v. Löwis52da4492003-10-19 18:34:52 +0000382%endif