blob: 30352b15654f10893579098cf75fd865ab4ca198 [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
Barry Warsawbb5cd082008-04-02 23:33:27 +000036#--start constants--
Barry Warsaw4bd1cef2008-07-18 02:28:44 +000037%define version 3.0b2
Barry Warsawbb5cd082008-04-02 23:33:27 +000038%define libver 3.0
39#--end constants--
Thomas Wouters49fd7fa2006-04-21 10:40:58 +000040%define release 1pydotorg
Guido van Rossum2ef777f2003-02-24 01:09:53 +000041%define __prefix /usr
42
43# kludge to get around rpm <percent>define weirdness
44%define ipv6 %(if [ "%{config_ipv6}" = yes ]; then echo --enable-ipv6; else echo --disable-ipv6; fi)
45%define pymalloc %(if [ "%{config_pymalloc}" = yes ]; then echo --with-pymalloc; else echo --without-pymalloc; fi)
46%define binsuffix %(if [ "%{config_binsuffix}" = none ]; then echo ; else echo "%{config_binsuffix}"; fi)
47%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 +000048%define libdirname %(( uname -m | egrep -q '_64$' && [ -d /usr/lib64 ] && echo lib64 ) || echo lib)
Guido van Rossum2ef777f2003-02-24 01:09:53 +000049
Martin v. Löwis52da4492003-10-19 18:34:52 +000050# detect if documentation is available
51%define include_docs %(if [ -f "%{_sourcedir}/html-%{version}.tar.bz2" ]; then echo 1; else echo 0; fi)
52
Guido van Rossum2ef777f2003-02-24 01:09:53 +000053Summary: An interpreted, interactive, object-oriented programming language.
54Name: %{name}%{binsuffix}
55Version: %{version}
56Release: %{release}
57Copyright: Modified CNRI Open Source License
58Group: Development/Languages
Sean Reifschneider054541e2004-10-21 23:35:45 +000059Source: Python-%{version}.tar.bz2
Martin v. Löwis52da4492003-10-19 18:34:52 +000060%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +000061Source1: html-%{version}.tar.bz2
Martin v. Löwis52da4492003-10-19 18:34:52 +000062%endif
63BuildRoot: %{_tmppath}/%{name}-%{version}-root
Guido van Rossum2ef777f2003-02-24 01:09:53 +000064BuildPrereq: expat-devel
65BuildPrereq: db4-devel
66BuildPrereq: gdbm-devel
Thomas Wouters49fd7fa2006-04-21 10:40:58 +000067BuildPrereq: sqlite-devel
Guido van Rossum2ef777f2003-02-24 01:09:53 +000068Prefix: %{__prefix}
69Packager: Sean Reifschneider <jafo-rpms@tummy.com>
70
71%description
72Python is an interpreted, interactive, object-oriented programming
73language. It incorporates modules, exceptions, dynamic typing, very high
74level dynamic data types, and classes. Python combines remarkable power
75with very clear syntax. It has interfaces to many system calls and
76libraries, as well as to various window systems, and is extensible in C or
77C++. It is also usable as an extension language for applications that need
78a programmable interface. Finally, Python is portable: it runs on many
79brands of UNIX, on PCs under Windows, MS-DOS, and OS/2, and on the
80Mac.
81
82%package devel
83Summary: The libraries and header files needed for Python extension development.
84Prereq: python%{binsuffix} = %{PACKAGE_VERSION}
85Group: Development/Libraries
86
87%description devel
88The Python programming language's interpreter can be extended with
89dynamically loaded extensions and can be embedded in other programs.
90This package contains the header files and libraries needed to do
91these types of tasks.
92
93Install python-devel if you want to develop Python extensions. The
94python package will also need to be installed. You'll probably also
95want to install the python-docs package, which contains Python
96documentation.
97
98%if %{include_tkinter}
99%package tkinter
100Summary: A graphical user interface for the Python scripting language.
101Group: Development/Languages
102Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release}
103
104%description tkinter
105The Tkinter (Tk interface) program is an graphical user interface for
106the Python scripting language.
107
108You should install the tkinter package if you'd like to use a graphical
109user interface for Python programming.
110%endif
111
112%package tools
113Summary: A collection of development tools included with Python.
114Group: Development/Tools
115Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release}
116
117%description tools
118The Python package includes several development tools that are used
119to build python programs. This package contains a selection of those
120tools, including the IDLE Python IDE.
121
122Install python-tools if you want to use these tools to develop
123Python programs. You will also need to install the python and
124tkinter packages.
125
Martin v. Löwis52da4492003-10-19 18:34:52 +0000126%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000127%package docs
128Summary: Python-related documentation.
129Group: Development/Documentation
130
131%description docs
132Documentation relating to the Python programming language in HTML and info
133formats.
Martin v. Löwis52da4492003-10-19 18:34:52 +0000134%endif
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000135
136%changelog
Sean Reifschneider7caafe72004-12-21 02:22:29 +0000137* Mon Dec 20 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.4-2pydotorg]
138- Changing the idle wrapper so that it passes arguments to idle.
139
Sean Reifschneider054541e2004-10-21 23:35:45 +0000140* Tue Oct 19 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.4b1-1pydotorg]
141- Updating to 2.4.
142
143* Thu Jul 22 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.4-3pydotorg]
144- Paul Tiemann fixes for %{prefix}.
145- Adding permission changes for directory as suggested by reimeika.ca
146- Adding code to detect when it should be using lib64.
147- Adding a define for the location of /var/www/html for docs.
148
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000149* Thu May 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.4-2pydotorg]
150- Including changes from Ian Holsman to build under Red Hat 7.3.
151- Fixing some problems with the /usr/local path change.
152
Skip Montanarobeddfcb2004-05-17 13:17:38 +0000153* Sat Mar 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-3pydotorg]
Martin v. Löwisfb66cd22004-03-31 18:59:04 +0000154- Being more agressive about finding the paths to fix for
155 #!/usr/local/bin/python.
156
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000157* Sat Feb 07 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.3-2pydotorg]
158- Adding code to remove "#!/usr/local/bin/python" from particular files and
159 causing the RPM build to terminate if there are any unexpected files
160 which have that line in them.
161
Martin v. Löwis52da4492003-10-19 18:34:52 +0000162* Mon Oct 13 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-1pydotorg]
163- Adding code to detect wether documentation is available to build.
164
165* Fri Sep 19 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.1-1pydotorg]
166- Updating to the 2.3.1 release.
167
Guido van Rossum0f698332003-02-24 17:55:37 +0000168* Mon Feb 24 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3b1-1pydotorg]
169- Updating to 2.3b1 release.
170
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000171* Mon Feb 17 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3a1-1]
172- Updating to 2.3 release.
173
174* Sun Dec 23 2001 Sean Reifschneider <jafo-rpms@tummy.com>
175[Release 2.2-2]
176- Added -docs package.
177- Added "auto" config_tkinter setting which only enables tk if
178 /usr/bin/wish exists.
179
180* Sat Dec 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
181[Release 2.2-1]
182- Updated to 2.2.
183- Changed the extension to "2" from "2.2".
184
185* Tue Nov 18 2001 Sean Reifschneider <jafo-rpms@tummy.com>
186[Release 2.2c1-1]
187- Updated to 2.2c1.
188
189* Thu Nov 1 2001 Sean Reifschneider <jafo-rpms@tummy.com>
190[Release 2.2b1-3]
191- Changed the way the sed for fixing the #! in pydoc works.
192
193* Wed Oct 24 2001 Sean Reifschneider <jafo-rpms@tummy.com>
194[Release 2.2b1-2]
195- Fixed missing "email" package, thanks to anonymous report on sourceforge.
196- Fixed missing "compiler" package.
197
198* Mon Oct 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
199[Release 2.2b1-1]
200- Updated to 2.2b1.
201
202* Mon Oct 9 2001 Sean Reifschneider <jafo-rpms@tummy.com>
203[Release 2.2a4-4]
204- otto@balinor.mat.unimi.it mentioned that the license file is missing.
205
206* Sun Sep 30 2001 Sean Reifschneider <jafo-rpms@tummy.com>
207[Release 2.2a4-3]
208- Ignacio Vazquez-Abrams pointed out that I had a spruious double-quote in
209 the spec files. Thanks.
210
211* Wed Jul 25 2001 Sean Reifschneider <jafo-rpms@tummy.com>
212[Release 2.2a1-1]
213- Updated to 2.2a1 release.
214- Changed idle and pydoc to use binsuffix macro
215
216#######
217# PREP
218#######
219%prep
220%setup -n Python-%{version}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000221
222########
223# BUILD
224########
225%build
Martin v. Löwis52da4492003-10-19 18:34:52 +0000226./configure --enable-unicode=ucs4 %{ipv6} %{pymalloc} --prefix=%{__prefix}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000227make
228
229##########
230# INSTALL
231##########
232%install
233# set the install path
234echo '[install_scripts]' >setup.cfg
Sean Reifschneider054541e2004-10-21 23:35:45 +0000235echo 'install_dir='"${RPM_BUILD_ROOT}%{__prefix}/bin" >>setup.cfg
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000236
237[ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
Sean Reifschneider054541e2004-10-21 23:35:45 +0000238mkdir -p $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000239make prefix=$RPM_BUILD_ROOT%{__prefix} install
240
241# REPLACE PATH IN PYDOC
242if [ ! -z "%{binsuffix}" ]
243then
244 (
245 cd $RPM_BUILD_ROOT%{__prefix}/bin
246 mv pydoc pydoc.old
Sean Reifschneider054541e2004-10-21 23:35:45 +0000247 sed 's|#!.*|#!%{__prefix}/bin/env python'%{binsuffix}'|' \
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000248 pydoc.old >pydoc
249 chmod 755 pydoc
250 rm -f pydoc.old
251 )
252fi
253
254# add the binsuffix
255if [ ! -z "%{binsuffix}" ]
256then
257 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; rm -f python[0-9a-zA-Z]*;
258 mv -f python python"%{binsuffix}" )
259 ( cd $RPM_BUILD_ROOT%{__prefix}/man/man1; mv python.1 python%{binsuffix}.1 )
260 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f pydoc pydoc"%{binsuffix}" )
261 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f idle idle"%{binsuffix}" )
262fi
263
264########
265# Tools
Sean Reifschneider7caafe72004-12-21 02:22:29 +0000266echo '#!%{__prefix}/bin/env python%{binsuffix}' >${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
267echo 'import os, sys' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
268echo '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}
269echo 'print "Failed to exec Idle"' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
270echo 'sys.exit(1)' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
Sean Reifschneider054541e2004-10-21 23:35:45 +0000271chmod 755 $RPM_BUILD_ROOT%{__prefix}/bin/idle%{binsuffix}
272cp -a Tools $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000273
274# MAKE FILE LISTS
275rm -f mainpkg.files
Sean Reifschneider054541e2004-10-21 23:35:45 +0000276find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/lib-dynload -type f |
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000277 sed "s|^${RPM_BUILD_ROOT}|/|" |
278 grep -v -e '_tkinter.so$' >mainpkg.files
279find "$RPM_BUILD_ROOT""%{__prefix}"/bin -type f |
280 sed "s|^${RPM_BUILD_ROOT}|/|" |
281 grep -v -e '/bin/idle%{binsuffix}$' >>mainpkg.files
282
283rm -f tools.files
Sean Reifschneider054541e2004-10-21 23:35:45 +0000284find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/idlelib \
285 "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/Tools -type f |
Martin v. Löwis52da4492003-10-19 18:34:52 +0000286 sed "s|^${RPM_BUILD_ROOT}|/|" >tools.files
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000287echo "%{__prefix}"/bin/idle%{binsuffix} >>tools.files
288
289######
290# Docs
Martin v. Löwis52da4492003-10-19 18:34:52 +0000291%if %{include_docs}
Sean Reifschneider054541e2004-10-21 23:35:45 +0000292mkdir -p "$RPM_BUILD_ROOT"%{config_htmldir}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000293(
Sean Reifschneider054541e2004-10-21 23:35:45 +0000294 cd "$RPM_BUILD_ROOT"%{config_htmldir}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000295 bunzip2 < %{SOURCE1} | tar x
296)
Martin v. Löwis52da4492003-10-19 18:34:52 +0000297%endif
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000298
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000299# fix the #! line in installed files
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000300find "$RPM_BUILD_ROOT" -type f -print0 |
301 xargs -0 grep -l /usr/local/bin/python | while read file
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000302do
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000303 FIXFILE="$file"
Sean Reifschneider054541e2004-10-21 23:35:45 +0000304 sed 's|^#!.*python|#!%{__prefix}/bin/env python'"%{binsuffix}"'|' \
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000305 "$FIXFILE" >/tmp/fix-python-path.$$
306 cat /tmp/fix-python-path.$$ >"$FIXFILE"
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000307 rm -f /tmp/fix-python-path.$$
308done
309
310# check to see if there are any straggling #! lines
311find "$RPM_BUILD_ROOT" -type f | xargs egrep -n '^#! */usr/local/bin/python' \
312 | grep ':1:#!' >/tmp/python-rpm-files.$$ || true
313if [ -s /tmp/python-rpm-files.$$ ]
314then
315 echo '*****************************************************'
316 cat /tmp/python-rpm-files.$$
317 cat <<@EOF
318 *****************************************************
319 There are still files referencing /usr/local/bin/python in the
320 install directory. They are listed above. Please fix the .spec
321 file and try again. If you are an end-user, you probably want
322 to report this to jafo-rpms@tummy.com as well.
323 *****************************************************
324@EOF
325 rm -f /tmp/python-rpm-files.$$
326 exit 1
327fi
328rm -f /tmp/python-rpm-files.$$
329
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000330########
331# CLEAN
332########
333%clean
Martin v. Löwis52da4492003-10-19 18:34:52 +0000334[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000335rm -f mainpkg.files tools.files
336
337########
338# FILES
339########
340%files -f mainpkg.files
341%defattr(-,root,root)
342%doc Misc/README Misc/cheatsheet Misc/Porting
343%doc LICENSE Misc/ACKS Misc/HISTORY Misc/NEWS
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000344%{__prefix}/man/man1/python%{binsuffix}.1*
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000345
Sean Reifschneider054541e2004-10-21 23:35:45 +0000346%attr(755,root,root) %dir %{__prefix}/include/python%{libvers}
347%attr(755,root,root) %dir %{__prefix}/%{libdirname}/python%{libvers}/
348%{__prefix}/%{libdirname}/python%{libvers}/*.txt
349%{__prefix}/%{libdirname}/python%{libvers}/*.py*
350%{__prefix}/%{libdirname}/python%{libvers}/pdb.doc
351%{__prefix}/%{libdirname}/python%{libvers}/profile.doc
352%{__prefix}/%{libdirname}/python%{libvers}/curses
353%{__prefix}/%{libdirname}/python%{libvers}/distutils
354%{__prefix}/%{libdirname}/python%{libvers}/encodings
355%{__prefix}/%{libdirname}/python%{libvers}/plat-linux2
356%{__prefix}/%{libdirname}/python%{libvers}/site-packages
357%{__prefix}/%{libdirname}/python%{libvers}/test
358%{__prefix}/%{libdirname}/python%{libvers}/xml
359%{__prefix}/%{libdirname}/python%{libvers}/email
Thomas Wouters49fd7fa2006-04-21 10:40:58 +0000360%{__prefix}/%{libdirname}/python%{libvers}/email/mime
361%{__prefix}/%{libdirname}/python%{libvers}/sqlite3
Sean Reifschneider054541e2004-10-21 23:35:45 +0000362%{__prefix}/%{libdirname}/python%{libvers}/compiler
363%{__prefix}/%{libdirname}/python%{libvers}/bsddb
364%{__prefix}/%{libdirname}/python%{libvers}/hotshot
365%{__prefix}/%{libdirname}/python%{libvers}/logging
366%{__prefix}/%{libdirname}/python%{libvers}/lib-old
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000367
368%files devel
369%defattr(-,root,root)
370%{__prefix}/include/python%{libvers}/*.h
Sean Reifschneider054541e2004-10-21 23:35:45 +0000371%{__prefix}/%{libdirname}/python%{libvers}/config
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000372
373%files -f tools.files tools
374%defattr(-,root,root)
375
376%if %{include_tkinter}
377%files tkinter
378%defattr(-,root,root)
Georg Brandl6e47a332008-05-17 19:15:58 +0000379%{__prefix}/%{libdirname}/python%{libvers}/tkinter
Sean Reifschneider054541e2004-10-21 23:35:45 +0000380%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload/_tkinter.so*
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000381%endif
382
Martin v. Löwis52da4492003-10-19 18:34:52 +0000383%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000384%files docs
385%defattr(-,root,root)
Sean Reifschneider054541e2004-10-21 23:35:45 +0000386%{config_htmldir}/*
Martin v. Löwis52da4492003-10-19 18:34:52 +0000387%endif