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 |
|
---|
51 | Summary: An interpreted, interactive, object-oriented programming language.
|
---|
52 | Name: %{name}%{binsuffix}
|
---|
53 | Version: %{version}
|
---|
54 | Release: %{release}
|
---|
55 | License: Python Software Foundation
|
---|
56 | Group: Development/Languages
|
---|
57 | Source: Python-%{version}.tar.bz2
|
---|
58 | %if %{include_docs}
|
---|
59 | Source1: html-%{version}.tar.bz2
|
---|
60 | %endif
|
---|
61 | BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
---|
62 | BuildPrereq: expat-devel
|
---|
63 | BuildPrereq: db4-devel
|
---|
64 | BuildPrereq: gdbm-devel
|
---|
65 | BuildPrereq: sqlite-devel
|
---|
66 | Prefix: %{__prefix}
|
---|
67 | Packager: Sean Reifschneider <jafo-rpms@tummy.com>
|
---|
68 |
|
---|
69 | %description
|
---|
70 | Python is an interpreted, interactive, object-oriented programming
|
---|
71 | language. It incorporates modules, exceptions, dynamic typing, very high
|
---|
72 | level dynamic data types, and classes. Python combines remarkable power
|
---|
73 | with very clear syntax. It has interfaces to many system calls and
|
---|
74 | libraries, as well as to various window systems, and is extensible in C or
|
---|
75 | C++. It is also usable as an extension language for applications that need
|
---|
76 | a programmable interface. Finally, Python is portable: it runs on many
|
---|
77 | brands of UNIX, on PCs under Windows, MS-DOS, and OS/2, and on the
|
---|
78 | Mac.
|
---|
79 |
|
---|
80 | %package devel
|
---|
81 | Summary: The libraries and header files needed for Python extension development.
|
---|
82 | Prereq: python%{binsuffix} = %{PACKAGE_VERSION}
|
---|
83 | Group: Development/Libraries
|
---|
84 |
|
---|
85 | %description devel
|
---|
86 | The Python programming language's interpreter can be extended with
|
---|
87 | dynamically loaded extensions and can be embedded in other programs.
|
---|
88 | This package contains the header files and libraries needed to do
|
---|
89 | these types of tasks.
|
---|
90 |
|
---|
91 | Install python-devel if you want to develop Python extensions. The
|
---|
92 | python package will also need to be installed. You'll probably also
|
---|
93 | want to install the python-docs package, which contains Python
|
---|
94 | documentation.
|
---|
95 |
|
---|
96 | %if %{include_tkinter}
|
---|
97 | %package tkinter
|
---|
98 | Summary: A graphical user interface for the Python scripting language.
|
---|
99 | Group: Development/Languages
|
---|
100 | Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release}
|
---|
101 |
|
---|
102 | %description tkinter
|
---|
103 | The Tkinter (Tk interface) program is an graphical user interface for
|
---|
104 | the Python scripting language.
|
---|
105 |
|
---|
106 | You should install the tkinter package if you'd like to use a graphical
|
---|
107 | user interface for Python programming.
|
---|
108 | %endif
|
---|
109 |
|
---|
110 | %package tools
|
---|
111 | Summary: A collection of development tools included with Python.
|
---|
112 | Group: Development/Tools
|
---|
113 | Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release}
|
---|
114 |
|
---|
115 | %description tools
|
---|
116 | The Python package includes several development tools that are used
|
---|
117 | to build python programs. This package contains a selection of those
|
---|
118 | tools, including the IDLE Python IDE.
|
---|
119 |
|
---|
120 | Install python-tools if you want to use these tools to develop
|
---|
121 | Python programs. You will also need to install the python and
|
---|
122 | tkinter packages.
|
---|
123 |
|
---|
124 | %if %{include_docs}
|
---|
125 | %package docs
|
---|
126 | Summary: Python-related documentation.
|
---|
127 | Group: Development/Documentation
|
---|
128 |
|
---|
129 | %description docs
|
---|
130 | Documentation relating to the Python programming language in HTML and info
|
---|
131 | formats.
|
---|
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}
|
---|
225 | make
|
---|
226 |
|
---|
227 | ##########
|
---|
228 | # INSTALL
|
---|
229 | ##########
|
---|
230 | %install
|
---|
231 | # set the install path
|
---|
232 | echo '[install_scripts]' >setup.cfg
|
---|
233 | echo 'install_dir='"${RPM_BUILD_ROOT}%{__prefix}/bin" >>setup.cfg
|
---|
234 |
|
---|
235 | [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
|
---|
236 | mkdir -p $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload
|
---|
237 | make prefix=$RPM_BUILD_ROOT%{__prefix} install
|
---|
238 |
|
---|
239 | # REPLACE PATH IN PYDOC
|
---|
240 | if [ ! -z "%{binsuffix}" ]
|
---|
241 | then
|
---|
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
|
---|
252 | fi
|
---|
253 |
|
---|
254 | # add the binsuffix
|
---|
255 | if [ ! -z "%{binsuffix}" ]
|
---|
256 | then
|
---|
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
|
---|
264 | fi
|
---|
265 |
|
---|
266 | ########
|
---|
267 | # Tools
|
---|
268 | echo '#!%{__prefix}/bin/env python%{binsuffix}' >${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
|
---|
269 | echo 'import os, sys' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
|
---|
270 | echo '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}
|
---|
271 | echo 'print "Failed to exec Idle"' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
|
---|
272 | echo 'sys.exit(1)' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix}
|
---|
273 | chmod 755 $RPM_BUILD_ROOT%{__prefix}/bin/idle%{binsuffix}
|
---|
274 | cp -a Tools $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}
|
---|
275 |
|
---|
276 | # MAKE FILE LISTS
|
---|
277 | rm -f mainpkg.files
|
---|
278 | find "$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
|
---|
281 | find "$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 |
|
---|
286 | rm -f tools.files
|
---|
287 | find "$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
|
---|
291 | echo "%{__prefix}"/bin/idle%{binsuffix} >>tools.files
|
---|
292 | grep '\.py$' tools.files | sed 's/$/c/' | grep -v /idlelib/ >tools.files.tmp
|
---|
293 | grep '\.py$' tools.files | sed 's/$/o/' | grep -v /idlelib/ >>tools.files.tmp
|
---|
294 | cat tools.files.tmp >>tools.files
|
---|
295 | rm tools.files.tmp
|
---|
296 |
|
---|
297 | ######
|
---|
298 | # Docs
|
---|
299 | %if %{include_docs}
|
---|
300 | mkdir -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
|
---|
308 | find "$RPM_BUILD_ROOT" -type f -print0 |
|
---|
309 | xargs -0 grep -l /usr/local/bin/python | while read file
|
---|
310 | do
|
---|
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.$$
|
---|
316 | done
|
---|
317 |
|
---|
318 | # check to see if there are any straggling #! lines
|
---|
319 | find "$RPM_BUILD_ROOT" -type f | xargs egrep -n '^#! */usr/local/bin/python' \
|
---|
320 | | grep ':1:#!' >/tmp/python-rpm-files.$$ || true
|
---|
321 | if [ -s /tmp/python-rpm-files.$$ ]
|
---|
322 | then
|
---|
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
|
---|
335 | fi
|
---|
336 | rm -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
|
---|
343 | rm -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
|
---|