%define pybasever 3.1 %define pylibdir %{_libdir}/python%{pybasever} Summary: An interpreted, interactive, object-oriented programming language Name: python3 Version: %{pybasever}.1 Release: 1%{?dist} License: Python Group: Development/Languages Source: http://python.org/ftp/python/%{version}/Python-%{version}.tar.bz2 Patch0: python-3.1.1-config.patch # Fix distutils to follow the Fedora/RHEL/CentOS policies of having .pyo files #Patch51: python-2.6-distutils_rpm.patch Patch102: python-3.1.1-lib64.patch # http://bugs.python.org/issue6999 -- fixed in r75062 Patch200: python-3.1.1-pathfix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-root BuildRequires: readline-devel, openssl-devel, gmp-devel BuildRequires: ncurses-devel, gdbm-devel, zlib-devel, expat-devel BuildRequires: libGL-devel tk tix gcc-c++ libX11-devel glibc-devel BuildRequires: bzip2 tar /usr/bin/find pkgconfig tcl-devel tk-devel BuildRequires: tix-devel bzip2-devel sqlite-devel BuildRequires: autoconf BuildRequires: db4-devel >= 4.7 BuildRequires: libffi-devel URL: http://www.python.org/ %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 python3-docs package. %package devel Summary: The libraries and header files needed for Python development. Group: Development/Libraries Requires: %{name} = %{version}-%{release} Conflicts: %{name} < %{version}-%{release} %description 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 python3-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 tools Summary: A collection of development tools included with Python. Group: Development/Tools Requires: %{name} = %{version}-%{release} Requires: %{name}-tkinter = %{version}-%{release} %description tools The Python package includes several development tools that are used to build python programs. %package tkinter Summary: A graphical user interface for the Python scripting language. Group: Development/Languages BuildRequires: tcl, tk Requires: %{name} = %{version}-%{release} %description tkinter 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. %package test Summary: The test modules from the main python package Group: Development/Languages Requires: %{name} = %{version}-%{release} %description test The test modules from the main python pacakge: %{name} These are in a separate package to save space, as they are almost never used in production. You might want to install the python-test package if you're developing python code that uses more than just unittest and/or test_support.py. %prep %setup -q -n Python-%{version} %patch0 -p1 -b .config %if "%{_lib}" == "lib64" %patch102 -p1 -b .lib64 %endif %patch200 -p1 -b .pathfix %build export CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC" export CXXFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC" export CPPFLAGS="`pkg-config --cflags-only-I libffi`" export OPT="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC" export LINKCC="gcc" if pkg-config openssl ; then export CFLAGS="$CFLAGS `pkg-config --cflags openssl`" export LDFLAGS="$LDFLAGS `pkg-config --libs-only-L openssl`" fi # Force CC export CC=gcc autoconf %configure --enable-ipv6 --with-wide-unicode --enable-shared --with-system-ffi make OPT="$CFLAGS" %{?_smp_mflags} %install [ -d $RPM_BUILD_ROOT ] && rm -fr $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/usr $RPM_BUILD_ROOT%{_mandir} make install DESTDIR=$RPM_BUILD_ROOT mkdir -p ${RPM_BUILD_ROOT}%{pylibdir}/site-packages mv ${RPM_BUILD_ROOT}%{_bindir}/2to3 ${RPM_BUILD_ROOT}%{_bindir}/2to3-3 # Development tools install -m755 -d ${RPM_BUILD_ROOT}%{pylibdir}/Tools install Tools/README ${RPM_BUILD_ROOT}%{pylibdir}/Tools/ cp -ar Tools/freeze ${RPM_BUILD_ROOT}%{pylibdir}/Tools/ cp -ar Tools/i18n ${RPM_BUILD_ROOT}%{pylibdir}/Tools/ cp -ar Tools/modulator ${RPM_BUILD_ROOT}%{pylibdir}/Tools/ cp -ar Tools/pynche ${RPM_BUILD_ROOT}%{pylibdir}/Tools/ cp -ar Tools/scripts ${RPM_BUILD_ROOT}%{pylibdir}/Tools/ # Documentation tools install -m755 -d $RPM_BUILD_ROOT%{pylibdir}/Doc cp -ar Doc/tools $RPM_BUILD_ROOT%{pylibdir}/Doc/ # Demo scripts cp -ar Demo $RPM_BUILD_ROOT%{pylibdir}/ find $RPM_BUILD_ROOT%{pylibdir}/lib-dynload -type d | sed "s|$RPM_BUILD_ROOT|%dir |" > dynfiles find $RPM_BUILD_ROOT%{pylibdir}/lib-dynload -type f | \ grep -v "_tkinter.so$" | \ grep -v "_ctypes_test.so$" | \ grep -v "_testcapimodule.so$" | \ sed "s|$RPM_BUILD_ROOT||" >> dynfiles # Fix for bug #136654 rm -f $RPM_BUILD_ROOT%{pylibdir}/email/test/data/audiotest.au $RPM_BUILD_ROOT%{pylibdir}/test/audiotest.au %if "%{_lib}" == "lib64" install -d $RPM_BUILD_ROOT/usr/lib/python%{pybasever}/site-packages %endif # Make python3-devel multilib-ready (bug #192747, #139911) %define _pyconfig32_h pyconfig-32.h %define _pyconfig64_h pyconfig-64.h %ifarch ppc64 s390x x86_64 ia64 alpha sparc64 %define _pyconfig_h %{_pyconfig64_h} %else %define _pyconfig_h %{_pyconfig32_h} %endif mv $RPM_BUILD_ROOT%{_includedir}/python%{pybasever}/pyconfig.h \ $RPM_BUILD_ROOT%{_includedir}/python%{pybasever}/%{_pyconfig_h} cat > $RPM_BUILD_ROOT%{_includedir}/python%{pybasever}/pyconfig.h << EOF #include #if __WORDSIZE == 32 #include "%{_pyconfig32_h}" #elif __WORDSIZE == 64 #include "%{_pyconfig64_h}" #else #error "Unknown word size" #endif EOF # Fix for bug 201434: make sure distutils looks at the right pyconfig.h file sed -i -e "s/'pyconfig.h'/'%{_pyconfig_h}'/" $RPM_BUILD_ROOT%{pylibdir}/distutils/sysconfig.py # Get rid of egg-info files (core python modules are installed through rpms) rm $RPM_BUILD_ROOT%{pylibdir}/*.egg-info # Switch all shebangs to refer to the specific Python version. LD_LIBRARY_PATH=. ./python Tools/scripts/pathfix.py -i "%{_bindir}/env python%{pybasever}" $RPM_BUILD_ROOT # Get rid of crap find $RPM_BUILD_ROOT/ -name "*~"|xargs rm -f find $RPM_BUILD_ROOT/ -name ".cvsignore"|xargs rm -f find . -name "*~"|xargs rm -f find . -name ".cvsignore"|xargs rm -f rm -f $RPM_BUILD_ROOT%{pylibdir}/LICENSE.txt # Junk, no point in putting in -test sub-pkg rm -f ${RPM_BUILD_ROOT}/%{pylibdir}/idlelib/testcode.py* # Do bytecompilation with the new interpreter. LD_LIBRARY_PATH=. /usr/lib/rpm/brp-python-bytecompile ./python %clean rm -fr $RPM_BUILD_ROOT %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files -f dynfiles %defattr(-, root, root) %doc LICENSE README %{_bindir}/pydoc* %{_bindir}/python* %{_mandir}/*/* %{_libdir}/libpython%{pybasever}.so.* %dir %{pylibdir} %dir %{pylibdir}/site-packages %{pylibdir}/site-packages/README %{pylibdir}/*.py* %{pylibdir}/*.doc %dir %{pylibdir}/ctypes %{pylibdir}/ctypes/*.py* %{pylibdir}/ctypes/macholib %{pylibdir}/curses %dir %{pylibdir}/dbm %{pylibdir}/dbm/*.py* %dir %{pylibdir}/distutils %{pylibdir}/distutils/*.py* %{pylibdir}/distutils/README %{pylibdir}/distutils/command %dir %{pylibdir}/email %{pylibdir}/email/*.py* %{pylibdir}/email/mime %{pylibdir}/encodings %{pylibdir}/html %{pylibdir}/http %{pylibdir}/idlelib %dir %{pylibdir}/importlib %{pylibdir}/importlib/*.py* %dir %{pylibdir}/json %{pylibdir}/json/*.py* %{pylibdir}/logging %{pylibdir}/multiprocessing %{pylibdir}/plat-linux2 %{pylibdir}/pydoc_data %dir %{pylibdir}/sqlite3 %{pylibdir}/sqlite3/*.py* %dir %{pylibdir}/test %{pylibdir}/test/__init__.py* %{pylibdir}/urllib %{pylibdir}/wsgiref %{pylibdir}/xml %{pylibdir}/xmlrpc %if "%{_lib}" == "lib64" %attr(0755,root,root) %dir /usr/lib/python%{pybasever} %attr(0755,root,root) %dir /usr/lib/python%{pybasever}/site-packages %endif %files devel %defattr(-,root,root) /usr/include/* %doc Misc/README.valgrind Misc/valgrind-python.supp Misc/gdbinit %dir %{pylibdir}/config %{pylibdir}/config/* %{_libdir}/libpython%{pybasever}.so %{_libdir}/pkgconfig/python*.pc %files tools %defattr(-,root,root,755) %{pylibdir}/lib2to3 %{_bindir}/2to3* %{_bindir}/idle* %{pylibdir}/Tools %{pylibdir}/Demo %{pylibdir}/Doc %files tkinter %defattr(-,root,root,755) %{pylibdir}/tkinter %{pylibdir}/lib-dynload/_tkinter.so %files test %defattr(-, root, root) %{pylibdir}/ctypes/test %{pylibdir}/distutils/tests %{pylibdir}/email/test %{pylibdir}/importlib/test %{pylibdir}/json/tests %{pylibdir}/sqlite3/test %{pylibdir}/test %{pylibdir}/lib-dynload/_ctypes_test.so %{pylibdir}/lib-dynload/_testcapimodule.so %changelog * Thu Sep 24 2009 Andrew McNabb 3.1.1-1 - Initial package for Python 3.