File python3.spec of Package python3
#
# spec file for package python3
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: python3
BuildRequires: db-devel fdupes gcc-c++ gdbm-devel gettext-tools gmp-devel intltool libbz2-devel libopenssl-devel ncurses-devel readline-devel sqlite-devel tk-devel xorg-x11-devel
Url: http://www.python.org/
License: X11/MIT
Group: Development/Languages/Python
AutoReqProv: on
Summary: Python3 Interpreter
Version: 3.2.1
Release: 3
%define tarversion %{version}
%define tarname Python-%{tarversion}
Requires: python3-base = %{version}
Source0: %{tarname}.tar.bz2
Source1: baselibs.conf
#Source11: testfiles.tar.bz2
# issues with copyrighted Unicode testing files
Patch01: Python-3.2.1-multilib.patch
Patch02: python-2.6b3-curses-panel.patch
Patch03: python-3.2-linux3.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%define python_version %(echo %{tarversion} | head -c 3)
%define shortver %(echo %{python_version} | cut -c 1,3)
%define abi_kind mu
%define python_abi %{python_version}%{abi_kind}
%define abi_tag %{shortver}%{abi_kind}
%define sitedir %{_libdir}/python%{python_version}
%description
Python is an interpreted, object-oriented programming language, and is
often compared to Tcl, Perl, Scheme, or Java. You can find an overview
of Python in the documentation and tutorials included in the python-doc
(HTML) or python-doc-pdf (PDF) packages.
If you want to install third party modules using distutils, you need to
install python-devel package.
Authors:
--------
Guido van Rossum <guido@python.org>
%package tk
License: Python Copyright
Requires: %{name} = %{version}
Summary: TkInter - Python Tk Interface
Group: Development/Libraries/Python
AutoReqProv: on
%description tk
Python interface to Tk. Tk is the GUI toolkit that comes with Tcl. The
"xrpm" package uses this Python interface.
%package curses
License: Python Copyright
Requires: %{name} = %{version}
Summary: Python Interface to the (N)Curses Library
Group: Development/Libraries/Python
AutoReqProv: on
%description curses
An easy to use interface to the (n)curses CUI library. CUI stands for
Console User Interface.
%package dbm
License: X11/MIT
Requires: %{name} = %{version}
Summary: Python Interface to the GDBM Library
Group: Development/Languages/Python
AutoReqProv: on
%description dbm
An easy to use interface for Unix DBM databases, and more specifically,
the GNU implementation GDBM.
%prep
%setup -q -n %{tarname}
# patching
%patch01 -p1
%patch02
%patch03 -p1
# drop Autoconf version requirement
sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.in
%build
export SUSE_ASNEEDED=0
export OPT="$RPM_OPT_FLAGS"
autoreconf -f -i .
# prevent make from trying to rebuild asdl stuff, which requires existing
# python installation
touch Parser/asdl* Python/Python-ast.c Include/Python-ast.h
./configure \
--prefix=%{_prefix} \
--libdir=%{_libdir} \
--mandir=%{_mandir} \
--docdir=%{_docdir}/python \
--enable-ipv6 \
--with-fpectl \
--enable-shared \
--with-wide-unicode
make %{?jobs:-j%jobs} # DESTDIR=$RPM_BUILD_ROOT
%check
# Limit virtual memory to avoid spurious failures
if test $(ulimit -v) = unlimited || test $(ulimit -v) -gt 10000000; then
ulimit -v 10000000 || :
fi
# only test the parts skipped in python3-base
TESTS="test_dbm_gnu test_dbm_ndbm test_readline test_ssl test_tcl test_tk test_ttk_guionly test_ttk_textonly test_curses test_socketserver test_sqlite test_hashlib"
make test TESTOPTS="-l $TESTS $EXCLUDE"
%install
# replace rest of /usr/local/bin/python or /usr/bin/python2.5 with /usr/bin/python3
find . -path "./Parser" -prune -o -path "./Python/makeopcodetargets.py" -prune -o -name '*.py' -type f -print0 | xargs -0 grep -lE '^#! *(/usr/.*bin/(env +)?)?python' | xargs sed -r -i -e '1s@^#![[:space:]]*(/usr/(local/)?bin/(env +)?)?python([0-9]+(\.[0-9]+)?)?@#!/usr/bin/python3@'
# the grep inbetween makes it much faster
# install it
make \
OPT="$RPM_OPT_FLAGS -fPIC" \
DESTDIR=$RPM_BUILD_ROOT \
install
# clean out stuff that is in python-base and subpackages
rm $RPM_BUILD_ROOT%{_bindir}/*
rm $RPM_BUILD_ROOT%{_libdir}/lib*
rm -r $RPM_BUILD_ROOT%{_libdir}/pkgconfig
rm -r $RPM_BUILD_ROOT%{_mandir}/*
rm -r $RPM_BUILD_ROOT%{_includedir}/*
rm -r $RPM_BUILD_ROOT%{sitedir}/config*
find $RPM_BUILD_ROOT%{sitedir} -name "*.egg-info" -exec rm {} ";"
rm -r $RPM_BUILD_ROOT%{sitedir}/__pycache__
rm -r $RPM_BUILD_ROOT%{sitedir}/site-packages
rm $RPM_BUILD_ROOT%{sitedir}/*.*
for module in \
ctypes concurrent distutils email encodings html http importlib json \
logging multiprocessing plat-* pydoc_data unittest urllib wsgiref \
lib2to3 test xml xmlrpc idlelib turtledemo
do
rm -r $RPM_BUILD_ROOT%{sitedir}/$module
done
for library in \
array atexit audioop binascii _bisect bz2 cmath _codecs_* crypt _csv \
_ctypes _datetime _elementtree fcntl grp _heapq _json _lsprof math \
mmap _multibytecodec _multiprocessing nis ossaudiodev parser _pickle \
_posixsubprocess _random resource select _socket spwd _struct syslog \
termios time unicodedata zlib \
pyexpat _ctypes_test _testcapi
do
eval rm "$RPM_BUILD_ROOT%{sitedir}/lib-dynload/$library.*"
done
%fdupes $RPM_BUILD_ROOT/%{_libdir}/python%{python_version}
%define dynlib() %{sitedir}/lib-dynload/%{1}.cpython-%{abi_tag}.so
%files tk
%defattr(644, root, root, 755)
%{sitedir}/tkinter
%{dynlib _tkinter}
%files curses
%defattr(644, root, root, 755)
%{sitedir}/curses
%{dynlib _curses}
%{dynlib _curses_panel}
%files dbm
%defattr(644, root, root, 755)
%{sitedir}/dbm
%{dynlib _dbm}
%{dynlib _gdbm}
%files
%defattr(644, root, root, 755)
%dir %{sitedir}
%dir %{sitedir}/lib-dynload
%{sitedir}/sqlite3
%{dynlib _hashlib}
%{dynlib readline}
%{dynlib _sqlite3}
%{dynlib _ssl}
%{dynlib xxlimited}
%changelog