blob: b1af55c81718ac5eaf045baf3fb25fd7478766e1 [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 Brandl08a90122012-09-29 09:34:13 +020042%define version 3.4.0a0
43%define libvers 3.4
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
Jesus Ceaf1af7052012-10-05 02:48:46 +020086brands of UNIX, on PCs under Windows, MS-DOS, and on the Mac.
Guido van Rossum2ef777f2003-02-24 01:09:53 +000087
88%package devel
89Summary: The libraries and header files needed for Python extension development.
90Prereq: python%{binsuffix} = %{PACKAGE_VERSION}
91Group: Development/Libraries
92
93%description devel
94The Python programming language's interpreter can be extended with
95dynamically loaded extensions and can be embedded in other programs.
96This package contains the header files and libraries needed to do
97these types of tasks.
98
99Install python-devel if you want to develop Python extensions. The
100python package will also need to be installed. You'll probably also
101want to install the python-docs package, which contains Python
102documentation.
103
104%if %{include_tkinter}
105%package tkinter
106Summary: A graphical user interface for the Python scripting language.
107Group: Development/Languages
108Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release}
109
110%description tkinter
111The Tkinter (Tk interface) program is an graphical user interface for
112the Python scripting language.
113
114You should install the tkinter package if you'd like to use a graphical
115user interface for Python programming.
116%endif
117
118%package tools
119Summary: A collection of development tools included with Python.
120Group: Development/Tools
121Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release}
122
123%description tools
124The Python package includes several development tools that are used
125to build python programs. This package contains a selection of those
126tools, including the IDLE Python IDE.
127
128Install python-tools if you want to use these tools to develop
129Python programs. You will also need to install the python and
130tkinter packages.
131
Martin v. Löwis52da4492003-10-19 18:34:52 +0000132%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000133%package docs
134Summary: Python-related documentation.
135Group: Development/Documentation
136
137%description docs
138Documentation relating to the Python programming language in HTML and info
139formats.
Martin v. Löwis52da4492003-10-19 18:34:52 +0000140%endif
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000141
142%changelog
Sean Reifschneider7caafe72004-12-21 02:22:29 +0000143* Mon Dec 20 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.4-2pydotorg]
144- Changing the idle wrapper so that it passes arguments to idle.
145
Sean Reifschneider054541e2004-10-21 23:35:45 +0000146* Tue Oct 19 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.4b1-1pydotorg]
147- Updating to 2.4.
148
149* Thu Jul 22 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.4-3pydotorg]
150- Paul Tiemann fixes for %{prefix}.
151- Adding permission changes for directory as suggested by reimeika.ca
152- Adding code to detect when it should be using lib64.
153- Adding a define for the location of /var/www/html for docs.
154
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000155* Thu May 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.4-2pydotorg]
156- Including changes from Ian Holsman to build under Red Hat 7.3.
157- Fixing some problems with the /usr/local path change.
158
Skip Montanarobeddfcb2004-05-17 13:17:38 +0000159* Sat Mar 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-3pydotorg]
Martin v. Löwisfb66cd22004-03-31 18:59:04 +0000160- Being more agressive about finding the paths to fix for
161 #!/usr/local/bin/python.
162
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000163* Sat Feb 07 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.3-2pydotorg]
164- Adding code to remove "#!/usr/local/bin/python" from particular files and
165 causing the RPM build to terminate if there are any unexpected files
166 which have that line in them.
167
Martin v. Löwis52da4492003-10-19 18:34:52 +0000168* Mon Oct 13 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-1pydotorg]
169- Adding code to detect wether documentation is available to build.
170
171* Fri Sep 19 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.1-1pydotorg]
172- Updating to the 2.3.1 release.
173
Guido van Rossum0f698332003-02-24 17:55:37 +0000174* Mon Feb 24 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3b1-1pydotorg]
175- Updating to 2.3b1 release.
176
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000177* Mon Feb 17 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3a1-1]
178- Updating to 2.3 release.
179
180* Sun Dec 23 2001 Sean Reifschneider <jafo-rpms@tummy.com>
181[Release 2.2-2]
182- Added -docs package.
183- Added "auto" config_tkinter setting which only enables tk if
184 /usr/bin/wish exists.
185
186* Sat Dec 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
187[Release 2.2-1]
188- Updated to 2.2.
189- Changed the extension to "2" from "2.2".
190
191* Tue Nov 18 2001 Sean Reifschneider <jafo-rpms@tummy.com>
192[Release 2.2c1-1]
193- Updated to 2.2c1.
194
195* Thu Nov 1 2001 Sean Reifschneider <jafo-rpms@tummy.com>
196[Release 2.2b1-3]
197- Changed the way the sed for fixing the #! in pydoc works.
198
199* Wed Oct 24 2001 Sean Reifschneider <jafo-rpms@tummy.com>
200[Release 2.2b1-2]
201- Fixed missing "email" package, thanks to anonymous report on sourceforge.
202- Fixed missing "compiler" package.
203
204* Mon Oct 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
205[Release 2.2b1-1]
206- Updated to 2.2b1.
207
208* Mon Oct 9 2001 Sean Reifschneider <jafo-rpms@tummy.com>
209[Release 2.2a4-4]
210- otto@balinor.mat.unimi.it mentioned that the license file is missing.
211
212* Sun Sep 30 2001 Sean Reifschneider <jafo-rpms@tummy.com>
213[Release 2.2a4-3]
214- Ignacio Vazquez-Abrams pointed out that I had a spruious double-quote in
215 the spec files. Thanks.
216
217* Wed Jul 25 2001 Sean Reifschneider <jafo-rpms@tummy.com>
218[Release 2.2a1-1]
219- Updated to 2.2a1 release.
220- Changed idle and pydoc to use binsuffix macro
221
222#######
223# PREP
224#######
225%prep
226%setup -n Python-%{version}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000227
228########
229# BUILD
230########
231%build
Sean Reifscheider3a078aa2010-01-16 04:35:26 +0000232echo "Setting for ipv6: %{ipv6}"
233echo "Setting for pymalloc: %{pymalloc}"
234echo "Setting for binsuffix: %{binsuffix}"
235echo "Setting for include_tkinter: %{include_tkinter}"
236echo "Setting for libdirname: %{libdirname}"
237echo "Setting for sharedlib: %{sharedlib}"
238echo "Setting for include_sharedlib: %{include_sharedlib}"
239./configure --enable-unicode=ucs4 %{sharedlib} %{ipv6} %{pymalloc} --prefix=%{__prefix}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000240make
241
242##########
243# INSTALL
244##########
245%install
246# set the install path
247echo '[install_scripts]' >setup.cfg
Sean Reifschneider054541e2004-10-21 23:35:45 +0000248echo 'install_dir='"${RPM_BUILD_ROOT}%{__prefix}/bin" >>setup.cfg
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000249
250[ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
Sean Reifschneider054541e2004-10-21 23:35:45 +0000251mkdir -p $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000252make prefix=$RPM_BUILD_ROOT%{__prefix} install
253
254# REPLACE PATH IN PYDOC
255if [ ! -z "%{binsuffix}" ]
256then
257 (
258 cd $RPM_BUILD_ROOT%{__prefix}/bin
259 mv pydoc pydoc.old
Sean Reifschneider054541e2004-10-21 23:35:45 +0000260 sed 's|#!.*|#!%{__prefix}/bin/env python'%{binsuffix}'|' \
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000261 pydoc.old >pydoc
262 chmod 755 pydoc
263 rm -f pydoc.old
264 )
265fi
266
267# add the binsuffix
268if [ ! -z "%{binsuffix}" ]
269then
Sean Reifscheider3a078aa2010-01-16 04:35:26 +0000270 rm -f $RPM_BUILD_ROOT%{__prefix}/bin/python[0-9a-zA-Z]*
271 ( cd $RPM_BUILD_ROOT%{__prefix}/bin;
272 for file in *; do mv "$file" "$file"%{binsuffix}; done )
273 ( cd $RPM_BUILD_ROOT%{_mandir}/man1; mv python.1 python%{binsuffix}.1 )
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000274fi
275
276########
277# Tools
Sean Reifschneider7caafe72004-12-21 02:22:29 +0000278echo '#!%{__prefix}/bin/env python%{binsuffix}' >${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
279echo 'import os, sys' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
280echo '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}
281echo 'print "Failed to exec Idle"' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
282echo 'sys.exit(1)' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
Sean Reifschneider054541e2004-10-21 23:35:45 +0000283chmod 755 $RPM_BUILD_ROOT%{__prefix}/bin/idle%{binsuffix}
284cp -a Tools $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000285
286# MAKE FILE LISTS
287rm -f mainpkg.files
Sean Reifscheider3a078aa2010-01-16 04:35:26 +0000288find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers} -type f |
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000289 sed "s|^${RPM_BUILD_ROOT}|/|" |
Sean Reifscheider3a078aa2010-01-16 04:35:26 +0000290 grep -v -e '/python%{libvers}/config$' -e '_tkinter.so$' >mainpkg.files
291find "$RPM_BUILD_ROOT""%{__prefix}"/bin -type f -o -type l |
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000292 sed "s|^${RPM_BUILD_ROOT}|/|" |
Sean Reifscheider3a078aa2010-01-16 04:35:26 +0000293 grep -v -e '/bin/2to3%{binsuffix}$' |
294 grep -v -e '/bin/pydoc%{binsuffix}$' |
295 grep -v -e '/bin/smtpd.py%{binsuffix}$' |
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000296 grep -v -e '/bin/idle%{binsuffix}$' >>mainpkg.files
297
298rm -f tools.files
Sean Reifschneider054541e2004-10-21 23:35:45 +0000299find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/idlelib \
300 "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/Tools -type f |
Martin v. Löwis52da4492003-10-19 18:34:52 +0000301 sed "s|^${RPM_BUILD_ROOT}|/|" >tools.files
Sean Reifscheider3a078aa2010-01-16 04:35:26 +0000302echo "%{__prefix}"/bin/2to3%{binsuffix} >>tools.files
303echo "%{__prefix}"/bin/pydoc%{binsuffix} >>tools.files
304echo "%{__prefix}"/bin/smtpd.py%{binsuffix} >>tools.files
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000305echo "%{__prefix}"/bin/idle%{binsuffix} >>tools.files
306
307######
308# Docs
Martin v. Löwis52da4492003-10-19 18:34:52 +0000309%if %{include_docs}
Sean Reifschneider054541e2004-10-21 23:35:45 +0000310mkdir -p "$RPM_BUILD_ROOT"%{config_htmldir}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000311(
Sean Reifschneider054541e2004-10-21 23:35:45 +0000312 cd "$RPM_BUILD_ROOT"%{config_htmldir}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000313 bunzip2 < %{SOURCE1} | tar x
314)
Martin v. Löwis52da4492003-10-19 18:34:52 +0000315%endif
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000316
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000317# fix the #! line in installed files
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000318find "$RPM_BUILD_ROOT" -type f -print0 |
319 xargs -0 grep -l /usr/local/bin/python | while read file
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000320do
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000321 FIXFILE="$file"
Sean Reifschneider054541e2004-10-21 23:35:45 +0000322 sed 's|^#!.*python|#!%{__prefix}/bin/env python'"%{binsuffix}"'|' \
Martin v. Löwis173ecb62004-05-31 19:40:57 +0000323 "$FIXFILE" >/tmp/fix-python-path.$$
324 cat /tmp/fix-python-path.$$ >"$FIXFILE"
Martin v. Löwisd3c810e2004-02-15 21:27:03 +0000325 rm -f /tmp/fix-python-path.$$
326done
327
328# check to see if there are any straggling #! lines
329find "$RPM_BUILD_ROOT" -type f | xargs egrep -n '^#! */usr/local/bin/python' \
330 | grep ':1:#!' >/tmp/python-rpm-files.$$ || true
331if [ -s /tmp/python-rpm-files.$$ ]
332then
333 echo '*****************************************************'
334 cat /tmp/python-rpm-files.$$
335 cat <<@EOF
336 *****************************************************
337 There are still files referencing /usr/local/bin/python in the
338 install directory. They are listed above. Please fix the .spec
339 file and try again. If you are an end-user, you probably want
340 to report this to jafo-rpms@tummy.com as well.
341 *****************************************************
342@EOF
343 rm -f /tmp/python-rpm-files.$$
344 exit 1
345fi
346rm -f /tmp/python-rpm-files.$$
347
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000348########
349# CLEAN
350########
351%clean
Martin v. Löwis52da4492003-10-19 18:34:52 +0000352[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000353rm -f mainpkg.files tools.files
354
355########
356# FILES
357########
358%files -f mainpkg.files
359%defattr(-,root,root)
360%doc Misc/README Misc/cheatsheet Misc/Porting
361%doc LICENSE Misc/ACKS Misc/HISTORY Misc/NEWS
Sean Reifscheider3a078aa2010-01-16 04:35:26 +0000362%{_mandir}/man1/python%{binsuffix}.1*
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000363
Sean Reifschneider054541e2004-10-21 23:35:45 +0000364%attr(755,root,root) %dir %{__prefix}/include/python%{libvers}
365%attr(755,root,root) %dir %{__prefix}/%{libdirname}/python%{libvers}/
Sean Reifscheider3a078aa2010-01-16 04:35:26 +0000366%if %{include_sharedlib}
367%{__prefix}/%{libdirname}/libpython*
368%endif
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000369
370%files devel
371%defattr(-,root,root)
372%{__prefix}/include/python%{libvers}/*.h
Sean Reifschneider054541e2004-10-21 23:35:45 +0000373%{__prefix}/%{libdirname}/python%{libvers}/config
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000374
375%files -f tools.files tools
376%defattr(-,root,root)
377
378%if %{include_tkinter}
379%files tkinter
380%defattr(-,root,root)
Georg Brandl6e47a332008-05-17 19:15:58 +0000381%{__prefix}/%{libdirname}/python%{libvers}/tkinter
Sean Reifschneider054541e2004-10-21 23:35:45 +0000382%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload/_tkinter.so*
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000383%endif
384
Martin v. Löwis52da4492003-10-19 18:34:52 +0000385%if %{include_docs}
Guido van Rossum2ef777f2003-02-24 01:09:53 +0000386%files docs
387%defattr(-,root,root)
Sean Reifschneider054541e2004-10-21 23:35:45 +0000388%{config_htmldir}/*
Martin v. Löwis52da4492003-10-19 18:34:52 +0000389%endif