blob: 4882fbbd6df6b7372fd5be3bc5ef08900d50d982 [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 Reifscheider3a078aa2010-01-16 04:35:26 +000028# Build shared libraries or .a library?
29#WARNING: Commenting out doesn't work. Last line is what's used.
30%define config_sharedlib no
31%define config_sharedlib yes
32
Sean Reifschneider054541e2004-10-21 23:35:45 +000033# Location of the HTML directory.
34%define config_htmldir /var/www/html/python
35
Guido van Rossum2ef777f2003-02-24 01:09:53 +000036#################################
37# End of user-modifiable configs
38#################################
39
40%define name python
Barry Warsawbb5cd082008-04-02 23:33:27 +000041#--start constants--
Georg Brandl3ebb6b32011-02-20 10:37:07 +000042%define version 3.3a0
43%define libvers 3.3
Barry Warsawbb5cd082008-04-02 23:33:27 +000044#--end constants--
Thomas Wouters49fd7fa2006-04-21 10:40:58 +000045%define release 1pydotorg
Guido van Rossum2ef777f2003-02-24 01:09:53 +000046%define __prefix /usr
47
48# kludge to get around rpm <percent>define weirdness
49%define ipv6 %(if [ "%{config_ipv6}" = yes ]; then echo --enable-ipv6; else echo --disable-ipv6; fi)
50%define pymalloc %(if [ "%{config_pymalloc}" = yes ]; then echo --with-pymalloc; else echo --without-pymalloc; fi)
51%define binsuffix %(if [ "%{config_binsuffix}" = none ]; then echo ; else echo "%{config_binsuffix}"; fi)
52%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 +000053%define libdirname %(( uname -m | egrep -q '_64$' && [ -d /usr/lib64 ] && echo lib64 ) || echo lib)
Sean Reifscheider3a078aa2010-01-16 04:35:26 +000054%define sharedlib %(if [ "%{config_sharedlib}" = yes ]; then echo --enable-shared; else echo ; fi)
55%define include_sharedlib %(if [ "%{config_sharedlib}" = yes ]; then echo 1; else echo 0; fi)
Guido van Rossum2ef777f2003-02-24 01:09:53 +000056
Martin v. Löwis52da4492003-10-19 18:34:52 +000057# detect if documentation is available
58%define include_docs %(if [ -f "%{_sourcedir}/html-%{version}.tar.bz2" ]; then echo 1; else echo 0; fi)
59
Guido van Rossum2ef777f2003-02-24 01:09:53 +000060Summary: An interpreted, interactive, object-oriented programming language.
61Name: %{name}%{binsuffix}
62Version: %{version}
63Release: %{release}
Georg Brandlf5b204a2010-08-01 18:38:26 +000064License: PSF
Guido van Rossum2ef777f2003-02-24 01:09:53 +000065Group: Development/Languages
Sean Reifschneider054541e2004-10-21 23:35:45 +000066Source: Python-%{version}.tar.bz2
Martin v. Löwis52da4492003-10-19 18:34:52 +000067%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +000068Source1: html-%{version}.tar.bz2
Martin v. Löwis52da4492003-10-19 18:34:52 +000069%endif
70BuildRoot: %{_tmppath}/%{name}-%{version}-root
Guido van Rossum2ef777f2003-02-24 01:09:53 +000071BuildPrereq: expat-devel
72BuildPrereq: db4-devel
73BuildPrereq: gdbm-devel
Thomas Wouters49fd7fa2006-04-21 10:40:58 +000074BuildPrereq: sqlite-devel
Guido van Rossum2ef777f2003-02-24 01:09:53 +000075Prefix: %{__prefix}
76Packager: Sean Reifschneider <jafo-rpms@tummy.com>
77
78%description
79Python is an interpreted, interactive, object-oriented programming
80language. It incorporates modules, exceptions, dynamic typing, very high
81level dynamic data types, and classes. Python combines remarkable power
82with very clear syntax. It has interfaces to many system calls and
83libraries, as well as to various window systems, and is extensible in C or
84C++. It is also usable as an extension language for applications that need
85a programmable interface. Finally, Python is portable: it runs on many
86brands of UNIX, on PCs under Windows, MS-DOS, and OS/2, and on the
87Mac.
88
89%package devel
90Summary: The libraries and header files needed for Python extension development.
91Prereq: python%{binsuffix} = %{PACKAGE_VERSION}
92Group: Development/Libraries
93
94%description devel
95The Python programming language's interpreter can be extended with
96dynamically loaded extensions and can be embedded in other programs.
97This package contains the header files and libraries needed to do
98these types of tasks.
99
100Install python-devel if you want to develop Python extensions. The
101python package will also need to be installed. You'll probably also
102want to install the python-docs package, which contains Python
103documentation.
104
105%if %{include_tkinter}
106%package tkinter
107Summary: A graphical user interface for the Python scripting language.
108Group: Development/Languages
109Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release}
110
111%description tkinter
112The Tkinter (Tk interface) program is an graphical user interface for
113the Python scripting language.
114
115You should install the tkinter package if you'd like to use a graphical
116user interface for Python programming.
117%endif
118
119%package tools
120Summary: A collection of development tools included with Python.
121Group: Development/Tools
122Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release}
123
124%description tools
125The Python package includes several development tools that are used
126to build python programs. This package contains a selection of those
127tools, including the IDLE Python IDE.
128
129Install python-tools if you want to use these tools to develop
130Python programs. You will also need to install the python and
131tkinter packages.
132
Martin v. Löwis52da4492003-10-19 18:34:52 +0000133%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000134%package docs
135Summary: Python-related documentation.
136Group: Development/Documentation
137
138%description docs
139Documentation relating to the Python programming language in HTML and info
140formats.
Martin v. Löwis52da4492003-10-19 18:34:52 +0000141%endif
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000142
143%changelog
Sean Reifschneider7caafe72004-12-21 02:22:29 +0000144* Mon Dec 20 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.4-2pydotorg]
145- Changing the idle wrapper so that it passes arguments to idle.
146
Sean Reifschneider054541e2004-10-21 23:35:45 +0000147* Tue Oct 19 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.4b1-1pydotorg]
148- Updating to 2.4.
149
150* Thu Jul 22 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.4-3pydotorg]
151- Paul Tiemann fixes for %{prefix}.
152- Adding permission changes for directory as suggested by reimeika.ca
153- Adding code to detect when it should be using lib64.
154- Adding a define for the location of /var/www/html for docs.
155
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000156* Thu May 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.4-2pydotorg]
157- Including changes from Ian Holsman to build under Red Hat 7.3.
158- Fixing some problems with the /usr/local path change.
159
Skip Montanarobeddfcb2004-05-17 13:17:38 +0000160* Sat Mar 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-3pydotorg]
Martin v. Löwisfb66cd22004-03-31 18:59:04 +0000161- Being more agressive about finding the paths to fix for
162 #!/usr/local/bin/python.
163
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000164* Sat Feb 07 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.3-2pydotorg]
165- Adding code to remove "#!/usr/local/bin/python" from particular files and
166 causing the RPM build to terminate if there are any unexpected files
167 which have that line in them.
168
Martin v. Löwis52da4492003-10-19 18:34:52 +0000169* Mon Oct 13 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-1pydotorg]
170- Adding code to detect wether documentation is available to build.
171
172* Fri Sep 19 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.1-1pydotorg]
173- Updating to the 2.3.1 release.
174
Guido van Rossum0f698332003-02-24 17:55:37 +0000175* Mon Feb 24 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3b1-1pydotorg]
176- Updating to 2.3b1 release.
177
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000178* Mon Feb 17 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3a1-1]
179- Updating to 2.3 release.
180
181* Sun Dec 23 2001 Sean Reifschneider <jafo-rpms@tummy.com>
182[Release 2.2-2]
183- Added -docs package.
184- Added "auto" config_tkinter setting which only enables tk if
185 /usr/bin/wish exists.
186
187* Sat Dec 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
188[Release 2.2-1]
189- Updated to 2.2.
190- Changed the extension to "2" from "2.2".
191
192* Tue Nov 18 2001 Sean Reifschneider <jafo-rpms@tummy.com>
193[Release 2.2c1-1]
194- Updated to 2.2c1.
195
196* Thu Nov 1 2001 Sean Reifschneider <jafo-rpms@tummy.com>
197[Release 2.2b1-3]
198- Changed the way the sed for fixing the #! in pydoc works.
199
200* Wed Oct 24 2001 Sean Reifschneider <jafo-rpms@tummy.com>
201[Release 2.2b1-2]
202- Fixed missing "email" package, thanks to anonymous report on sourceforge.
203- Fixed missing "compiler" package.
204
205* Mon Oct 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
206[Release 2.2b1-1]
207- Updated to 2.2b1.
208
209* Mon Oct 9 2001 Sean Reifschneider <jafo-rpms@tummy.com>
210[Release 2.2a4-4]
211- otto@balinor.mat.unimi.it mentioned that the license file is missing.
212
213* Sun Sep 30 2001 Sean Reifschneider <jafo-rpms@tummy.com>
214[Release 2.2a4-3]
215- Ignacio Vazquez-Abrams pointed out that I had a spruious double-quote in
216 the spec files. Thanks.
217
218* Wed Jul 25 2001 Sean Reifschneider <jafo-rpms@tummy.com>
219[Release 2.2a1-1]
220- Updated to 2.2a1 release.
221- Changed idle and pydoc to use binsuffix macro
222
223#######
224# PREP
225#######
226%prep
227%setup -n Python-%{version}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000228
229########
230# BUILD
231########
232%build
Sean Reifscheider3a078aa2010-01-16 04:35:26 +0000233echo "Setting for ipv6: %{ipv6}"
234echo "Setting for pymalloc: %{pymalloc}"
235echo "Setting for binsuffix: %{binsuffix}"
236echo "Setting for include_tkinter: %{include_tkinter}"
237echo "Setting for libdirname: %{libdirname}"
238echo "Setting for sharedlib: %{sharedlib}"
239echo "Setting for include_sharedlib: %{include_sharedlib}"
240./configure --enable-unicode=ucs4 %{sharedlib} %{ipv6} %{pymalloc} --prefix=%{__prefix}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000241make
242
243##########
244# INSTALL
245##########
246%install
247# set the install path
248echo '[install_scripts]' >setup.cfg
Sean Reifschneider054541e2004-10-21 23:35:45 +0000249echo 'install_dir='"${RPM_BUILD_ROOT}%{__prefix}/bin" >>setup.cfg
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000250
251[ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
Sean Reifschneider054541e2004-10-21 23:35:45 +0000252mkdir -p $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000253make prefix=$RPM_BUILD_ROOT%{__prefix} install
254
255# REPLACE PATH IN PYDOC
256if [ ! -z "%{binsuffix}" ]
257then
258 (
259 cd $RPM_BUILD_ROOT%{__prefix}/bin
260 mv pydoc pydoc.old
Sean Reifschneider054541e2004-10-21 23:35:45 +0000261 sed 's|#!.*|#!%{__prefix}/bin/env python'%{binsuffix}'|' \
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000262 pydoc.old >pydoc
263 chmod 755 pydoc
264 rm -f pydoc.old
265 )
266fi
267
268# add the binsuffix
269if [ ! -z "%{binsuffix}" ]
270then
Sean Reifscheider3a078aa2010-01-16 04:35:26 +0000271 rm -f $RPM_BUILD_ROOT%{__prefix}/bin/python[0-9a-zA-Z]*
272 ( cd $RPM_BUILD_ROOT%{__prefix}/bin;
273 for file in *; do mv "$file" "$file"%{binsuffix}; done )
274 ( cd $RPM_BUILD_ROOT%{_mandir}/man1; mv python.1 python%{binsuffix}.1 )
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000275fi
276
277########
278# Tools
Sean Reifschneider7caafe72004-12-21 02:22:29 +0000279echo '#!%{__prefix}/bin/env python%{binsuffix}' >${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
280echo 'import os, sys' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
281echo '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}
282echo 'print "Failed to exec Idle"' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
283echo 'sys.exit(1)' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
Sean Reifschneider054541e2004-10-21 23:35:45 +0000284chmod 755 $RPM_BUILD_ROOT%{__prefix}/bin/idle%{binsuffix}
285cp -a Tools $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000286
287# MAKE FILE LISTS
288rm -f mainpkg.files
Sean Reifscheider3a078aa2010-01-16 04:35:26 +0000289find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers} -type f |
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000290 sed "s|^${RPM_BUILD_ROOT}|/|" |
Sean Reifscheider3a078aa2010-01-16 04:35:26 +0000291 grep -v -e '/python%{libvers}/config$' -e '_tkinter.so$' >mainpkg.files
292find "$RPM_BUILD_ROOT""%{__prefix}"/bin -type f -o -type l |
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000293 sed "s|^${RPM_BUILD_ROOT}|/|" |
Sean Reifscheider3a078aa2010-01-16 04:35:26 +0000294 grep -v -e '/bin/2to3%{binsuffix}$' |
295 grep -v -e '/bin/pydoc%{binsuffix}$' |
296 grep -v -e '/bin/smtpd.py%{binsuffix}$' |
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000297 grep -v -e '/bin/idle%{binsuffix}$' >>mainpkg.files
298
299rm -f tools.files
Sean Reifschneider054541e2004-10-21 23:35:45 +0000300find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/idlelib \
301 "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/Tools -type f |
Martin v. Löwis52da4492003-10-19 18:34:52 +0000302 sed "s|^${RPM_BUILD_ROOT}|/|" >tools.files
Sean Reifscheider3a078aa2010-01-16 04:35:26 +0000303echo "%{__prefix}"/bin/2to3%{binsuffix} >>tools.files
304echo "%{__prefix}"/bin/pydoc%{binsuffix} >>tools.files
305echo "%{__prefix}"/bin/smtpd.py%{binsuffix} >>tools.files
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000306echo "%{__prefix}"/bin/idle%{binsuffix} >>tools.files
307
308######
309# Docs
Martin v. Löwis52da4492003-10-19 18:34:52 +0000310%if %{include_docs}
Sean Reifschneider054541e2004-10-21 23:35:45 +0000311mkdir -p "$RPM_BUILD_ROOT"%{config_htmldir}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000312(
Sean Reifschneider054541e2004-10-21 23:35:45 +0000313 cd "$RPM_BUILD_ROOT"%{config_htmldir}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000314 bunzip2 < %{SOURCE1} | tar x
315)
Martin v. Löwis52da4492003-10-19 18:34:52 +0000316%endif
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000317
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000318# fix the #! line in installed files
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000319find "$RPM_BUILD_ROOT" -type f -print0 |
320 xargs -0 grep -l /usr/local/bin/python | while read file
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000321do
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000322 FIXFILE="$file"
Sean Reifschneider054541e2004-10-21 23:35:45 +0000323 sed 's|^#!.*python|#!%{__prefix}/bin/env python'"%{binsuffix}"'|' \
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000324 "$FIXFILE" >/tmp/fix-python-path.$$
325 cat /tmp/fix-python-path.$$ >"$FIXFILE"
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000326 rm -f /tmp/fix-python-path.$$
327done
328
329# check to see if there are any straggling #! lines
330find "$RPM_BUILD_ROOT" -type f | xargs egrep -n '^#! */usr/local/bin/python' \
331 | grep ':1:#!' >/tmp/python-rpm-files.$$ || true
332if [ -s /tmp/python-rpm-files.$$ ]
333then
334 echo '*****************************************************'
335 cat /tmp/python-rpm-files.$$
336 cat <<@EOF
337 *****************************************************
338 There are still files referencing /usr/local/bin/python in the
339 install directory. They are listed above. Please fix the .spec
340 file and try again. If you are an end-user, you probably want
341 to report this to jafo-rpms@tummy.com as well.
342 *****************************************************
343@EOF
344 rm -f /tmp/python-rpm-files.$$
345 exit 1
346fi
347rm -f /tmp/python-rpm-files.$$
348
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000349########
350# CLEAN
351########
352%clean
Martin v. Löwis52da4492003-10-19 18:34:52 +0000353[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000354rm -f mainpkg.files tools.files
355
356########
357# FILES
358########
359%files -f mainpkg.files
360%defattr(-,root,root)
361%doc Misc/README Misc/cheatsheet Misc/Porting
362%doc LICENSE Misc/ACKS Misc/HISTORY Misc/NEWS
Sean Reifscheider3a078aa2010-01-16 04:35:26 +0000363%{_mandir}/man1/python%{binsuffix}.1*
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000364
Sean Reifschneider054541e2004-10-21 23:35:45 +0000365%attr(755,root,root) %dir %{__prefix}/include/python%{libvers}
366%attr(755,root,root) %dir %{__prefix}/%{libdirname}/python%{libvers}/
Sean Reifscheider3a078aa2010-01-16 04:35:26 +0000367%if %{include_sharedlib}
368%{__prefix}/%{libdirname}/libpython*
369%endif
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000370
371%files devel
372%defattr(-,root,root)
373%{__prefix}/include/python%{libvers}/*.h
Sean Reifschneider054541e2004-10-21 23:35:45 +0000374%{__prefix}/%{libdirname}/python%{libvers}/config
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000375
376%files -f tools.files tools
377%defattr(-,root,root)
378
379%if %{include_tkinter}
380%files tkinter
381%defattr(-,root,root)
Georg Brandl6e47a332008-05-17 19:15:58 +0000382%{__prefix}/%{libdirname}/python%{libvers}/tkinter
Sean Reifschneider054541e2004-10-21 23:35:45 +0000383%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload/_tkinter.so*
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000384%endif
385
Martin v. Löwis52da4492003-10-19 18:34:52 +0000386%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000387%files docs
388%defattr(-,root,root)
Sean Reifschneider054541e2004-10-21 23:35:45 +0000389%{config_htmldir}/*
Martin v. Löwis52da4492003-10-19 18:34:52 +0000390%endif