Guido van Rossum | 23105d5 | 2002-01-06 03:29:16 +0000 | [diff] [blame] | 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 |
| 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 yes |
| 21 | %define config_pymalloc no |
| 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 | ################################# |
| 29 | # End of user-modifiable configs |
| 30 | ################################# |
| 31 | |
| 32 | %define name python |
| 33 | %define version 2.2 |
| 34 | %define libvers 2.2 |
| 35 | %define release 2 |
| 36 | %define __prefix /usr |
| 37 | |
| 38 | # kludge to get around rpm <percent>define weirdness |
| 39 | %define ipv6 %(if [ "%{config_ipv6}" = yes ]; then echo --enable-ipv6; else echo --disable-ipv6; fi) |
| 40 | %define pymalloc %(if [ "%{config_pymalloc}" = yes ]; then echo --with-pymalloc; else echo --without-pymalloc; fi) |
| 41 | %define binsuffix %(if [ "%{config_binsuffix}" = none ]; then echo ; else echo "%{config_binsuffix}"; fi) |
| 42 | %define include_tkinter %(if [ \\( "%{config_tkinter}" = auto -a -f /usr/bin/wish \\) -o "%{config_tkinter}" = yes ]; then echo 1; else echo 0; fi) |
| 43 | |
| 44 | Summary: An interpreted, interactive, object-oriented programming language. |
| 45 | Name: %{name}%{binsuffix} |
| 46 | Version: %{version} |
| 47 | Release: %{release} |
| 48 | Copyright: Modified CNRI Open Source License |
| 49 | Group: Development/Languages |
| 50 | Source: Python-%{version}.tgz |
| 51 | Source1: html-%{version}.tar.bz2 |
| 52 | Source2: info-%{version}.tar.bz2 |
| 53 | Patch0: Python-2.1-pythonpath.patch |
| 54 | Patch1: Python-2.1-expat.patch |
| 55 | BuildRoot: /var/tmp/%{name}-%{version}-root |
| 56 | BuildPrereq: expat-devel |
| 57 | BuildPrereq: db1-devel |
| 58 | BuildPrereq: gdbm-devel |
| 59 | Prefix: %{__prefix} |
| 60 | Packager: Sean Reifschneider <jafo-rpms@tummy.com> |
| 61 | |
| 62 | %description |
| 63 | Python is an interpreted, interactive, object-oriented programming |
| 64 | language. It incorporates modules, exceptions, dynamic typing, very high |
| 65 | level dynamic data types, and classes. Python combines remarkable power |
| 66 | with very clear syntax. It has interfaces to many system calls and |
| 67 | libraries, as well as to various window systems, and is extensible in C or |
| 68 | C++. It is also usable as an extension language for applications that need |
| 69 | a programmable interface. Finally, Python is portable: it runs on many |
| 70 | brands of UNIX, on PCs under Windows, MS-DOS, and OS/2, and on the |
| 71 | Mac. |
| 72 | |
| 73 | %package devel |
| 74 | Summary: The libraries and header files needed for Python extension development. |
| 75 | Prereq: python%{binsuffix} = %{PACKAGE_VERSION} |
| 76 | Group: Development/Libraries |
| 77 | |
| 78 | %description devel |
| 79 | The Python programming language's interpreter can be extended with |
| 80 | dynamically loaded extensions and can be embedded in other programs. |
| 81 | This package contains the header files and libraries needed to do |
| 82 | these types of tasks. |
| 83 | |
| 84 | Install python-devel if you want to develop Python extensions. The |
| 85 | python package will also need to be installed. You'll probably also |
| 86 | want to install the python-docs package, which contains Python |
| 87 | documentation. |
| 88 | |
| 89 | %if %{include_tkinter} |
| 90 | %package tkinter |
| 91 | Summary: A graphical user interface for the Python scripting language. |
| 92 | Group: Development/Languages |
| 93 | Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release} |
| 94 | |
| 95 | %description tkinter |
| 96 | The Tkinter (Tk interface) program is an graphical user interface for |
| 97 | the Python scripting language. |
| 98 | |
| 99 | You should install the tkinter package if you'd like to use a graphical |
| 100 | user interface for Python programming. |
| 101 | %endif |
| 102 | |
| 103 | %package tools |
| 104 | Summary: A collection of development tools included with Python. |
| 105 | Group: Development/Tools |
| 106 | Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release} |
| 107 | |
| 108 | %description tools |
| 109 | The Python package includes several development tools that are used |
| 110 | to build python programs. This package contains a selection of those |
| 111 | tools, including the IDLE Python IDE. |
| 112 | |
| 113 | Install python-tools if you want to use these tools to develop |
| 114 | Python programs. You will also need to install the python and |
| 115 | tkinter packages. |
| 116 | |
| 117 | %package docs |
| 118 | Summary: Python-related documentation. |
| 119 | Group: Development/Documentation |
| 120 | |
| 121 | %description docs |
| 122 | Documentation relating to the Python programming language in HTML and info |
| 123 | formats. |
| 124 | |
| 125 | %changelog |
| 126 | * Sun Dec 23 2001 Sean Reifschneider <jafo-rpms@tummy.com> |
| 127 | [Release 2.2-2] |
| 128 | - Added -docs package. |
| 129 | - Added "auto" config_tkinter setting which only enables tk if |
| 130 | /usr/bin/wish exists. |
| 131 | |
| 132 | * Sat Dec 22 2001 Sean Reifschneider <jafo-rpms@tummy.com> |
| 133 | [Release 2.2-1] |
| 134 | - Updated to 2.2. |
| 135 | - Changed the extension to "2" from "2.2". |
| 136 | |
| 137 | * Tue Nov 18 2001 Sean Reifschneider <jafo-rpms@tummy.com> |
| 138 | [Release 2.2c1-1] |
| 139 | - Updated to 2.2c1. |
| 140 | |
| 141 | * Thu Nov 1 2001 Sean Reifschneider <jafo-rpms@tummy.com> |
| 142 | [Release 2.2b1-3] |
| 143 | - Changed the way the sed for fixing the #! in pydoc works. |
| 144 | |
| 145 | * Wed Oct 24 2001 Sean Reifschneider <jafo-rpms@tummy.com> |
| 146 | [Release 2.2b1-2] |
| 147 | - Fixed missing "email" package, thanks to anonymous report on sourceforge. |
| 148 | - Fixed missing "compiler" package. |
| 149 | |
| 150 | * Mon Oct 22 2001 Sean Reifschneider <jafo-rpms@tummy.com> |
| 151 | [Release 2.2b1-1] |
| 152 | - Updated to 2.2b1. |
| 153 | |
| 154 | * Mon Oct 9 2001 Sean Reifschneider <jafo-rpms@tummy.com> |
| 155 | [Release 2.2a4-4] |
| 156 | - otto@balinor.mat.unimi.it mentioned that the license file is missing. |
| 157 | |
| 158 | * Sun Sep 30 2001 Sean Reifschneider <jafo-rpms@tummy.com> |
| 159 | [Release 2.2a4-3] |
| 160 | - Ignacio Vazquez-Abrams pointed out that I had a spruious double-quote in |
| 161 | the spec files. Thanks. |
| 162 | |
| 163 | * Wed Jul 25 2001 Sean Reifschneider <jafo-rpms@tummy.com> |
| 164 | [Release 2.2a1-1] |
| 165 | - Updated to 2.2a1 release. |
| 166 | - Changed idle and pydoc to use binsuffix macro |
| 167 | |
| 168 | ####### |
| 169 | # PREP |
| 170 | ####### |
| 171 | %prep |
| 172 | %setup -n Python-%{version} |
| 173 | %patch0 -p1 |
| 174 | %patch1 |
| 175 | |
| 176 | ######## |
| 177 | # BUILD |
| 178 | ######## |
| 179 | %build |
| 180 | ./configure %{ipv6} %{pymalloc} --prefix=%{__prefix} |
| 181 | make |
| 182 | |
| 183 | ########## |
| 184 | # INSTALL |
| 185 | ########## |
| 186 | %install |
| 187 | # set the install path |
| 188 | echo '[install_scripts]' >setup.cfg |
| 189 | echo 'install_dir='"${RPM_BUILD_ROOT}/usr/bin" >>setup.cfg |
| 190 | |
| 191 | [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT |
| 192 | mkdir -p $RPM_BUILD_ROOT%{__prefix}/lib/python%{libvers}/lib-dynload |
| 193 | make prefix=$RPM_BUILD_ROOT%{__prefix} install |
| 194 | |
| 195 | # REPLACE PATH IN PYDOC |
| 196 | if [ ! -z "%{binsuffix}" ] |
| 197 | then |
| 198 | ( |
| 199 | cd $RPM_BUILD_ROOT%{__prefix}/bin |
| 200 | mv pydoc pydoc.old |
| 201 | sed 's|#!.*|#!/usr/bin/env python'%{binsuffix}'|' \ |
| 202 | pydoc.old >pydoc |
| 203 | chmod 755 pydoc |
| 204 | rm -f pydoc.old |
| 205 | ) |
| 206 | fi |
| 207 | |
| 208 | # add the binsuffix |
| 209 | if [ ! -z "%{binsuffix}" ] |
| 210 | then |
| 211 | ( cd $RPM_BUILD_ROOT%{__prefix}/bin; rm -f python[0-9a-zA-Z]*; |
| 212 | mv -f python python"%{binsuffix}" ) |
| 213 | ( cd $RPM_BUILD_ROOT%{__prefix}/man/man1; mv python.1 python%{binsuffix}.1 ) |
| 214 | ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f pydoc pydoc"%{binsuffix}" ) |
| 215 | fi |
| 216 | |
| 217 | ######## |
| 218 | # Tools |
| 219 | echo '#!/bin/bash' >${RPM_BUILD_ROOT}%{_bindir}/idle%{binsuffix} |
| 220 | echo 'exec %{_prefix}/bin/python%{binsuffix} /usr/lib/python%{libvers}/Tools/idle/idle.py' >>$RPM_BUILD_ROOT%{_bindir}/idle%{binsuffix} |
| 221 | chmod 755 $RPM_BUILD_ROOT%{_bindir}/idle%{binsuffix} |
| 222 | cp -a Tools $RPM_BUILD_ROOT%{_prefix}/lib/python%{libvers} |
| 223 | |
| 224 | # MAKE FILE LISTS |
| 225 | rm -f mainpkg.files |
| 226 | find "$RPM_BUILD_ROOT""%{__prefix}"/lib/python%{libvers}/lib-dynload -type f | |
| 227 | sed "s|^${RPM_BUILD_ROOT}|/|" | |
| 228 | grep -v -e '_tkinter.so$' >mainpkg.files |
| 229 | find "$RPM_BUILD_ROOT""%{__prefix}"/bin -type f | |
| 230 | sed "s|^${RPM_BUILD_ROOT}|/|" | |
| 231 | grep -v -e '/bin/idle%{binsuffix}$' >>mainpkg.files |
| 232 | |
| 233 | rm -f tools.files |
| 234 | find "$RPM_BUILD_ROOT""%{__prefix}"/lib/python%{libvers}/Tools -type f | |
| 235 | sed "s|^${RPM_BUILD_ROOT}|/|" >tools.files |
| 236 | echo "%{__prefix}"/bin/idle%{binsuffix} >>tools.files |
| 237 | |
| 238 | ###### |
| 239 | # Docs |
| 240 | mkdir -p "$RPM_BUILD_ROOT"/var/www/html/python |
| 241 | ( |
| 242 | cd "$RPM_BUILD_ROOT"/var/www/html/python |
| 243 | bunzip2 < %{SOURCE1} | tar x |
| 244 | ) |
| 245 | mkdir -p "$RPM_BUILD_ROOT"/usr/share/info |
| 246 | ( |
| 247 | cd "$RPM_BUILD_ROOT"/usr/share/info |
| 248 | bunzip2 < %{SOURCE2} | tar x |
| 249 | ) |
| 250 | |
| 251 | ######## |
| 252 | # CLEAN |
| 253 | ######## |
| 254 | %clean |
| 255 | rm -fr $RPM_BUILD_ROOT |
| 256 | rm -f mainpkg.files tools.files |
| 257 | |
| 258 | ######## |
| 259 | # FILES |
| 260 | ######## |
| 261 | %files -f mainpkg.files |
| 262 | %defattr(-,root,root) |
| 263 | %doc Misc/README Misc/HYPE Misc/cheatsheet Misc/unicode.txt Misc/Porting |
| 264 | %doc LICENSE Misc/ACKS Misc/BLURB.* Misc/HISTORY Misc/NEWS |
| 265 | %{__prefix}/man/man1/python%{binsuffix}.1.gz |
| 266 | |
| 267 | %dir %{__prefix}/include/python%{libvers} |
| 268 | %dir %{__prefix}/lib/python%{libvers}/ |
| 269 | %{__prefix}/lib/python%{libvers}/*.txt |
| 270 | %{__prefix}/lib/python%{libvers}/*.py* |
| 271 | %{__prefix}/lib/python%{libvers}/pdb.doc |
| 272 | %{__prefix}/lib/python%{libvers}/profile.doc |
| 273 | %{__prefix}/lib/python%{libvers}/curses |
| 274 | %{__prefix}/lib/python%{libvers}/distutils |
| 275 | %{__prefix}/lib/python%{libvers}/encodings |
| 276 | %dir %{__prefix}/lib/python%{libvers}/lib-old |
| 277 | %{__prefix}/lib/python%{libvers}/plat-linux2 |
| 278 | %{__prefix}/lib/python%{libvers}/site-packages |
| 279 | %{__prefix}/lib/python%{libvers}/test |
| 280 | %{__prefix}/lib/python%{libvers}/xml |
| 281 | %{__prefix}/lib/python%{libvers}/email |
| 282 | %{__prefix}/lib/python%{libvers}/compiler |
| 283 | |
| 284 | %files devel |
| 285 | %defattr(-,root,root) |
| 286 | %{__prefix}/include/python%{libvers}/*.h |
| 287 | %{__prefix}/lib/python%{libvers}/config |
| 288 | |
| 289 | %files -f tools.files tools |
| 290 | %defattr(-,root,root) |
| 291 | |
| 292 | %if %{include_tkinter} |
| 293 | %files tkinter |
| 294 | %defattr(-,root,root) |
| 295 | %{__prefix}/lib/python%{libvers}/lib-tk |
| 296 | %{__prefix}/lib/python%{libvers}/lib-dynload/_tkinter.so* |
| 297 | %endif |
| 298 | |
| 299 | %files docs |
| 300 | %defattr(-,root,root) |
| 301 | /var/www/html/python |
| 302 | /usr/share/info |