# python built with '-Wl,--as-needed' is 2-3% slower %define _disable_ld_as_needed 1 %define docver 2.4.4 %define dirver 2.4 %define lib_major %{dirver} %define lib_name_orig libpython %define lib_name %mklibname python %{lib_major} %define _disable_ld_no_undefined 1 %define _requires_exceptions python-base Summary: An interpreted, interactive object-oriented programming language Name: python2.4 Version: 2.4.6 Release: %mkrel 1.2 License: Modified CNRI Open Source License Group: Development/Python Source: http://www.python.org/ftp/python/%{version}/Python-%{version}.tar.bz2 Source1: http://www.python.org/ftp/python/doc/%{docver}/html-%{docver}.tar.bz2 Source2: python-2.4-base.list Source3: exclude.py Source4: python-mode-1.0.tar.bz2 # Don't include /usr/local/* in search path Patch3: Python-2.3-no-local-incpath.patch.bz2 # Support */lib64 convention on x86_64, sparc64, etc. Patch4: Python-2.4.4-lib64.patch # Do handle headers in h2py.py # FIXME: incomplete for proper bi-arch support as #if/#else/#endif # clauses generally should have been handled Patch5: python-2.4.5-biarch-headers.patch # detect and link with gdbm_compat for dbm module Patch6: Python-2.4.1-gdbm.patch.bz2 Patch7: python-2.4.3-fix-buffer_overflow_with_glibc2.3.5.diff Patch8: python-2.4.4-parallel.patch Patch9: python-2.4.4-CVE-2007-2052.patch Patch12: python-2.5-format-string.patch URL: http://www.python.org/ Conflicts: tkinter < %{version} Requires: %{lib_name} = %{version} Requires: %{name}-base = %{version} BuildRequires: db2-devel, db4-devel BuildRequires: expat-devel BuildRequires: gdbm-devel BuildRequires: gmp-devel BuildRequires: ncurses-devel BuildRequires: openssl-devel BuildRequires: readline-devel BuildRequires: termcap-devel %if %mdkversion < 200910 BuildRequires: XFree86-devel BuildRequires: blt BuildRequires: tcl tcl-devel BuildRequires: tk tk-devel BuildRequires: tcl tk tix BuildRequires: tix %endif BuildRequires: autoconf2.5 BuildRequires: bzip2-devel Buildroot: %{_tmppath}/%{name}-%{version} %description Python is an interpreted, interactive, object-oriented programming language often compared to Tcl, Perl, Scheme or Java. Python includes modules, classes, exceptions, very high level dynamic data types and dynamic typing. Python supports interfaces to many system calls and libraries, as well as to various windowing systems (X11, Motif, Tk, Mac and MFC). Programmers can write new built-in modules for Python in C or C++. Python can be used as an extension language for applications that need a programmable interface. This package contains most of the standard Python modules, as well as modules for interfacing to the Tix widget set for Tk and RPM. Note that documentation for Python is provided in the python-docs package. %package -n %{lib_name} Summary: Shared libraries for Python %{version} Group: System/Libraries %description -n %{lib_name} This packages contains Python shared object library. Python is an interpreted, interactive, object-oriented programming language often compared to Tcl, Perl, Scheme or Java. %package -n %{lib_name}-devel Summary: The libraries and header files needed for Python development Group: Development/Python Requires: %{name} = %version Requires: %{lib_name} = %{version} Obsoletes: %{name}-devel Provides: %{name}-devel = %{version}-%{release} %description -n %{lib_name}-devel The Python programming language's interpreter can be extended with dynamically loaded extensions and can be embedded in other programs. This package contains the header files and libraries needed to do these types of tasks. Install %{lib_name}-devel if you want to develop Python extensions. The python package will also need to be installed. You'll probably also want to install the python-docs package, which contains Python documentation. %package docs Summary: Documentation for the Python programming language Requires: %{name} = %version Group: Development/Python %description docs The python-docs package contains documentation on the Python programming language and interpreter. The documentation is provided in ASCII text files and in LaTeX source files. Install the python-docs package if you'd like to use the documentation for the Python language. %if %mdkversion < 200910 %package -n tkinter2.4 Summary: A graphical user interface for the Python scripting language Group: Development/Python Requires: %{name} = %version Requires: tcl tk %description -n tkinter2.4 The Tkinter (Tk interface) program is an graphical user interface for the Python scripting language. You should install the tkinter package if you'd like to use a graphical user interface for Python programming. %endif %package base Summary: Python base files Group: Development/Python Requires: %{lib_name} = %{version} %description base This packages contains the Python part that is used by the base packages of a Mandriva Linux distribution. %prep %setup -q -n Python-%{version} # local include %patch3 -p1 # lib64 %patch4 -p1 # biarch header %patch5 -p1 # gdbm %patch6 -p1 # fix some crash du to a buffer overflow %patch7 -p0 # allow parallel usage with main python %patch8 -p1 # security fix CVE-2007-2052 %patch9 -p1 %patch12 -p0 autoconf mkdir html bzcat %{SOURCE1} | tar x -C html find . -type f -print0 | xargs -0 perl -p -i -e 's@/usr/local/bin/python@/usr/bin/python@' tar --strip-components=1 -xjf %{SOURCE4} -C Misc %build rm -f Modules/Setup.local cat > Modules/Setup.local << EOF linuxaudiodev linuxaudiodev.c EOF OPT="$RPM_OPT_FLAGS -g" export OPT %configure2_5x \ --with-threads \ --with-cycle-gc \ --with-cxx=g++ \ --without-libdb \ --enable-ipv6 \ --enable-shared # fix build perl -pi -e 's/^(LDFLAGS=.*)/$1 -lstdc++/' Makefile # (misc) if the home is nfs mounted, rmdir fails due to delay export TMP="/tmp" TMPDIR="/tmp" %make %check # (misc) if the home is nfs mounted, rmdir fails export TMP="/tmp" TMPDIR="/tmp" # all tests must pass # (misc) test_minidom is not working for the moment # tested on 2.4.1 (mdk), on ubuntu, on debian, on freebsd and gentoo # should be reenabled for 2.4.3 TESTOPTS="-l -x test_linuxaudiodev -x test_nis -x test_minidom -x test_socket -x test_sax -x test_openpty" %ifarch x86_64 TESTOPTS="$TESTOPTS -x test_pwd" %endif make test TESTOPTS="$TESTOPTS" %install rm -rf %{buildroot} mkdir -p %{buildroot}%{_prefix} # fix Makefile to get rid of reference to distcc perl -pi -e "/^CC=/ and s/distcc/gcc/" Makefile # set the install path echo '[install_scripts]' >setup.cfg echo 'install_dir='"%{buildroot}/usr/bin" >>setup.cfg # python is not GNU and does not know fsstd mkdir -p %{buildroot}%{_mandir} %makeinstall_std # remove unversioned binary rm -f %{buildroot}%{_bindir}/python mv %{buildroot}%{_bindir}/pydoc %{buildroot}%{_bindir}/pydoc2.4 mv %{buildroot}%{_bindir}/idle %{buildroot}%{_bindir}/idle2.4 (cd %{buildroot}%{_libdir}; ln -sf libpython%{lib_major}.so.* libpython%{lib_major}.so) # Provide a libpython%{dirver}.so symlink in /usr/lib/puthon*/config, so that # the shared library could be found when -L/usr/lib/python*/config is specified (cd %{buildroot}%{_libdir}/python%{dirver}/config; ln -sf ../../libpython%{lib_major}.so .) # smtpd proxy mv -f %{buildroot}%{_bindir}/smtpd.py %{buildroot}%{_libdir}/python%{dirver}/ %if %mdkversion < 200910 # modulator cat << EOF > %{buildroot}%{_bindir}/modulator2.4 #!/bin/bash exec %{_libdir}/python%{dirver}/site-packages/modulator/modulator.py EOF cp -r Tools/modulator %{buildroot}%{_libdir}/python%{dirver}/site-packages/ # pynche cat << EOF > %{buildroot}%{_bindir}/pynche2.4 #!/bin/bash exec %{_libdir}/python%{dirver}/site-packages/pynche/pynche EOF rm -f Tools/pynche/*.pyw cp -r Tools/pynche %{buildroot}%{_libdir}/python%{dirver}/site-packages/ chmod 755 %{buildroot}%{_bindir}/{idle,modulator,pynche}2.4 ln -f Tools/modulator/README Tools/modulator/README.modulator ln -f Tools/pynche/README Tools/pynche/README.pynche %endif rm -f modules-list.full for n in %{buildroot}%{_libdir}/python%{dirver}/*; do [ -d $n ] || echo $n done >> modules-list.full for mod in %{buildroot}%{_libdir}/python%{dirver}/lib-dynload/* ; do [ `basename $mod` = _tkinter.so ] || echo $mod done >> modules-list.full sed -e "s|%{buildroot}||g" < modules-list.full > modules-list mkdir -p %{buildroot}%{_datadir}/applications %if %mdkversion < 200910 cat > %{buildroot}%{_datadir}/applications/mandriva-tkinter2.4.desktop << EOF [Desktop Entry] Encoding=UTF-8 Name=IDLE Comment=IDE for Python Exec=%{_bindir}/idle2.4 Icon=development_environment_section Terminal=false Type=Application Categories=X-MandrivaLinux-MoreApplications-Development-DevelopmentEnvironments;Development;IDE; EOF %endif cat > %{buildroot}%{_datadir}/applications/mandriva-%{name}-docs.desktop << EOF [Desktop Entry] Encoding=UTF-8 Name=Python documentation Comment=Python complete reference Exec=%{_bindir}/www-browser %_defaultdocdir/%{name}-docs-%{version}/index.html Icon=documentation_section Terminal=false Type=Application Categories=X-MandrivaLinux-MoreApplications-Documentation; EOF rm -f include.list main.list sed 's@%%{_libdir}@%{_libdir}@' < %{SOURCE2} > include.list cat >> modules-list << EOF %{_bindir}/python2.4 %{_bindir}/pydoc2.4 %{_mandir}/man1/python* %{_libdir}/python*/bsddb/ %{_libdir}/python*/curses/ %{_libdir}/python*/distutils/ %{_libdir}/python*/encodings/* %{_libdir}/python*/lib-old/ %{_libdir}/python*/logging/ %{_libdir}/python*/xml/ %{_libdir}/python*/compiler/ %{_libdir}/python*/email/ %{_libdir}/python*/hotshot/ %{_libdir}/python*/site-packages/README %{_libdir}/python*/plat-linux2/ EOF LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}%{_bindir}/python2.4 %{SOURCE3} %{buildroot} include.list modules-list > main.list # fix non real scripts chmod 644 %{buildroot}%{_libdir}/python*/test/test_{binascii,grp,htmlparser}.py* # fix python library not stripped chmod u+w %{buildroot}%{_libdir}/libpython2.4.so.1.0 # avoid conflicts with python 2.5 man page if [ -e %{buildroot}%{_mandir}/man1/python.1 ]; then mv -f %{buildroot}%{_mandir}/man1/python.1 %{buildroot}%{_mandir}/man1/python2.4.1 fi mkdir -p %{buildroot}%{_sysconfdir}/profile.d/ cat > %{buildroot}%{_sysconfdir}/profile.d/30python2.4.sh << 'EOF' if [ -f $HOME/.python2.4rc.py ] ; then export PYTHONSTARTUP=$HOME/.python2.4rc.py else export PYTHONSTARTUP=/etc/python2.4rc.py fi EOF cat > %{buildroot}/%{_sysconfdir}/profile.d/30python2.4.csh << 'EOF' if ( -f ${HOME}/.python2.4rc.py ) then setenv PYTHONSTARTUP ${HOME}/.python2.4rc.py else setenv PYTHONSTARTUP /etc/python2.4rc.py endif EOF cat > %{buildroot}%{_sysconfdir}/python2.4rc.py << EOF try: # this add completion to python interpreter import readline import rlcompleter # see readline man page for this readline.parse_and_bind("set show-all-if-ambiguous on") readline.parse_and_bind("tab: complete") except: pass # you can place a file .python2.4rc.py in your home to overrides this one # but then, this file will not be sourced EOF cat > README.mdv << EOF Python interpreter support readline completion by default. This is only used with the interpreter. In order to remove it, you can : 1) unset PYTHONSTARTUP when you login 2) create a empty file $HOME/.pythonrc.py 3) change /etc/pythonrc.py EOF %multiarch_includes %{buildroot}/usr/include/python*/pyconfig.h %if %mdkversion >= 200910 # drop tkinter files rm -rf %{buildroot}%{_libdir}/python2.4/lib-tk rm -rf %{buildroot}%{_libdir}/python2.4/idlelib rm -rf %{buildroot}%{_libdir}/python2.4/site-packages/modulator rm -rf %{buildroot}%{_libdir}/python2.4/site-packages/pynche rm -f %{buildroot}%{_bindir}/idle2.4 %endif %clean rm -rf %{buildroot} rm -f modules-list main.list %files -f main.list %defattr(-,root,root) %doc README.mdv %dir %{_libdir}/python*/lib-dynload %dir %{_libdir}/python*/site-packages %{_sysconfdir}/profile.d/* %config(noreplace) %{_sysconfdir}/python2.4rc.py %files -n %{lib_name} %defattr(-,root,root) %{_libdir}/libpython*.so.1* %files -n %{lib_name}-devel %defattr(-,root,root) %{_libdir}/libpython*.so %dir %{_includedir}/python* %multiarch %multiarch_includedir/python*/pyconfig.h %{_includedir}/python*/* %{_libdir}/python*/config/ %{_libdir}/python*/test/ %files docs %defattr(-,root,root) %doc html/*/* %{_datadir}/applications/mandriva-%{name}-docs.desktop %if %mdkversion < 200910 %files -n tkinter2.4 %defattr(-,root,root) %dir %{_libdir}/python*/lib-tk %{_libdir}/python*/lib-tk/*.py* %{_libdir}/python*/lib-dynload/_tkinter.so %{_libdir}/python*/idlelib %{_libdir}/python*/site-packages/modulator %{_libdir}/python*/site-packages/pynche %{_bindir}/idle2.4 %{_bindir}/pynche2.4 %{_bindir}/modulator2.4 %{_datadir}/applications/mandriva-tkinter2.4.desktop %endif %files base -f include.list %defattr(-,root,root) %dir %{_libdir}/python* %if %mdkversion < 200900 %post -n %{lib_name} -p /sbin/ldconfig %endif %if %mdkversion < 200900 %postun -n %{lib_name} -p /sbin/ldconfig %endif %if %mdkversion < 200900 %post -n tkinter2.4 %update_menus %endif %if %mdkversion < 200900 %postun -n tkinter2.4 %clean_menus %endif %changelog * Wed Aug 19 2009 Kazuhiko Shiozaki 2.4.6-1.2nxd2009.1 - update spec to build for 2009.1 - drop tarfile patch because we no longer need it. * Fri Mar 13 2009 Kazuhiko Shiozaki 2.4.6-1.1nxd2009.0 - set _disable_ld_as_needed as 1 for the better performance (2-3% faster). * Sun Jan 11 2009 Kazuhiko Shiozaki 2.4.6-1nxd2009.0 - sync with revision 316089. - new upstream release (security fixes only). - set _disable_ld_no_undefined as 1 to avoid ld failures. - update document version to 2.4.4. - remove patches applied upstream: * Sun Aug 10 2008 Kazuhiko Shiozaki 2.4.4-10.1nxd2008.1 - apply following patches from 2.4.4-6ubuntu4.2 + stringobject.dpatch + CVE-2008-1679.dpatch + CVE-2008-3143.dpatch + CVE-2008-3142.dpatch + CVE-2008-3144.dpatch + CVE-2008-2315.dpatch - disable test_openpty because it may fail on chroot environment * Fri Apr 25 2008 Kazuhiko Shiozaki 2.4.4-10nxd2008.1 - apply a patch for tarfile - disable test_sax because it will fail if python2.4-pyxml is already installed