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
#Requires: openssl >= 0.9.8e
Url: http://www.python.org/
License: Python ..
Group: Development/Languages/Python
AutoReqProv: on
Summary: Python3 Interpreter
Version: 3.1.3
Release: 1
%define tarname Python-%{version}
Source0: %{tarname}.tar.bz2
Source1: baselibs.conf
Source6: README.SUSE
Source8: pythonstart
Source9: python.sh
Source10: python.csh
#Source11: testfiles.tar.bz2
# issues with copyrighted Unicode testing files
Source13: distutils.cfg
Patch01: Python-2.3.3-dirs.patch
Patch10: Python-3.0b1-distutils-rpm-8.patch
Patch21: Python-3.1-multilib.patch
Patch23: python-3.0b3-ssl-compat.patch
Patch25: python-2.6b1-canonicalize2.patch
Patch26: python-2.6b1-localpath.patch
Patch27: python-3.0-https_warn.patch
Patch28: python-2.6b1-subprocess-eintr-safety.patch
Patch30: python-2.5.1-sqlite.patch
Patch31: python-2.5.2-fwrapv.patch
Patch34: python-2.5.2-docdirs.patch
Patch35: python-2.5.2-configure.patch
Patch36: python-2.6b3-curses-panel.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%define python_version %(echo %{version} | head -c 3)
%define idle_name idle3
%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.
%package idle
License: Python ..
Requires: %{name} = %{version} python3-tk
Summary: An Integrated Development Environment for Python
Group: Development/Languages/Python
AutoReqProv: on
%description idle
IDLE is a Tkinter based integrated development environment for Python.
It features a multi-window text editor with multiple undo, Python
colorizing, and many other things, as well as a Python shell window and
a debugger.
%package demo
License: Python ..
Requires: %{name} = %{version}
Summary: Python Demonstration Scripts
Group: Development/Languages/Python
AutoReqProv: on
%description demo
Various demonstrations of what you can do with Python and a number of
programs that are useful for building or extending Python.
Authors:
--------
Guido van Rossum <guido@python.org>
%package devel
License: Python ..
Requires: %{name} = %{version}
Summary: Include Files and Libraries Mandatory for Building Python Modules
Group: Development/Languages/Python
AutoReqProv: on
%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 header files, a static library, and development
tools for building Python modules, extending the Python interpreter or
embedding Python in applications.
This also includes the Python distutils, which were in the Python
package up to version 2.2.2.
Authors:
--------
Guido van Rossum <guido@python.org>
%package tk
License: Python ..
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.
Authors:
--------
Guido van Rossum <guido@python.org>
%package curses
License: Python ..
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.
Authors:
--------
Guido van Rossum <guido@python.org>
%package dbm
License: 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.
Authors:
--------
Guido van Rossum <guido@python.org>
%package xml
License: Python ..
Requires: %{name} = %{version}
Summary: A Python XML Interface
Group: Development/Libraries/Python
AutoReqProv: on
%description xml
The expat module is a Python interface to the expat XML parser. Since
Python2.x, it is part of the core Python distribution.
%package 2to3
License: Python ..
Requires: %{name} = %{version}
Summary: Python 3.0 conversion tool
Group: Development/Languages/Python
AutoReqProv: on
%description 2to3
Python3's version of the 2to3 conversion library. For all intents and
purposes it appears to be identical to the one shipped with Python 2.6.
Authors:
--------
Guido van Rossum <guido@python.org>
%prep
#%%setup -q -n %{tarname} -a11
%setup -q -n %{tarname}
# patching
%patch01
%patch10 -p1
%patch21 -p1
%patch23
##%patch25 - canonicalize disabled, needs testing whether the exploit still works
%patch26
%patch27
##%patch28 - eintr-safety disabled, needs validation and possibly rewrite
%patch30
%patch31
#%if 0%{?suse_version}
#%endif
##%patch34
##%patch35
%if %suse_version > 1100
%patch36
%endif
# some cleanup
find . -name .cvsignore -type f -print0 | xargs -0 rm -f
find . -name CVS -type d -print0 | xargs -0 rm -rf
%build
########################################
# disable as-needed to fix build
########################################
export SUSE_ASNEEDED=0
########################################
# use rpm_opt_flags
########################################
export OPT="$RPM_OPT_FLAGS"
########################################
# regenerate
########################################
autoreconf -f -i . # Modules/_ctypes/libffi
# 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
########################################
./configure \
--prefix=%{_prefix} \
--libdir=%{_libdir} \
--mandir=%{_mandir} \
--docdir=%{_docdir}/python \
--enable-ipv6 \
--with-fpectl \
--enable-shared
# --with-dbmliborder=gdbm
########################################
# compile
########################################
make %{?jobs:-j%jobs} DESTDIR=$RPM_BUILD_ROOT
########################################
# test
########################################
# on hppa, the threading of glibc is quite broken. The tests just stop
# at some point, and the machine does not build anything more until a
# timeout several hours later.
%ifnarch hppa %arm
# test_file fails in autobuild env - "stdin.seek(-1)" wrongly succeeds. probably an issue with autobuild's stdin
# test_nis fails in autobuild env. probably a misconfiguration of mbuild servers
EXCLUDE="-x test_file -x test_nis"
# test_distutils fails on some library dir breakage that will need to be solved later, but nevertheless,
# won't occur on a live system
EXCLUDE="$EXCLUDE -x test_distutils"
# Limit virtual memory to avoid spurious failures
if test $(ulimit -v) = unlimited || test $(ulimit -v) -gt 10000000; then
ulimit -v 10000000 || :
fi
make test TESTOPTS="-l $EXCLUDE"
# use network, be verbose:
#make test TESTOPTS="-l -u network -v"
%endif
%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
# install site-specific tweaks
# install -m 644 %{S:12} ${RPM_BUILD_ROOT}%{_libdir}/python%{python_version}
install -m 644 %{S:13} ${RPM_BUILD_ROOT}%{_libdir}/python%{python_version}/distutils
# overwrite the copied binary with a link
ln -sf python%{python_version} ${RPM_BUILD_ROOT}%{_bindir}/python3
rm -f ${RPM_BUILD_ROOT}%{_bindir}/smtpd.py
########################################
# some cleanups
########################################
# remove hard links and replace them with symlinks
### don't do this for python3
#for dir in bin include %{_lib} ; do
# rm -f $RPM_BUILD_ROOT/%{_prefix}/$dir/python
# ln -s python%{python_version} $RPM_BUILD_ROOT/%{_prefix}/$dir/python
#done
# replace duplicate .pyo/.pyc with hardlinks
%fdupes $RPM_BUILD_ROOT/%{_libdir}/python%{python_version}
#fdupes -qr1 $RPM_BUILD_ROOT/%{_libdir}/python%{python_version} | \
# grep '^.*py[oc] .*py[oc] $' | \
# sed -r 's#^(.*\.py)[oc] .+$#\1c \1o#' | \
# xargs -L 1 ln -f
########################################
# documentation
########################################
export PDOCS=${RPM_BUILD_ROOT}%{_docdir}/%{name}
install -d -m 755 $PDOCS
install -c -m 644 %{SOURCE6} $PDOCS/
install -c -m 644 LICENSE $PDOCS/
install -c -m 644 README $PDOCS/
########################################
# tools and demos
########################################
find Tools/ Demo/ -type d \( -regex ".*/.cvsignore" \) -exec rm -f \{\} \;
for x in `find Tools/ Demo/ \( -not -name Makefile \) -print | sort` ; do
test -d $x && ( install -c -m 755 -d $PDOCS/$x ) \
|| ( install -c -m 644 $x $PDOCS/$x )
done
########################################
# idle
########################################
# move idle config into /etc
install -d -m755 ${RPM_BUILD_ROOT}/etc/%{idle_name}
(
cd ${RPM_BUILD_ROOT}/%{_libdir}/python%{python_version}/idlelib/
for file in *.def ; do
mv $file ${RPM_BUILD_ROOT}/etc/%{idle_name}/
ln -sf /etc/%{idle_name}/$file ${RPM_BUILD_ROOT}/%{_libdir}/python%{python_version}/idlelib/
done
)
########################################
# devel
########################################
# install Makefile.pre.in and Makefile.pre
cp Makefile Makefile.pre.in Makefile.pre $RPM_BUILD_ROOT%{_libdir}/python%{python_version}/config/
########################################
# startup script
########################################
### TODO make this work for py3
#install -m 644 %{S:8} $RPM_BUILD_ROOT/etc
#install -d -m 755 $RPM_BUILD_ROOT/etc/profile.d
#install -m 644 %{S:9} %{S:10} $RPM_BUILD_ROOT/etc/profile.d
%clean
rm -rf $RPM_BUILD_ROOT
%post
%{run_ldconfig}
%postun
%{run_ldconfig}
%files idle
%defattr(644, root, root, 755)
%dir /etc/%{idle_name}
%config /etc/%{idle_name}/*
%doc Lib/idlelib/NEWS.txt
%doc Lib/idlelib/README.txt
%doc Lib/idlelib/TODO.txt
%doc Lib/idlelib/extend.txt
%doc Lib/idlelib/ChangeLog
%{_libdir}/python%{python_version}/idlelib
%attr(755, root, root) %{_bindir}/%{idle_name}
%files demo
%defattr(644, root, root, 755)
%doc %{_docdir}/%{name}/Demo
%doc %{_docdir}/%{name}/Tools
%files tk
%defattr(644, root, root, 755)
%{_libdir}/python%{python_version}/tkinter/
%{_libdir}/python%{python_version}/lib-dynload/_tkinter.so
%files curses
%defattr(644, root, root, 755)
%{_libdir}/python%{python_version}/curses
%{_libdir}/python%{python_version}/lib-dynload/_curses.so
%{_libdir}/python%{python_version}/lib-dynload/_curses_panel.so
%files dbm
%defattr(644, root, root, 755)
%{_libdir}/python%{python_version}/dbm
%{_libdir}/python%{python_version}/lib-dynload/_dbm.so
%{_libdir}/python%{python_version}/lib-dynload/_gdbm.so
%files xml
%defattr(644, root, root, 755)
%{_libdir}/python%{python_version}/xml
%{_libdir}/python%{python_version}/xmlrpc
%{_libdir}/python%{python_version}/lib-dynload/pyexpat.so
%files devel
%defattr(-, root, root)
%{_libdir}/python%{python_version}/config
%defattr(644, root, root, 755)
%{_libdir}/libpython%{python_version}.so
%{_libdir}/pkgconfig/*
%{_prefix}/include/python%{python_version}
%{_libdir}/python%{python_version}/test
%defattr(755, root, root)
%{_bindir}/python%{python_version}-config
%{_bindir}/python3-config
%files 2to3
%defattr(644, root, root, 755)
%attr(755, root, root) %{_bindir}/2to3
%{_libdir}/python%{python_version}/lib2to3
%files
%defattr(644, root, root, 755)
#%config /etc/pythonstart
#%config /etc/profile.d/python.*
%dir %{_docdir}/%{name}
%doc %{_docdir}/%{name}/README
%doc %{_docdir}/%{name}/LICENSE
%doc %{_docdir}/%{name}/README.SUSE
%doc %{_mandir}/man1/python%{python_version}.1*
%{_libdir}/libpython%{python_version}.so.*
#%{_libdir}/python
%dir %{_libdir}/python%{python_version}
%{_libdir}/python%{python_version}/*.*
%{_libdir}/python%{python_version}/ctypes
%{_libdir}/python%{python_version}/distutils
%{_libdir}/python%{python_version}/email
%{_libdir}/python%{python_version}/encodings
%{_libdir}/python%{python_version}/html
%{_libdir}/python%{python_version}/http
%{_libdir}/python%{python_version}/importlib
%{_libdir}/python%{python_version}/json
%{_libdir}/python%{python_version}/logging
%{_libdir}/python%{python_version}/multiprocessing
%{_libdir}/python%{python_version}/plat-*
%{_libdir}/python%{python_version}/pydoc_data
%{_libdir}/python%{python_version}/sqlite3
%{_libdir}/python%{python_version}/urllib
%{_libdir}/python%{python_version}/wsgiref
%dir %{_libdir}/python%{python_version}/site-packages
%{_libdir}/python%{python_version}/site-packages/README
%dir %{_libdir}/python%{python_version}/lib-dynload
%{_libdir}/python%{python_version}/lib-dynload/_bisect.so
%{_libdir}/python%{python_version}/lib-dynload/_csv.so
%{_libdir}/python%{python_version}/lib-dynload/_collections.so
%{_libdir}/python%{python_version}/lib-dynload/_ctypes.so
%{_libdir}/python%{python_version}/lib-dynload/_ctypes_test.so
%{_libdir}/python%{python_version}/lib-dynload/_elementtree.so
%{_libdir}/python%{python_version}/lib-dynload/_hashlib.so
%{_libdir}/python%{python_version}/lib-dynload/_heapq.so
%{_libdir}/python%{python_version}/lib-dynload/_json.so
%{_libdir}/python%{python_version}/lib-dynload/_lsprof.so
%{_libdir}/python%{python_version}/lib-dynload/_multiprocessing.so
%{_libdir}/python%{python_version}/lib-dynload/_pickle.so
%{_libdir}/python%{python_version}/lib-dynload/_random.so
%{_libdir}/python%{python_version}/lib-dynload/_socket.so
%{_libdir}/python%{python_version}/lib-dynload/_sqlite3.so
%{_libdir}/python%{python_version}/lib-dynload/_ssl.so
%{_libdir}/python%{python_version}/lib-dynload/_struct.so
%{_libdir}/python%{python_version}/lib-dynload/_testcapi.so
%{_libdir}/python%{python_version}/lib-dynload/array.so
%{_libdir}/python%{python_version}/lib-dynload/atexit.so
%{_libdir}/python%{python_version}/lib-dynload/binascii.so
%{_libdir}/python%{python_version}/lib-dynload/bz2.so
%{_libdir}/python%{python_version}/lib-dynload/cmath.so
%{_libdir}/python%{python_version}/lib-dynload/crypt.so
%{_libdir}/python%{python_version}/lib-dynload/datetime.so
%{_libdir}/python%{python_version}/lib-dynload/fcntl.so
%{_libdir}/python%{python_version}/lib-dynload/grp.so
%{_libdir}/python%{python_version}/lib-dynload/itertools.so
%{_libdir}/python%{python_version}/lib-dynload/math.so
%{_libdir}/python%{python_version}/lib-dynload/mmap.so
%{_libdir}/python%{python_version}/lib-dynload/nis.so
%{_libdir}/python%{python_version}/lib-dynload/operator.so
%{_libdir}/python%{python_version}/lib-dynload/ossaudiodev.so
%{_libdir}/python%{python_version}/lib-dynload/parser.so
%{_libdir}/python%{python_version}/lib-dynload/readline.so
%{_libdir}/python%{python_version}/lib-dynload/resource.so
%{_libdir}/python%{python_version}/lib-dynload/select.so
%{_libdir}/python%{python_version}/lib-dynload/spwd.so
%{_libdir}/python%{python_version}/lib-dynload/syslog.so
%{_libdir}/python%{python_version}/lib-dynload/termios.so
%{_libdir}/python%{python_version}/lib-dynload/time.so
%{_libdir}/python%{python_version}/lib-dynload/unicodedata.so
%{_libdir}/python%{python_version}/lib-dynload/zlib.so
%{_libdir}/python%{python_version}/lib-dynload/_codecs*.so
%{_libdir}/python%{python_version}/lib-dynload/_multibytecodec.so
%{_libdir}/python%{python_version}/lib-dynload/audioop.so
%{_libdir}/python%{python_version}/lib-dynload/Python-%{version}-py%{python_version}.egg-info
%attr(755, root, root) %{_bindir}/pydoc3
%attr(755, root, root) %{_bindir}/python%{python_version}
%attr(755, root, root) %{_bindir}/python3
%changelog