source: python/vendor/Python-2.6.5/Misc/RPM/python-2.6.spec

Last change on this file was 2, checked in by Yuri Dario, 15 years ago

Initial import for vendor code.

  • Property svn:eol-style set to native
File size: 13.3 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.6
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# 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
33# Location of the HTML directory.
34%define config_htmldir /var/www/html/python
35
36#################################
37# End of user-modifiable configs
38#################################
39
40%define name python
41#--start constants--
42%define version 2.6.5
43%define libver 2.6
44#--end constants--
45%define release 1pydotorg
46%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)
53%define libdirname %(( uname -m | egrep -q '_64$' && [ -d /usr/lib64 ] && echo lib64 ) || echo lib)
54%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)
56
57# detect if documentation is available
58%define include_docs %(if [ -f "%{_sourcedir}/html-%{version}.tar.bz2" ]; then echo 1; else echo 0; fi)
59
60Summary: An interpreted, interactive, object-oriented programming language.
61Name: %{name}%{binsuffix}
62Version: %{version}
63Release: %{release}
64License: Modified CNRI Open Source License
65Group: Development/Languages
66Source: Python-%{version}.tar.bz2
67%if %{include_docs}
68Source1: html-%{version}.tar.bz2
69%endif
70BuildRoot: %{_tmppath}/%{name}-%{version}-root
71BuildPrereq: expat-devel
72BuildPrereq: db4-devel
73BuildPrereq: gdbm-devel
74BuildPrereq: sqlite-devel
75Prefix: %{__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
133%if %{include_docs}
134%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.
141%endif
142
143%changelog
144* 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
147* 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
156* 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
160* Sat Mar 27 2004 Sean Reifschneider <jafo-rpms@tummy.com> [2.3.2-3pydotorg]
161- Being more agressive about finding the paths to fix for
162 #!/usr/local/bin/python.
163
164* 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
169* 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
175* Mon Feb 24 2003 Sean Reifschneider <jafo-rpms@tummy.com> [2.3b1-1pydotorg]
176- Updating to 2.3b1 release.
177
178* 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}
228
229########
230# BUILD
231########
232%build
233echo "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}
241make
242
243##########
244# INSTALL
245##########
246%install
247# set the install path
248echo '[install_scripts]' >setup.cfg
249echo 'install_dir='"${RPM_BUILD_ROOT}%{__prefix}/bin" >>setup.cfg
250
251[ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
252mkdir -p $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload
253make 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
261 sed 's|#!.*|#!%{__prefix}/bin/env python'%{binsuffix}'|' \
262 pydoc.old >pydoc
263 chmod 755 pydoc
264 rm -f pydoc.old
265 )
266fi
267
268# add the binsuffix
269if [ ! -z "%{binsuffix}" ]
270then
271 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 )
275fi
276
277########
278# Tools
279echo '#!%{__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}
284chmod 755 $RPM_BUILD_ROOT%{__prefix}/bin/idle%{binsuffix}
285cp -a Tools $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}
286
287# MAKE FILE LISTS
288rm -f mainpkg.files
289find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers} -type f |
290 sed "s|^${RPM_BUILD_ROOT}|/|" |
291 grep -v -e '/python%{libvers}/config$' -e '_tkinter.so$' >mainpkg.files
292find "$RPM_BUILD_ROOT""%{__prefix}"/bin -type f -o -type l |
293 sed "s|^${RPM_BUILD_ROOT}|/|" |
294 grep -v -e '/bin/2to3%{binsuffix}$' |
295 grep -v -e '/bin/pydoc%{binsuffix}$' |
296 grep -v -e '/bin/smtpd.py%{binsuffix}$' |
297 grep -v -e '/bin/idle%{binsuffix}$' >>mainpkg.files
298
299rm -f tools.files
300find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/idlelib \
301 "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/Tools -type f |
302 sed "s|^${RPM_BUILD_ROOT}|/|" >tools.files
303echo "%{__prefix}"/bin/2to3%{binsuffix} >>tools.files
304echo "%{__prefix}"/bin/pydoc%{binsuffix} >>tools.files
305echo "%{__prefix}"/bin/smtpd.py%{binsuffix} >>tools.files
306echo "%{__prefix}"/bin/idle%{binsuffix} >>tools.files
307
308######
309# Docs
310%if %{include_docs}
311mkdir -p "$RPM_BUILD_ROOT"%{config_htmldir}
312(
313 cd "$RPM_BUILD_ROOT"%{config_htmldir}
314 bunzip2 < %{SOURCE1} | tar x
315)
316%endif
317
318# fix the #! line in installed files
319find "$RPM_BUILD_ROOT" -type f -print0 |
320 xargs -0 grep -l /usr/local/bin/python | while read file
321do
322 FIXFILE="$file"
323 sed 's|^#!.*python|#!%{__prefix}/bin/env python'"%{binsuffix}"'|' \
324 "$FIXFILE" >/tmp/fix-python-path.$$
325 cat /tmp/fix-python-path.$$ >"$FIXFILE"
326 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
349########
350# CLEAN
351########
352%clean
353[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
354rm -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
363%{_mandir}/man1/python%{binsuffix}.1*
364
365%attr(755,root,root) %dir %{__prefix}/include/python%{libvers}
366%attr(755,root,root) %dir %{__prefix}/%{libdirname}/python%{libvers}/
367%if %{include_sharedlib}
368%{__prefix}/%{libdirname}/libpython*
369%endif
370
371%files devel
372%defattr(-,root,root)
373%{__prefix}/include/python%{libvers}/*.h
374%{__prefix}/%{libdirname}/python%{libvers}/config
375
376%files -f tools.files tools
377%defattr(-,root,root)
378
379%if %{include_tkinter}
380%files tkinter
381%defattr(-,root,root)
382%{__prefix}/%{libdirname}/python%{libvers}/lib-tk
383%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload/_tkinter.so*
384%endif
385
386%if %{include_docs}
387%files docs
388%defattr(-,root,root)
389%{config_htmldir}/*
390%endif
Note: See TracBrowser for help on using the repository browser.