blob: 0f1dbd574ad95e23126ff955d6fbfd1c7487e027 [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 Baxter6a587c12004-10-15 08:07:21 +000036%define version 2.4b1
Martin v. Löwis173ecb62004-05-31 19:40:57 +000037%define libvers 2.4
38%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
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 Reifschneider054541e2004-10-21 23:35:45 +0000134* Tue Oct 19 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.4b1-1pydotorg]
135- Updating to 2.4.
136
137* Thu Jul 22 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.4-3pydotorg]
138- Paul Tiemann fixes for %{prefix}.
139- Adding permission changes for directory as suggested by reimeika.ca
140- Adding code to detect when it should be using lib64.
141- Adding a define for the location of /var/www/html for docs.
142
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000143* Thu May 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.4-2pydotorg]
144- Including changes from Ian Holsman to build under Red Hat 7.3.
145- Fixing some problems with the /usr/local path change.
146
Skip Montanarobeddfcb2004-05-17 13:17:38 +0000147* Sat Mar 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-3pydotorg]
Martin v. Löwisfb66cd22004-03-31 18:59:04 +0000148- Being more agressive about finding the paths to fix for
149 #!/usr/local/bin/python.
150
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000151* Sat Feb 07 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.3-2pydotorg]
152- Adding code to remove "#!/usr/local/bin/python" from particular files and
153 causing the RPM build to terminate if there are any unexpected files
154 which have that line in them.
155
Martin v. Löwis52da4492003-10-19 18:34:52 +0000156* Mon Oct 13 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-1pydotorg]
157- Adding code to detect wether documentation is available to build.
158
159* Fri Sep 19 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.1-1pydotorg]
160- Updating to the 2.3.1 release.
161
Guido van Rossum0f698332003-02-24 17:55:37 +0000162* Mon Feb 24 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3b1-1pydotorg]
163- Updating to 2.3b1 release.
164
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000165* Mon Feb 17 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3a1-1]
166- Updating to 2.3 release.
167
168* Sun Dec 23 2001 Sean Reifschneider <jafo-rpms@tummy.com>
169[Release 2.2-2]
170- Added -docs package.
171- Added "auto" config_tkinter setting which only enables tk if
172 /usr/bin/wish exists.
173
174* Sat Dec 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
175[Release 2.2-1]
176- Updated to 2.2.
177- Changed the extension to "2" from "2.2".
178
179* Tue Nov 18 2001 Sean Reifschneider <jafo-rpms@tummy.com>
180[Release 2.2c1-1]
181- Updated to 2.2c1.
182
183* Thu Nov 1 2001 Sean Reifschneider <jafo-rpms@tummy.com>
184[Release 2.2b1-3]
185- Changed the way the sed for fixing the #! in pydoc works.
186
187* Wed Oct 24 2001 Sean Reifschneider <jafo-rpms@tummy.com>
188[Release 2.2b1-2]
189- Fixed missing "email" package, thanks to anonymous report on sourceforge.
190- Fixed missing "compiler" package.
191
192* Mon Oct 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
193[Release 2.2b1-1]
194- Updated to 2.2b1.
195
196* Mon Oct 9 2001 Sean Reifschneider <jafo-rpms@tummy.com>
197[Release 2.2a4-4]
198- otto@balinor.mat.unimi.it mentioned that the license file is missing.
199
200* Sun Sep 30 2001 Sean Reifschneider <jafo-rpms@tummy.com>
201[Release 2.2a4-3]
202- Ignacio Vazquez-Abrams pointed out that I had a spruious double-quote in
203 the spec files. Thanks.
204
205* Wed Jul 25 2001 Sean Reifschneider <jafo-rpms@tummy.com>
206[Release 2.2a1-1]
207- Updated to 2.2a1 release.
208- Changed idle and pydoc to use binsuffix macro
209
210#######
211# PREP
212#######
213%prep
214%setup -n Python-%{version}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000215
216########
217# BUILD
218########
219%build
Martin v. Löwis52da4492003-10-19 18:34:52 +0000220./configure --enable-unicode=ucs4 %{ipv6} %{pymalloc} --prefix=%{__prefix}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000221make
222
223##########
224# INSTALL
225##########
226%install
227# set the install path
228echo '[install_scripts]' >setup.cfg
Sean Reifschneider054541e2004-10-21 23:35:45 +0000229echo 'install_dir='"${RPM_BUILD_ROOT}%{__prefix}/bin" >>setup.cfg
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000230
231[ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
Sean Reifschneider054541e2004-10-21 23:35:45 +0000232mkdir -p $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000233make prefix=$RPM_BUILD_ROOT%{__prefix} install
234
235# REPLACE PATH IN PYDOC
236if [ ! -z "%{binsuffix}" ]
237then
238 (
239 cd $RPM_BUILD_ROOT%{__prefix}/bin
240 mv pydoc pydoc.old
Sean Reifschneider054541e2004-10-21 23:35:45 +0000241 sed 's|#!.*|#!%{__prefix}/bin/env python'%{binsuffix}'|' \
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000242 pydoc.old >pydoc
243 chmod 755 pydoc
244 rm -f pydoc.old
245 )
246fi
247
248# add the binsuffix
249if [ ! -z "%{binsuffix}" ]
250then
251 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; rm -f python[0-9a-zA-Z]*;
252 mv -f python python"%{binsuffix}" )
253 ( cd $RPM_BUILD_ROOT%{__prefix}/man/man1; mv python.1 python%{binsuffix}.1 )
254 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f pydoc pydoc"%{binsuffix}" )
255 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f idle idle"%{binsuffix}" )
256fi
257
258########
259# Tools
Sean Reifschneider054541e2004-10-21 23:35:45 +0000260echo '#!/bin/bash' >${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
261echo 'exec %{__prefix}/bin/python%{binsuffix} %{__prefix}/%{libdirname}/python%{libvers}/idlelib/idle.py' >>$RPM_BUILD_ROOT%{__prefix}/bin/idle%{binsuffix}
262chmod 755 $RPM_BUILD_ROOT%{__prefix}/bin/idle%{binsuffix}
263cp -a Tools $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000264
265# MAKE FILE LISTS
266rm -f mainpkg.files
Sean Reifschneider054541e2004-10-21 23:35:45 +0000267find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/lib-dynload -type f |
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000268 sed "s|^${RPM_BUILD_ROOT}|/|" |
269 grep -v -e '_tkinter.so$' >mainpkg.files
270find "$RPM_BUILD_ROOT""%{__prefix}"/bin -type f |
271 sed "s|^${RPM_BUILD_ROOT}|/|" |
272 grep -v -e '/bin/idle%{binsuffix}$' >>mainpkg.files
273
274rm -f tools.files
Sean Reifschneider054541e2004-10-21 23:35:45 +0000275find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/idlelib \
276 "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/Tools -type f |
Martin v. Löwis52da4492003-10-19 18:34:52 +0000277 sed "s|^${RPM_BUILD_ROOT}|/|" >tools.files
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000278echo "%{__prefix}"/bin/idle%{binsuffix} >>tools.files
279
280######
281# Docs
Martin v. Löwis52da4492003-10-19 18:34:52 +0000282%if %{include_docs}
Sean Reifschneider054541e2004-10-21 23:35:45 +0000283mkdir -p "$RPM_BUILD_ROOT"%{config_htmldir}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000284(
Sean Reifschneider054541e2004-10-21 23:35:45 +0000285 cd "$RPM_BUILD_ROOT"%{config_htmldir}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000286 bunzip2 < %{SOURCE1} | tar x
287)
Martin v. Löwis52da4492003-10-19 18:34:52 +0000288%endif
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000289
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000290# fix the #! line in installed files
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000291find "$RPM_BUILD_ROOT" -type f -print0 |
292 xargs -0 grep -l /usr/local/bin/python | while read file
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000293do
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000294 FIXFILE="$file"
Sean Reifschneider054541e2004-10-21 23:35:45 +0000295 sed 's|^#!.*python|#!%{__prefix}/bin/env python'"%{binsuffix}"'|' \
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000296 "$FIXFILE" >/tmp/fix-python-path.$$
297 cat /tmp/fix-python-path.$$ >"$FIXFILE"
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000298 rm -f /tmp/fix-python-path.$$
299done
300
301# check to see if there are any straggling #! lines
302find "$RPM_BUILD_ROOT" -type f | xargs egrep -n '^#! */usr/local/bin/python' \
303 | grep ':1:#!' >/tmp/python-rpm-files.$$ || true
304if [ -s /tmp/python-rpm-files.$$ ]
305then
306 echo '*****************************************************'
307 cat /tmp/python-rpm-files.$$
308 cat <<@EOF
309 *****************************************************
310 There are still files referencing /usr/local/bin/python in the
311 install directory. They are listed above. Please fix the .spec
312 file and try again. If you are an end-user, you probably want
313 to report this to jafo-rpms@tummy.com as well.
314 *****************************************************
315@EOF
316 rm -f /tmp/python-rpm-files.$$
317 exit 1
318fi
319rm -f /tmp/python-rpm-files.$$
320
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000321########
322# CLEAN
323########
324%clean
Martin v. Löwis52da4492003-10-19 18:34:52 +0000325[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000326rm -f mainpkg.files tools.files
327
328########
329# FILES
330########
331%files -f mainpkg.files
332%defattr(-,root,root)
333%doc Misc/README Misc/cheatsheet Misc/Porting
334%doc LICENSE Misc/ACKS Misc/HISTORY Misc/NEWS
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000335%{__prefix}/man/man1/python%{binsuffix}.1*
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000336
Sean Reifschneider054541e2004-10-21 23:35:45 +0000337%attr(755,root,root) %dir %{__prefix}/include/python%{libvers}
338%attr(755,root,root) %dir %{__prefix}/%{libdirname}/python%{libvers}/
339%{__prefix}/%{libdirname}/python%{libvers}/*.txt
340%{__prefix}/%{libdirname}/python%{libvers}/*.py*
341%{__prefix}/%{libdirname}/python%{libvers}/pdb.doc
342%{__prefix}/%{libdirname}/python%{libvers}/profile.doc
343%{__prefix}/%{libdirname}/python%{libvers}/curses
344%{__prefix}/%{libdirname}/python%{libvers}/distutils
345%{__prefix}/%{libdirname}/python%{libvers}/encodings
346%{__prefix}/%{libdirname}/python%{libvers}/plat-linux2
347%{__prefix}/%{libdirname}/python%{libvers}/site-packages
348%{__prefix}/%{libdirname}/python%{libvers}/test
349%{__prefix}/%{libdirname}/python%{libvers}/xml
350%{__prefix}/%{libdirname}/python%{libvers}/email
351%{__prefix}/%{libdirname}/python%{libvers}/compiler
352%{__prefix}/%{libdirname}/python%{libvers}/bsddb
353%{__prefix}/%{libdirname}/python%{libvers}/hotshot
354%{__prefix}/%{libdirname}/python%{libvers}/logging
355%{__prefix}/%{libdirname}/python%{libvers}/lib-old
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000356
357%files devel
358%defattr(-,root,root)
359%{__prefix}/include/python%{libvers}/*.h
Sean Reifschneider054541e2004-10-21 23:35:45 +0000360%{__prefix}/%{libdirname}/python%{libvers}/config
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000361
362%files -f tools.files tools
363%defattr(-,root,root)
364
365%if %{include_tkinter}
366%files tkinter
367%defattr(-,root,root)
Sean Reifschneider054541e2004-10-21 23:35:45 +0000368%{__prefix}/%{libdirname}/python%{libvers}/lib-tk
369%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload/_tkinter.so*
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000370%endif
371
Martin v. Löwis52da4492003-10-19 18:34:52 +0000372%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000373%files docs
374%defattr(-,root,root)
Sean Reifschneider054541e2004-10-21 23:35:45 +0000375%{config_htmldir}/*
Martin v. Löwis52da4492003-10-19 18:34:52 +0000376%endif