source: vendor/python/2.5/Misc/RPM/python-2.5.spec

Last change on this file was 3225, checked in by bird, 18 years ago

Python 2.5

File size: 13.7 KB
Line 
1##########################
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
9%define config_binsuffix 2.5
10
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
28# Location of the HTML directory.
29%define config_htmldir /var/www/html/python
30
31#################################
32# End of user-modifiable configs
33#################################
34
35%define name python
36%define version 2.5
37%define libvers 2.5
38%define release 1pydotorg
39%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)
46%define libdirname %(( uname -m | egrep -q '_64$' && [ -d /usr/lib64 ] && echo lib64 ) || echo lib)
47
48# detect if documentation is available
49%define include_docs %(if [ -f "%{_sourcedir}/html-%{version}.tar.bz2" ]; then echo 1; else echo 0; fi)
50
51Summary: An interpreted, interactive, object-oriented programming language.
52Name: %{name}%{binsuffix}
53Version: %{version}
54Release: %{release}
55License: Python Software Foundation
56Group: Development/Languages
57Source: Python-%{version}.tar.bz2
58%if %{include_docs}
59Source1: html-%{version}.tar.bz2
60%endif
61BuildRoot: %{_tmppath}/%{name}-%{version}-root
62BuildPrereq: expat-devel
63BuildPrereq: db4-devel
64BuildPrereq: gdbm-devel
65BuildPrereq: sqlite-devel
66Prefix: %{__prefix}
67Packager: Sean Reifschneider <jafo-rpms@tummy.com>
68
69%description
70Python is an interpreted, interactive, object-oriented programming
71language. It incorporates modules, exceptions, dynamic typing, very high
72level dynamic data types, and classes. Python combines remarkable power
73with very clear syntax. It has interfaces to many system calls and
74libraries, as well as to various window systems, and is extensible in C or
75C++. It is also usable as an extension language for applications that need
76a programmable interface. Finally, Python is portable: it runs on many
77brands of UNIX, on PCs under Windows, MS-DOS, and OS/2, and on the
78Mac.
79
80%package devel
81Summary: The libraries and header files needed for Python extension development.
82Prereq: python%{binsuffix} = %{PACKAGE_VERSION}
83Group: Development/Libraries
84
85%description devel
86The Python programming language's interpreter can be extended with
87dynamically loaded extensions and can be embedded in other programs.
88This package contains the header files and libraries needed to do
89these types of tasks.
90
91Install python-devel if you want to develop Python extensions. The
92python package will also need to be installed. You'll probably also
93want to install the python-docs package, which contains Python
94documentation.
95
96%if %{include_tkinter}
97%package tkinter
98Summary: A graphical user interface for the Python scripting language.
99Group: Development/Languages
100Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release}
101
102%description tkinter
103The Tkinter (Tk interface) program is an graphical user interface for
104the Python scripting language.
105
106You should install the tkinter package if you'd like to use a graphical
107user interface for Python programming.
108%endif
109
110%package tools
111Summary: A collection of development tools included with Python.
112Group: Development/Tools
113Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release}
114
115%description tools
116The Python package includes several development tools that are used
117to build python programs. This package contains a selection of those
118tools, including the IDLE Python IDE.
119
120Install python-tools if you want to use these tools to develop
121Python programs. You will also need to install the python and
122tkinter packages.
123
124%if %{include_docs}
125%package docs
126Summary: Python-related documentation.
127Group: Development/Documentation
128
129%description docs
130Documentation relating to the Python programming language in HTML and info
131formats.
132%endif
133
134%changelog
135* Mon Dec 20 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.4-2pydotorg]
136- Changing the idle wrapper so that it passes arguments to idle.
137
138* Tue Oct 19 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.4b1-1pydotorg]
139- Updating to 2.4.
140
141* Thu Jul 22 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.4-3pydotorg]
142- Paul Tiemann fixes for %{prefix}.
143- Adding permission changes for directory as suggested by reimeika.ca
144- Adding code to detect when it should be using lib64.
145- Adding a define for the location of /var/www/html for docs.
146
147* Thu May 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.4-2pydotorg]
148- Including changes from Ian Holsman to build under Red Hat 7.3.
149- Fixing some problems with the /usr/local path change.
150
151* Sat Mar 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-3pydotorg]
152- Being more agressive about finding the paths to fix for
153 #!/usr/local/bin/python.
154
155* Sat Feb 07 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.3-2pydotorg]
156- Adding code to remove "#!/usr/local/bin/python" from particular files and
157 causing the RPM build to terminate if there are any unexpected files
158 which have that line in them.
159
160* Mon Oct 13 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-1pydotorg]
161- Adding code to detect wether documentation is available to build.
162
163* Fri Sep 19 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.1-1pydotorg]
164- Updating to the 2.3.1 release.
165
166* Mon Feb 24 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3b1-1pydotorg]
167- Updating to 2.3b1 release.
168
169* Mon Feb 17 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3a1-1]
170- Updating to 2.3 release.
171
172* Sun Dec 23 2001 Sean Reifschneider <jafo-rpms@tummy.com>
173[Release 2.2-2]
174- Added -docs package.
175- Added "auto" config_tkinter setting which only enables tk if
176 /usr/bin/wish exists.
177
178* Sat Dec 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
179[Release 2.2-1]
180- Updated to 2.2.
181- Changed the extension to "2" from "2.2".
182
183* Tue Nov 18 2001 Sean Reifschneider <jafo-rpms@tummy.com>
184[Release 2.2c1-1]
185- Updated to 2.2c1.
186
187* Thu Nov 1 2001 Sean Reifschneider <jafo-rpms@tummy.com>
188[Release 2.2b1-3]
189- Changed the way the sed for fixing the #! in pydoc works.
190
191* Wed Oct 24 2001 Sean Reifschneider <jafo-rpms@tummy.com>
192[Release 2.2b1-2]
193- Fixed missing "email" package, thanks to anonymous report on sourceforge.
194- Fixed missing "compiler" package.
195
196* Mon Oct 22 2001 Sean Reifschneider <jafo-rpms@tummy.com>
197[Release 2.2b1-1]
198- Updated to 2.2b1.
199
200* Mon Oct 9 2001 Sean Reifschneider <jafo-rpms@tummy.com>
201[Release 2.2a4-4]
202- otto@balinor.mat.unimi.it mentioned that the license file is missing.
203
204* Sun Sep 30 2001 Sean Reifschneider <jafo-rpms@tummy.com>
205[Release 2.2a4-3]
206- Ignacio Vazquez-Abrams pointed out that I had a spruious double-quote in
207 the spec files. Thanks.
208
209* Wed Jul 25 2001 Sean Reifschneider <jafo-rpms@tummy.com>
210[Release 2.2a1-1]
211- Updated to 2.2a1 release.
212- Changed idle and pydoc to use binsuffix macro
213
214#######
215# PREP
216#######
217%prep
218%setup -n Python-%{version}
219
220########
221# BUILD
222########
223%build
224./configure --enable-unicode=ucs4 %{ipv6} %{pymalloc} --prefix=%{__prefix}
225make
226
227##########
228# INSTALL
229##########
230%install
231# set the install path
232echo '[install_scripts]' >setup.cfg
233echo 'install_dir='"${RPM_BUILD_ROOT}%{__prefix}/bin" >>setup.cfg
234
235[ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
236mkdir -p $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload
237make prefix=$RPM_BUILD_ROOT%{__prefix} install
238
239# REPLACE PATH IN PYDOC
240if [ ! -z "%{binsuffix}" ]
241then
242 for file in pydoc python-config; do
243 (
244 cd $RPM_BUILD_ROOT%{__prefix}/bin
245 mv "$file" "$file".old
246 sed 's|#!.*|#!%{__prefix}/bin/env python'%{binsuffix}'|' \
247 "$file".old >"$file"
248 chmod 755 "$file"
249 rm -f "$file".old
250 )
251 done
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 smtpd.py python-smtpd )
261 for file in pydoc idle python-config python-smtpd; do
262 ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f "$file" "$file""%{binsuffix}" )
263 done
264fi
265
266########
267# Tools
268echo '#!%{__prefix}/bin/env python%{binsuffix}' >${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
269echo 'import os, sys' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
270echo '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}
271echo 'print "Failed to exec Idle"' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
272echo 'sys.exit(1)' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
273chmod 755 $RPM_BUILD_ROOT%{__prefix}/bin/idle%{binsuffix}
274cp -a Tools $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}
275
276# MAKE FILE LISTS
277rm -f mainpkg.files
278find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/lib-dynload -type f |
279 sed "s|^${RPM_BUILD_ROOT}|/|" |
280 grep -v -e '_tkinter.so$' >mainpkg.files
281find "$RPM_BUILD_ROOT""%{__prefix}"/bin -type f |
282 sed "s|^${RPM_BUILD_ROOT}|/|" |
283 grep -v -e '/bin/setup-config%{binsuffix}$' |
284 grep -v -e '/bin/idle%{binsuffix}$' >>mainpkg.files
285
286rm -f tools.files
287find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/idlelib \
288 "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/Tools -type f |
289 grep -v -e '\.pyc$' -e '\.pyo$' |
290 sed "s|^${RPM_BUILD_ROOT}|/|" >tools.files
291echo "%{__prefix}"/bin/idle%{binsuffix} >>tools.files
292grep '\.py$' tools.files | sed 's/$/c/' | grep -v /idlelib/ >tools.files.tmp
293grep '\.py$' tools.files | sed 's/$/o/' | grep -v /idlelib/ >>tools.files.tmp
294cat tools.files.tmp >>tools.files
295rm tools.files.tmp
296
297######
298# Docs
299%if %{include_docs}
300mkdir -p "$RPM_BUILD_ROOT"%{config_htmldir}
301(
302 cd "$RPM_BUILD_ROOT"%{config_htmldir}
303 bunzip2 < %{SOURCE1} | tar x
304)
305%endif
306
307# fix the #! line in installed files
308find "$RPM_BUILD_ROOT" -type f -print0 |
309 xargs -0 grep -l /usr/local/bin/python | while read file
310do
311 FIXFILE="$file"
312 sed 's|^#!.*python|#!%{__prefix}/bin/env python'"%{binsuffix}"'|' \
313 "$FIXFILE" >/tmp/fix-python-path.$$
314 cat /tmp/fix-python-path.$$ >"$FIXFILE"
315 rm -f /tmp/fix-python-path.$$
316done
317
318# check to see if there are any straggling #! lines
319find "$RPM_BUILD_ROOT" -type f | xargs egrep -n '^#! */usr/local/bin/python' \
320 | grep ':1:#!' >/tmp/python-rpm-files.$$ || true
321if [ -s /tmp/python-rpm-files.$$ ]
322then
323 echo '*****************************************************'
324 cat /tmp/python-rpm-files.$$
325 cat <<@EOF
326 *****************************************************
327 There are still files referencing /usr/local/bin/python in the
328 install directory. They are listed above. Please fix the .spec
329 file and try again. If you are an end-user, you probably want
330 to report this to jafo-rpms@tummy.com as well.
331 *****************************************************
332@EOF
333 rm -f /tmp/python-rpm-files.$$
334 exit 1
335fi
336rm -f /tmp/python-rpm-files.$$
337
338########
339# CLEAN
340########
341%clean
342[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
343rm -f mainpkg.files tools.files
344
345########
346# FILES
347########
348%files -f mainpkg.files
349%defattr(-,root,root)
350%doc Misc/README Misc/cheatsheet Misc/Porting
351%doc LICENSE Misc/ACKS Misc/HISTORY Misc/NEWS
352%{__prefix}/man/man1/python%{binsuffix}.1*
353
354%attr(755,root,root) %dir %{__prefix}/include/python%{libvers}
355%attr(755,root,root) %dir %{__prefix}/%{libdirname}/python%{libvers}/
356%{__prefix}/%{libdirname}/python%{libvers}/*.txt
357%{__prefix}/%{libdirname}/python%{libvers}/*.py*
358%{__prefix}/%{libdirname}/python%{libvers}/pdb.doc
359%{__prefix}/%{libdirname}/python%{libvers}/curses
360%{__prefix}/%{libdirname}/python%{libvers}/distutils
361%{__prefix}/%{libdirname}/python%{libvers}/encodings
362%{__prefix}/%{libdirname}/python%{libvers}/plat-linux2
363%{__prefix}/%{libdirname}/python%{libvers}/site-packages
364%{__prefix}/%{libdirname}/python%{libvers}/test
365%{__prefix}/%{libdirname}/python%{libvers}/xml
366%{__prefix}/%{libdirname}/python%{libvers}/email
367%{__prefix}/%{libdirname}/python%{libvers}/sqlite3
368%{__prefix}/%{libdirname}/python%{libvers}/compiler
369%{__prefix}/%{libdirname}/python%{libvers}/bsddb
370%{__prefix}/%{libdirname}/python%{libvers}/hotshot
371%{__prefix}/%{libdirname}/python%{libvers}/logging
372%{__prefix}/%{libdirname}/python%{libvers}/wsgiref
373%{__prefix}/%{libdirname}/python%{libvers}/ctypes
374%{__prefix}/%{libdirname}/python%{libvers}/wsgiref.egg-info
375
376%files devel
377%defattr(-,root,root)
378%{__prefix}/include/python%{libvers}/*.h
379%{__prefix}/%{libdirname}/python%{libvers}/config
380
381%files -f tools.files tools
382%defattr(-,root,root)
383
384%if %{include_tkinter}
385%files tkinter
386%defattr(-,root,root)
387%{__prefix}/%{libdirname}/python%{libvers}/lib-tk
388%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload/_tkinter.so*
389%endif
390
391%if %{include_docs}
392%files docs
393%defattr(-,root,root)
394%{config_htmldir}/*
395%endif
Note: See TracBrowser for help on using the repository browser.