File python3-base.spec of Package python3
#
# spec file for package python3-base
#
# 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-base
BuildRequires: fdupes pkg-config zlib-devel
Url: http://www.python.org/
License: X11/MIT
Group: Development/Languages/Python
AutoReqProv: on
Summary: Python3 Interpreter
Version: 3.2.1
Release: 2
%define tarversion %{version}
%define tarname Python-%{tarversion}
# python 3.1 didn't have a separate python-base, so it is wrongly
# not a conflict to have python3-3.1 and python3-base > 3.1
Obsoletes: python3 < 3.2
# no Provides, because python3 is obviously provided by package python3
Source0: %{tarname}.tar.bz2
Source1: baselibs.conf
Source2: README.SUSE
Source3: python3start
Source4: python3.sh
Source5: python3.csh
Source6: distutils.cfg
Source7: macros.python3.py
# implement "--record-rpm" option for distutils installations
Patch01: Python-3.0b1-record-rpm.patch
# support lib-vs-lib64 distinction
Patch02: Python-3.2.1-multilib.patch
# securing usage of readlink/realpath in PySys_SetArgv
Patch03: python-2.6b1-canonicalize2.patch
# support finding packages in /usr/local, install to /usr/local by default
Patch04: python-3.2rc2-localpath.patch
# fix usage of "python" executable in "make install"
Patch05: python-3.2b2-buildtime-generate.patch
# replace DATE, TIME and COMPILER by fixed definitions to aid reproducible builds
Patch06: python-3.2.1-fix_date_time_compiler.patch
# support for "linux3" platform, for linux 3 kernel
Patch07: 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)
# three possible ABI kinds: m - pymalloc, d - debug build, u - wide unicode
# see PEP 3149
%define abi_kind mu
# python ABI version - used in some file names, unsure why
%define python_abi %{python_version}%{abi_kind}
# soname ABI tag defined in PEP 3149
%define abi_tag %{shortver}%{abi_kind}
#%define so_version %(echo %{python_version} | tr . _)%{abi_kind}1_0
%define so_version 3_2%{abi_kind}1_0
%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 -n python3-tools
License: Python Copyright
Requires: %{name} = %{version}
Summary: Python Utility and Demonstration Scripts
Group: Development/Languages/Python
AutoReqProv: on
Obsoletes: python3-demo < %{version}
Provides: python3-demo = %{version}
%description -n python3-tools
A number of scripts that are useful for building, testing or extending Python,
and a set of demonstration programs.
%package -n python3-idle
License: Python Copyright
Requires: %{name} = %{version} python3-tk
Summary: An Integrated Development Environment for Python
Group: Development/Languages/Python
AutoReqProv: on
%description -n python3-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 -n python3-devel
License: Python Copyright
Requires: %{name} = %{version}
Summary: Include Files and Libraries Mandatory for Building Python Modules
Group: Development/Languages/Python
AutoReqProv: on
%description -n python3-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.
%package -n python3-xml
License: Python Copyright
Requires: %{name} = %{version}
Summary: A Python XML Interface
Group: Development/Libraries/Python
AutoReqProv: on
%description -n python3-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 -n python3-2to3
License: Python Copyright
Requires: %{name} = %{version}
Summary: Python 3.0 conversion tool
Group: Development/Languages/Python
AutoReqProv: on
%description -n python3-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.
%package -n libpython%{so_version}
License: MIT License (or similar)
Summary: Python Interpreter shared library
Group: Development/Languages/Python
AutoReqProv: on
%description -n libpython%{so_version}
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.
This package contains libpython2.6 shared library for embedding in
other applications.
%prep
%setup -q -n %{tarname}
%patch01 -p1
%patch02 -p1
#%patch03
#- canonicalize disabled, needs testing whether the exploit still works
%patch04
%patch05 -p1
%patch06 -p1
%patch07 -p1
# drop Autoconf version requirement
sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.in
%build
# use rpm_opt_flags
export OPT="$RPM_OPT_FLAGS"
#export OPT="-O0 -g"
touch -r %{S:0} Makefile.pre.in
autoreconf -fi
# 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
LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH \
make %{?_smp_mflags} profile-opt
%check
# 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"
# 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"
%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
%define sitedir %{_libdir}/python%{python_version}
# remove .a
find ${RPM_BUILD_ROOT} -name "*.a" -exec rm {} ";"
# install "site-packages" and __pycache__ for third parties
install -d -m 755 ${RPM_BUILD_ROOT}%{sitedir}/site-packages
install -d -m 755 ${RPM_BUILD_ROOT}%{sitedir}/site-packages/__pycache__
# and their 32bit counterparts explicitly
mkdir -p ${RPM_BUILD_ROOT}/usr/lib/python%{python_version}/site-packages/__pycache__
# cleanup parts that don't belong
for so in _md5 _sha1 _sha256 _sha512; do
rm $RPM_BUILD_ROOT%{sitedir}/lib-dynload/$so.*
done
for dir in curses dbm sqlite3 tkinter; do
rm -r $RPM_BUILD_ROOT%{sitedir}/$dir
done
# install site-specific tweaks
install -m 644 %{S:6} ${RPM_BUILD_ROOT}%{sitedir}/distutils
# overwrite the copied binary with a link
ln -sf python%{python_version} ${RPM_BUILD_ROOT}%{_bindir}/python3
# replace duplicate .pyo/.pyc with hardlinks
%fdupes $RPM_BUILD_ROOT/%{sitedir}
# documentation
export PDOCS=${RPM_BUILD_ROOT}%{_docdir}/%{name}
install -d -m 755 $PDOCS
install -c -m 644 %{S:2} $PDOCS/
install -c -m 644 LICENSE $PDOCS/
install -c -m 644 README $PDOCS/
# tools
for x in `find Tools/ \( -not -name Makefile \) -print | sort` ; do
test -d $x && ( install -c -m 755 -d $PDOCS/$x ) \
|| ( install -c -m 644 $x $PDOCS/$x )
done
# clean up the bat files
find $PDOCS -name "*.bat" -exec rm {} ";"
# install devel files to /config
#cp Makefile Makefile.pre.in Makefile.pre $RPM_BUILD_ROOT%{sitedir}/config-%{python_abi}/
# move idle config into /etc
install -d -m 755 ${RPM_BUILD_ROOT}/etc/idle3
(
cd ${RPM_BUILD_ROOT}/%{sitedir}/idlelib/
for file in *.def ; do
mv $file ${RPM_BUILD_ROOT}/etc/idle3/
ln -sf /etc/idle3/$file ${RPM_BUILD_ROOT}/%{sitedir}/idlelib/
done
)
# startup scripts
mkdir -p $RPM_BUILD_ROOT/etc/profile.d
install -m 644 %{S:3} $RPM_BUILD_ROOT/etc
install -m 644 %{S:4} %{S:5} $RPM_BUILD_ROOT/etc/profile.d
# RPM macros
mkdir -p $RPM_BUILD_ROOT/etc/rpm
LD_LIBRARY_PATH=. ./python %{S:7} > $RPM_BUILD_ROOT/etc/rpm/macros.python3
%clean
rm -rf $RPM_BUILD_ROOT
%post -n libpython%{so_version} -p /sbin/ldconfig
%postun -n libpython%{so_version} -p /sbin/ldconfig
%define dynlib() %{sitedir}/lib-dynload/%{1}.cpython-%{abi_tag}.so
%files -n libpython%{so_version}
%defattr(644, root,root)
%{_libdir}/libpython%{python_abi}.so.*
%files -n python3-tools
%defattr(644, root, root, 755)
%{sitedir}/turtledemo
%doc %{_docdir}/%{name}/Tools
%files -n python3-idle
%defattr(644, root, root, 755)
%{sitedir}/idlelib
%dir /etc/idle3
%config /etc/idle3/*
%doc Lib/idlelib/NEWS.txt
%doc Lib/idlelib/README.txt
%doc Lib/idlelib/TODO.txt
%doc Lib/idlelib/extend.txt
%doc Lib/idlelib/ChangeLog
%attr(755, root, root) %{_bindir}/idle3
%attr(755, root, root) %{_bindir}/idle%{python_version}
%files -n python3-xml
%defattr(644, root, root, 755)
%{sitedir}/xml
%{sitedir}/xmlrpc
%{dynlib pyexpat}
%files -n python3-devel
%defattr(644, root, root, 755)
%{_libdir}/libpython%{python_abi}.so
%{_libdir}/libpython3.so
%{_libdir}/pkgconfig/*
%{_prefix}/include/python%{python_abi}
%exclude %{_prefix}/include/python%{python_abi}/pyconfig.h
%{sitedir}/test
%{dynlib _ctypes_test}
%{dynlib _testcapi}
%defattr(755, root, root)
%{_bindir}/python%{python_abi}-config
%{_bindir}/python%{python_version}-config
%{_bindir}/python3-config
%files -n python3-2to3
%defattr(644, root, root, 755)
%attr(755, root, root) %{_bindir}/2to3
%attr(755, root, root) %{_bindir}/2to3-%{python_version}
%{sitedir}/lib2to3
%files
%defattr(644, root, root, 755)
# profile files
%config /etc/python3start
%config /etc/profile.d/python3.*
# docs
%dir %{_docdir}/%{name}
%doc %{_docdir}/%{name}/README
%doc %{_docdir}/%{name}/LICENSE
%doc %{_docdir}/%{name}/README.SUSE
%doc %{_mandir}/man1/python%{python_version}.1*
# makefile etc
%{sitedir}/config-%{python_abi}
%config /etc/rpm/macros.python3
%{_prefix}/include/python%{python_abi}/pyconfig.h
# binary parts
%dir %{sitedir}/lib-dynload
%{sitedir}/lib-dynload/Python-%{tarversion}-py%{python_version}.egg-info
%{dynlib array}
%{dynlib atexit}
%{dynlib audioop}
%{dynlib binascii}
%{dynlib _bisect}
%{dynlib bz2}
%{dynlib cmath}
%{dynlib _codecs_cn}
%{dynlib _codecs_hk}
%{dynlib _codecs_iso2022}
%{dynlib _codecs_jp}
%{dynlib _codecs_kr}
%{dynlib _codecs_tw}
%{dynlib crypt}
%{dynlib _csv}
%{dynlib _ctypes}
%{dynlib _datetime}
%{dynlib _elementtree}
%{dynlib fcntl}
%{dynlib grp}
%{dynlib _heapq}
%{dynlib _json}
%{dynlib _lsprof}
%{dynlib math}
%{dynlib mmap}
%{dynlib _multibytecodec}
%{dynlib _multiprocessing}
%{dynlib nis}
%{dynlib ossaudiodev}
%{dynlib parser}
%{dynlib _pickle}
%{dynlib _posixsubprocess}
%{dynlib _random}
%{dynlib resource}
%{dynlib select}
%{dynlib _socket}
%{dynlib spwd}
%{dynlib _struct}
%{dynlib syslog}
%{dynlib termios}
%{dynlib time}
%{dynlib unicodedata}
%{dynlib zlib}
# python parts
%dir /usr/lib/python%{python_version}
%dir /usr/lib/python%{python_version}/site-packages
%dir /usr/lib/python%{python_version}/site-packages/__pycache__
%dir %{sitedir}
%dir %{sitedir}/site-packages
%dir %{sitedir}/site-packages/__pycache__
%{sitedir}/*.*
%{sitedir}/ctypes
%{sitedir}/concurrent
%{sitedir}/distutils
%{sitedir}/email
%{sitedir}/encodings
%{sitedir}/html
%{sitedir}/http
%{sitedir}/importlib
%{sitedir}/json
%{sitedir}/logging
%{sitedir}/multiprocessing
%{sitedir}/plat-*
%{sitedir}/pydoc_data
%{sitedir}/unittest
%{sitedir}/urllib
%{sitedir}/wsgiref
%{sitedir}/site-packages/README
%{sitedir}/__pycache__
# executables
%attr(755, root, root) %{_bindir}/pydoc3
%attr(755, root, root) %{_bindir}/pydoc%{python_version}
%attr(755, root, root) %{_bindir}/python%{python_abi}
%attr(755, root, root) %{_bindir}/python%{python_version}
%attr(755, root, root) %{_bindir}/python3
%changelog