#
# spec file for package python3-base
#
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
#
# see PACKAGING-NOTES for details
# !!!!
+### COMMON-DEF-BEGIN ###
+%define tarversion %{version}
+%define tarname Python-%{tarversion}
+# the versions are autogenerated from pre_checkin.sh
+# based on the current source tarball
+%define python_version 3.6
+%define python_version_abitag 36
+%define python_version_soname 3_6
+
+%define sitedir %{_libdir}/python%{python_version}
+
+# three possible ABI kinds: m - pymalloc, d - debug build; see PEP 3149
+%define abi_kind m
+# python ABI version - used in some file names
+%define python_abi %{python_version}%{abi_kind}
+# soname ABI tag defined in PEP 3149
+%define abi_tag %{python_version_abitag}%{abi_kind}
+# version part of "libpython" package
+%define so_version %{python_version_soname}%{abi_kind}1_0
+
+# rpm and python have different ideas about what is an arch-dependent name, so:
+%if %{__isa_name} == ppc
+%define archname %(echo %{_arch} | sed s/ppc/powerpc/)
+%else
+%define archname %{_arch}
+%endif
+# our arm has Hardware-Floatingpoint
+#%if %{_arch} == arm
+#%define armsuffix hf
+#%endif
+
+# pyexpat.cpython-35m-x86_64-linux-gnu
+# pyexpat.cpython-35m-powerpc64le-linux-gnu
+# pyexpat.cpython-35m-armv7-linux-gnueabihf
+%define dynlib() %{sitedir}/lib-dynload/%{1}.cpython-%{abi_tag}-%{archname}-%{_os}%{?_gnu}.so
+### COMMON-DEF-END ###
+
+# that thing where "without" means "default=on" and vice versa
+%bcond_without testsuite
+%if 0%{?do_profiling}
+%bcond_without profileopt
+%else
+%bcond_with profileopt
+%endif
Name: python3-base
-BuildRequires: automake
-BuildRequires: fdupes
-#BuildRequires: libbz2-devel
-BuildRequires: lzma-devel
-BuildRequires: pkg-config
-BuildRequires: timezone
-BuildRequires: xz
-BuildRequires: zlib-devel
-Url: http://www.python.org/
-Summary: Python 3 Interpreter
+Version: 3.6.3
+Release: 0
+Summary: Python 3 Interpreter and Stdlib Core
License: Python-2.0
Group: Development/Languages/Python
-Version: 3.4.4
-Release: 0
-%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
-# python3 3.4 provides asyncio
-Provides: python3-asyncio = %{version}
-Obsoletes: python3-asyncio < %{version}
+Url: http://www.python.org/
+##### SOURCE FILES #####
Source0: http://www.python.org/ftp/python/%{version}/%{tarname}.tar.xz
#Source1: http://www.python.org/ftp/python/%{version}/%{tarname}.tar.xz.asc
+#Source2: python.keyring
Source3: baselibs.conf
+#Source4: README.SUSE
Source5: python3start
Source6: python3.sh
Source7: python3.csh
-Source8: macros.python3.py
+Source8: macros.python3
Source9: import_failed.py
Source10: import_failed.map
Source100: PACKAGING-NOTES
Source101: python3-rpmlintrc
Source102: pre_checkin.sh
+Source103: skipped_tests.py
-BuildRoot: %{_tmppath}/%{name}-%{version}-build
+##### REQURES, PROVIDES, OBSOLETES #####
+Requires: python-rpm-macros
+Recommends: python3 = %{version}
+#Recommends: python3-ensurepip
-### COMMON-DEF-BEGIN ###
-
-# the versions are autogenerated from pre_checkin.sh
-# based on the current source tarball
-%define python_version 3.4
-
-%define python_version_abitag 34
-%define python_version_soname 3_4
+# 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
-%define sitedir %{_libdir}/python%{python_version}
+# python 3.4 provides asyncio
+Provides: python3-asyncio = %{version}
+Obsoletes: python3-asyncio < %{version}
-# three possible ABI kinds: m - pymalloc, d - debug build
-# see PEP 3149
-%define abi_kind m
-# python ABI version - used in some file names
-%define python_abi %{python_version}%{abi_kind}
-# soname ABI tag defined in PEP 3149
-%define abi_tag %{python_version_abitag}%{abi_kind}
+# python 3.6 provides typing
+Provides: python3-typing = %{version}
+Obsoletes: python3-typing < %{version}
-%define so_version %{python_version_soname}%{abi_kind}1_0
+##### BUILDREQUIRES #####
+# SECTION required for basic build
+BuildRequires: automake
+BuildRequires: pkgconfig
+# /SECTION
+# SECTION required for core modules
+# The compression-related ones could be moved to python3 if necessary, with the exception of zlib.
+# _bz2
+BuildRequires: bzip2-devel
+# _ctypes
+BuildRequires: libffi-devel
+# _lzma
+BuildRequires: lzma-devel
+# ssl
+BuildRequires: openssl-devel >= 1.0.2
+# zlib
+BuildRequires: zlib-devel
+# nis
+#BuildRequires: libnsl-devel
-# rpm and python have different ideas about what is an arch-dependent name, so:
-%if %{__isa_name} == ppc
-%define archname %(echo %{_arch} | sed s/ppc/powerpc/)
-%else
-%define archname %{_arch}
-%endif
-# our arm has Hardware-Floatingpoint
-%if %{_arch} == arm
-%define armsuffix hf
-%endif
+# /SECTION
+# SECTION required for build and testsuite
+BuildRequires: fdupes
+# netcfg is needed *only* for /etc/services for one test in test_asyncio
+# this could be moved to python3 if needed, it's just more convenient here
+#BuildRequires: netcfg
+BuildRequires: timezone
+BuildRequires: xz
+# /SECTION
-# pyexpat.cpython-35m-x86_64-linux-gnu
-# pyexpat.cpython-35m-powerpc64le-linux-gnu
-# pyexpat.cpython-35m-armv7-linux-gnueabihf
-# %define dynlib() %{sitedir}/lib-dynload/%{1}.cpython-%{abi_tag}-%{archname}-%{_os}%{?_gnu}%{?armsuffix}.so
-%define dynlib() %{sitedir}/lib-dynload/%{1}.cpython-%{abi_tag}.so
-### COMMON-DEF-END ###
%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.
+package.
-If you want to install third party modules using distutils, you need to
-install python-devel package.
+This package contains the interpreter core and most commonly used modules
+from the standard library. This is sufficient for many usecases, but it
+excludes components that depend on external libraries, most notably XML,
+database and UI toolkits support.
%package -n python3-tools
-Requires: %{name} = %{version}
Summary: Python Utility and Demonstration Scripts
Group: Development/Languages/Python
+Requires: %{name} = %{version}
Obsoletes: python3-demo < %{version}
Provides: python3-demo = %{version}
+Obsoletes: python3-2to3 < %{version}
+Provides: python3-2to3 = %{version}
%description -n python3-tools
A number of scripts that are useful for building, testing or extending Python,
%package -n python3-idle
-Requires: %{name} = %{version}
-Requires: python3-tk
Summary: An Integrated Development Environment for Python
Group: Development/Languages/Python
+Requires: %{name} = %{version}
+Requires: python3-tk
%description -n python3-idle
IDLE is a Tkinter based integrated development environment for Python.
%package -n python3-devel
-Requires: %{name} = %{version}
-Provides: python3-2to3 = %{version}
-Obsoletes: python3-2to3 < %{version}
Summary: Include Files and Libraries Mandatory for Building Python Modules
Group: Development/Languages/Python
+Requires: %{name} = %{version}
%description -n python3-devel
The Python programming language's interpreter can be extended with
%package -n python3-testsuite
-Requires: python3 = %{version}
-Requires: python3-tk = %{version}
Summary: Unit tests for Python and its standard library
Group: Development/Languages/Python
+Requires: python3 = %{version}
+Requires: python3-tk = %{version}
%description -n python3-testsuite
Unit tests that are useful for verifying integrity and functionality
of the installed Python interpreter and standard library.
They are a documented part of stdlib, as a module 'test'.
-
%package -n libpython%{so_version}
Summary: Python Interpreter shared library
Group: Development/Languages/Python
This package contains libpython3.2 shared library for embedding in
other applications.
-%package -n python3-dummy
-Summary: dummy package
-Group: Development/Languages/Python
-
-%description -n python3-dummy
-dummy package
-
-
%prep
%setup -q -n %{tarname}
# fix shebangs - convert /usr/local/bin/python and /usr/bin/env/python to /usr/bin/python3
for dir in Lib Tools; do
# find *.py, filter to files that contain bad shebangs
+ # break up "/""usr" like this to prevent replacing with %{_prefix}
find $dir -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@'
+ | xargs -0 grep -lE '^#! *(/''usr/.*bin/(env +)?)?python' \
+ | xargs sed -r -i -e '1s@^#![[:space:]]*(/''usr/(local/)?bin/(env +)?)?python([0-9]+(\.[0-9]+)?)?@#!%{_bindir}/python3@'
done
+# drop in-tree libffi and expat
+rm -r Modules/_ctypes/libffi* Modules/_ctypes/darwin
+rm -r Modules/expat
+
+# drop duplicate README from site-packages
+rm Lib/site-packages/README.txt
+
### COMMON-PREP-END ###
%build
+### COMMON-CONFIG-BEGIN ###
# use rpm_opt_flags
-export OPT="%{optflags} -DOPENSSL_LOAD_CONF"
+export OPT="%{optflags} -DOPENSSL_LOAD_CONF $(pkg-config --cflags-only-I libffi)"
-touch -r %{S:0} Makefile.pre.in
+touch -r %{SOURCE0} 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
-# prevent makeopcodetargets
-touch -r Python/opcode_targets.h Lib/opcode.py Python/makeopcodetargets.py
%if 0%{?sles_version}
sed -e 's/-fprofile-correction//' -i Makefile.pre.in
%endif
-./configure \
+%configure \
--prefix=%{_prefix} \
--libdir=%{_libdir} \
--mandir=%{_mandir} \
--with-fpectl \
--enable-shared \
--with-ensurepip=no \
+ --with-system-ffi \
+ --with-system-expat \
+ --enable-lto \
--enable-loadable-sqlite-extensions
-%if 0%{?do_profiling}
-target=profile-opt
+# prevent make from trying to rebuild PYTHON_FOR_GEN stuff
+make -t Python/Python-ast.c \
+ Include/Python-ast.h \
+ Objects/typeslots.inc \
+ Python/opcode_targets.h \
+ Include/opcode.h
+
+### COMMON-CONFIG-END ###
+
+%if %{with profileopt}
+ target=profile-opt
%else
-target=all
+ target=all
%endif
LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH \
make %{?_smp_mflags} BASE_LIB=%{_lib} $target
%check
-# SUSE's gdb breaks test_gdb by producing spurious output (zypper suggestions)
-# test_socket fails because of name resolution failure, that is expected
-EXCLUDE="test_gdb test_socket"
-%ifarch %arm
+# exclude test_gdb -- it doesn't run in buildservice anyway, and fails on missing debuginfos
+# when you install gdb into your test env
+EXCLUDE="test_gdb"
+
+%ifarch %{arm}
# test_multiprocessing_forkserver is racy
EXCLUDE="$EXCLUDE test_multiprocessing_forkserver"
%endif
%endif
# some tests break in QEMU
%if 0%{?qemu_user_space_build} > 0
-EXCLUDE="$EXCLUDE test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_main_handling test_multiprocessing_spawn test_threading test_threadedtempfile test_io test_posix test_ioctl test_mmap test_openpty test_pty test_monotonic_settime test_clock_settime test_time test_subprocess test_asyncore test_asyncio test_send_at_certain_offset test_send_whole_file test_os test_faulthandler"
+EXCLUDE="$EXCLUDE test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_main_handling test_multiprocessing_spawn test_threading test_threadedtempfile test_io test_posix test_ioctl test_mmap test_openpty test_pty test_time test_subprocess test_asyncore test_asyncio test_os test_faulthandler"
# qemu bug (siginterrupt handling)
EXCLUDE="$EXCLUDE test_signal"
%endif
-# on x86_64, SLE_11_SP2 only, extreme gamma function values (close to negative
-# integers) fail. Is probably a bug/imperfection in -lm
-# disabling this for all SLE, unless someone knows how to test for SP level?
-%ifarch x86_64
-%if 0%{?sles_version} == 11
-EXCLUDE="$EXCLUDE test_math"
-%endif
-%endif
-
# This test (part of test_uuid) requires real network interfaces
# so that ifconfig output has "HWaddr <something>". Some kvm instances
-# done have any such interface breaking teh uuid module.
+# done have any such interface breaking the uuid module.
EXCLUDE="$EXCLUDE test_uuid"
-# Exclude test_tools, test_venv and test_ensurepip which indirectly require ssl
-EXCLUDE="$EXCLUDE test_tools test_venv test_ensurepip"
+# XML tests
+EXCLUDE="$EXCLUDE test_docxmlrpc test_minidom test_pulldom test_pyexpat \
+ test_xml_etree test_xml_etree_c test_xmlrpc test_xmlrpc_net"
+# tests for components that require XML indirectly
+EXCLUDE="$EXCLUDE test_plistlib test_venv \
+ test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_spawn"
# 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="-u none -x $EXCLUDE"
+%if %{with testsuite}
+make -j1 test TESTOPTS="-u none -x $EXCLUDE"
# use network, be verbose:
#make test TESTOPTS="-l -u network -v"
+%endif
%install
rm -rf $RPM_BUILD_ROOT
make \
OPT="%{optflags} -fPIC" \
- DESTDIR=$RPM_BUILD_ROOT \
+ DESTDIR=%{buildroot} \
install
# remove .a
-find ${RPM_BUILD_ROOT} -name "*.a" -exec rm {} ";"
+find %{buildroot} -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__
+install -d -m 755 %{buildroot}%{sitedir}/site-packages
+install -d -m 755 %{buildroot}%{sitedir}/site-packages/__pycache__
# and their 32bit counterparts explicitly
-mkdir -p ${RPM_BUILD_ROOT}/usr/lib/python%{python_version}/site-packages/__pycache__
+mkdir -p %{buildroot}%{_prefix}/lib/python%{python_version}/site-packages/__pycache__
# cleanup parts that don't belong
-#for dir in curses dbm ensurepip sqlite3 tkinter xml xmlrpc; do
-# find $RPM_BUILD_ROOT%{sitedir}/$dir/* -maxdepth 0 -name "test" -o -exec rm -rf {} ";"
-#done
-rm $RPM_BUILD_ROOT%{dynlib pyexpat}
+for dir in curses dbm ensurepip sqlite3 tkinter xml xmlrpc; do
+ find %{buildroot}%{sitedir}/$dir/* -maxdepth 0 -name "test" -o -exec rm -rf {} ";"
+done
+# rm $RPM_BUILD_ROOT%{dynlib pyexpat}
# overwrite the copied binary with a link
-ln -sf python%{python_version} ${RPM_BUILD_ROOT}%{_bindir}/python3
+ln -sf python%{python_version} %{buildroot}%{_bindir}/python3
+
+# link shared library instead of static library that tools expect
+#ln -s libpython%{python_abi}.so %{buildroot}%{_libdir}/python%{python_version}/config-%{python_abi}-%{archname}-%{_os}%{?_gnu}%{?armsuffix}/libpython%{python_abi}.so
+ln -s libpython%{python_abi}.so %{buildroot}%{_libdir}/python%{python_version}/config-%{python_abi}-%{archname}-%{_os}%{?_gnu}/libpython%{python_abi}.so
# replace duplicate .pyo/.pyc with hardlinks
-%fdupes $RPM_BUILD_ROOT/%{sitedir}
+%fdupes %{buildroot}/%{sitedir}
# documentation
-export PDOCS=${RPM_BUILD_ROOT}%{_docdir}/%{name}
+export PDOCS=%{buildroot}%{_docdir}/%{name}
install -d -m 755 $PDOCS
-#install -c -m 644 %{S:4} $PDOCS/
-install -c -m 644 LICENSE $PDOCS/
-install -c -m 644 README $PDOCS/
+#install -c -m 644 %{SOURCE4} $PDOCS/
+install -c -m 644 LICENSE $PDOCS/
+install -c -m 644 README.rst $PDOCS/
# tools
for x in `find Tools/ \( -not -name Makefile \) -print | sort` ; do
#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/
+install -d -m 755 %{buildroot}%{_sysconfdir}/idle3
+(
+ cd %{buildroot}/%{sitedir}/idlelib/
for file in *.def ; do
- mv $file ${RPM_BUILD_ROOT}/etc/idle3/
- ln -sf /etc/idle3/$file ${RPM_BUILD_ROOT}/%{sitedir}/idlelib/
+ mv $file %{buildroot}%{_sysconfdir}/idle3/
+ ln -sf %{_sysconfdir}/idle3/$file %{buildroot}/%{sitedir}/idlelib/
done
)
# startup scripts
-mkdir -p $RPM_BUILD_ROOT/etc/profile.d
-install -m 644 %{S:5} $RPM_BUILD_ROOT/etc # python3start
-install -m 644 %{S:6} %{S:7} $RPM_BUILD_ROOT/etc/profile.d # python3.sh, python3.csh
+mkdir -p %{buildroot}%{_sysconfdir}/profile.d
+install -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir} # python3start
+install -m 644 %{SOURCE6} %{SOURCE7} %{buildroot}%{_sysconfdir}/profile.d # python3.sh, python3.csh
# RPM macros
-mkdir -p $RPM_BUILD_ROOT/etc/rpm
-LD_LIBRARY_PATH=. ./python %{S:8} > $RPM_BUILD_ROOT/etc/rpm/macros.python3 # macros.python3.py
+mkdir -p %{buildroot}%{_sysconfdir}/rpm
+install -m 644 %{SOURCE8} %{buildroot}%{_sysconfdir}/rpm # macros.python3
# import_failed hooks
-FAILDIR=$RPM_BUILD_ROOT/%{sitedir}/_import_failed
+FAILDIR=%{buildroot}/%{sitedir}/_import_failed
mkdir $FAILDIR
-install -m 644 %{S:9} %{S:10} $FAILDIR # import_failed.*
+install -m 644 %{SOURCE9} %{SOURCE10} $FAILDIR # import_failed.*
LD_LIBRARY_PATH=. ./python -c "from py_compile import compile; compile('$FAILDIR/import_failed.py', dfile='%{sitedir}/_import_failed/import_failed.py')"
LD_LIBRARY_PATH=. ./python -O -c "from py_compile import compile; compile('$FAILDIR/import_failed.py', dfile='%{sitedir}/_import_failed/import_failed.py')"
(
done
popd
done
- done < %{S:10}
+ done < %{SOURCE10}
)
-echo %{sitedir}/_import_failed > $RPM_BUILD_ROOT/%{sitedir}/site-packages/zzzz-import-failed-hooks.pth
+echo %{sitedir}/_import_failed > %{buildroot}/%{sitedir}/site-packages/zzzz-import-failed-hooks.pth
%post -n libpython%{so_version} -p /sbin/ldconfig
%files -n python3-tools
%defattr(644, root, root, 755)
%{sitedir}/turtledemo
+%license LICENSE
+%{_bindir}/2to3
+%attr(755, root, root)%{_bindir}/2to3-%{python_version}
%doc %{_docdir}/%{name}/Tools
%files -n python3-idle
%defattr(644, root, root, 755)
%{sitedir}/idlelib
-%dir /etc/idle3
-%config /etc/idle3/*
+%dir %{_sysconfdir}/idle3
+%config %{_sysconfdir}/idle3/*
%doc Lib/idlelib/NEWS.txt
%doc Lib/idlelib/README.txt
%doc Lib/idlelib/TODO.txt
%files -n python3-devel
%defattr(644, root, root, 755)
+%license LICENSE
%{_libdir}/libpython%{python_abi}.so
%{_libdir}/libpython3.so
%{_libdir}/pkgconfig/*
-%{_prefix}/include/python%{python_abi}
-%exclude %{_prefix}/include/python%{python_abi}/pyconfig.h
+%{_includedir}/python%{python_abi}
+%{sitedir}/config-%{python_abi}-*
%defattr(755, root, root)
%{_bindir}/python%{python_abi}-config
%{_bindir}/python%{python_version}-config
%{_bindir}/python3-config
-%{_bindir}/2to3
-%{_bindir}/2to3-%{python_version}
%files -n python3-testsuite
%defattr(644, root, root, 755)
+%license LICENSE
%{sitedir}/test
%{sitedir}/*/test
+%{sitedir}/*/tests
%{dynlib _ctypes_test}
%{dynlib _testbuffer}
%{dynlib _testcapi}
%{dynlib _testimportmultiple}
-#%{dynlib _testmultiphase}
+%{dynlib _testmultiphase}
%{dynlib xxlimited}
# workaround for missing packages
%dir %{sitedir}/sqlite3
%files
%defattr(644, root, root, 755)
# profile files
-%config /etc/python3start
-%config /etc/profile.d/python3.*
+%config %{_sysconfdir}/python3start
+%config %{_sysconfdir}/profile.d/python3.*
+%license LICENSE
# docs
%dir %{_docdir}/%{name}
-%doc %{_docdir}/%{name}/README
+%doc %{_docdir}/%{name}/README.rst
%doc %{_docdir}/%{name}/LICENSE
-%doc %{_mandir}/man1/python3.1*
-%doc %{_mandir}/man1/python%{python_version}.1*
+#%doc %{_docdir}/%{name}/README.SUSE
+%{_mandir}/man1/python3.1*
+%{_mandir}/man1/python%{python_version}.1*
# license text, not a doc because the code can use it at run-time
%{sitedir}/LICENSE.txt
-# makefile etc
-%{sitedir}/config-%{python_abi}
-/etc/rpm/macros.python3
-%{_prefix}/include/python%{python_abi}/pyconfig.h
+# RPM macros
+%{_sysconfdir}/rpm/macros.python3
# binary parts
%dir %{sitedir}/lib-dynload
-#%{sitedir}/lib-dynload/Python-%{tarversion}-py%{python_version}.egg-info
+
%{dynlib array}
+%{dynlib _asyncio}
%{dynlib audioop}
%{dynlib binascii}
%{dynlib _bisect}
-#%{dynlib _bz2}
+%{dynlib _bz2}
%{dynlib cmath}
%{dynlib _codecs_cn}
%{dynlib _codecs_hk}
%{dynlib _ctypes}
%{dynlib _datetime}
%{dynlib _decimal}
-%{dynlib _elementtree}
%{dynlib fcntl}
%{dynlib grp}
+%{dynlib _hashlib}
%{dynlib _heapq}
%{dynlib _json}
%{dynlib _lsprof}
%{dynlib resource}
%{dynlib select}
%{dynlib _socket}
+%{dynlib _ssl}
%{dynlib spwd}
%{dynlib _struct}
%{dynlib syslog}
%{dynlib unicodedata}
%{dynlib zlib}
# hashlib fallback modules
+%{dynlib _blake2}
%{dynlib _md5}
%{dynlib _sha1}
%{dynlib _sha256}
%{dynlib _sha512}
-
+%{dynlib _sha3}
# 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 %{_prefix}/lib/python%{python_version}
+%dir %{_prefix}/lib/python%{python_version}/site-packages
+%dir %{_prefix}/lib/python%{python_version}/site-packages/__pycache__
%dir %{sitedir}
%dir %{sitedir}/site-packages
%dir %{sitedir}/site-packages/__pycache__
%exclude %{sitedir}/*/test
+%exclude %{sitedir}/*/tests
%{sitedir}/*.py
%{sitedir}/asyncio
%{sitedir}/ctypes
%{sitedir}/lib2to3
%{sitedir}/logging
%{sitedir}/multiprocessing
-%{sitedir}/plat-*
%{sitedir}/pydoc_data
%{sitedir}/unittest
%{sitedir}/urllib
%{sitedir}/venv
%{sitedir}/wsgiref
-%{sitedir}/site-packages/README
%{sitedir}/__pycache__
# import-failed hooks
%{sitedir}/_import_failed
%attr(755, root, root) %{_bindir}/python%{python_version}
%attr(755, root, root) %{_bindir}/pyvenv-%{python_version}
-%files -n python3-dummy
-%defattr(644, root, root, 755)
-%{dynlib time}
-
%changelog
-
#
# spec file for package python3
#
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
#
-Name: python3
-BuildRequires: automake
-#BuildRequires: db-devel
-BuildRequires: fdupes
-BuildRequires: gcc-c++
-BuildRequires: gdbm-devel
-BuildRequires: gettext-tools
-BuildRequires: intltool
-#BuildRequires: libbz2-devel
-BuildRequires: libexpat-devel
-BuildRequires: libffi-devel
-BuildRequires: libopenssl-devel
-BuildRequires: lzma-devel
-BuildRequires: ncurses-devel
-BuildRequires: readline-devel
-BuildRequires: sqlite-devel
-#BuildRequires: tk-devel
-BuildRequires: xz
-#BuildRequires: pkgconfig(x11)
-Url: http://www.python.org/
-Summary: Python 3 Interpreter
-License: Python-2.0
-Group: Development/Languages/Python
-Version: 3.4.4
-Release: 0
-%define tarversion %{version}
-%define tarname Python-%{tarversion}
-
-Requires: python3-base = %{version}
-Recommends: python3-pip
-Suggests: python3-curses
-Suggests: python3-idlelib
-
-#Suggests: python3-tk
-#Suggests: python3-dbm
-
-Source0: http://www.python.org/ftp/python/%{version}/%{tarname}.tar.xz
-#Source11: testfiles.tar.bz2
-# issues with copyrighted Unicode testing files
-
-# do not add patches here, please edit python3-base.spec instead
-# and run pre_checkin.sh
-#
-# see PACKAGING-NOTES for details
-
-### COMMON-PATCH-BEGIN ###
-### COMMON-PATCH-END ###
-
-BuildRoot: %{_tmppath}/%{name}-%{version}-build
-
# do not add defs here, please edit python3-base.spec instead
# and run pre_checkin.sh
#
# see PACKAGING-NOTES for details
-
+#
### COMMON-DEF-BEGIN ###
-
+%define tarversion %{version}
+%define tarname Python-%{tarversion}
# the versions are autogenerated from pre_checkin.sh
# based on the current source tarball
-%define python_version 3.4
-
-%define python_version_abitag 34
-%define python_version_soname 3_4
+%define python_version 3.6
+%define python_version_abitag 36
+%define python_version_soname 3_6
%define sitedir %{_libdir}/python%{python_version}
-# three possible ABI kinds: m - pymalloc, d - debug build
-# see PEP 3149
-%define abi_kind m
+# three possible ABI kinds: m - pymalloc, d - debug build; see PEP 3149
+%define abi_kind m
# python ABI version - used in some file names
%define python_abi %{python_version}%{abi_kind}
# soname ABI tag defined in PEP 3149
-%define abi_tag %{python_version_abitag}%{abi_kind}
-
+%define abi_tag %{python_version_abitag}%{abi_kind}
+# version part of "libpython" package
%define so_version %{python_version_soname}%{abi_kind}1_0
# rpm and python have different ideas about what is an arch-dependent name, so:
%define archname %{_arch}
%endif
# our arm has Hardware-Floatingpoint
-%if %{_arch} == arm
-%define armsuffix hf
-%endif
+#%if %{_arch} == arm
+#%define armsuffix hf
+#%endif
# pyexpat.cpython-35m-x86_64-linux-gnu
# pyexpat.cpython-35m-powerpc64le-linux-gnu
# pyexpat.cpython-35m-armv7-linux-gnueabihf
-#%define dynlib() %{sitedir}/lib-dynload/%{1}.cpython-%{abi_tag}-%{archname}-%{_os}%{?_gnu}%{?armsuffix}.so
-%define dynlib() %{sitedir}/lib-dynload/%{1}.cpython-%{abi_tag}.so
+%define dynlib() %{sitedir}/lib-dynload/%{1}.cpython-%{abi_tag}-%{archname}-%{_os}%{?_gnu}.so
### COMMON-DEF-END ###
-
+#
+Name: python3
+Version: 3.6.3
+Release: 0
+Summary: Python 3 Interpreter
+License: Python-2.0
+Group: Development/Languages/Python
+Url: http://www.python.org/
+Source0: http://www.python.org/ftp/python/%{version}/%{tarname}.tar.xz
+#Source1: http://www.python.org/ftp/python/%{version}/%{tarname}.tar.xz.asc
+BuildRequires: automake
+BuildRequires: fdupes
+BuildRequires: gcc-c++
+BuildRequires: gdbm-devel
+BuildRequires: gettext-tools
+BuildRequires: gmp-devel
+BuildRequires: intltool
+BuildRequires: bzip2-devel
+BuildRequires: libexpat-devel
+BuildRequires: libffi-devel
+#BuildRequires: libnsl-devel
+BuildRequires: lzma-devel
+BuildRequires: ncurses-devel
+#BuildRequires: netcfg
+BuildRequires: openssl-devel
+BuildRequires: pkgconfig
+BuildRequires: readline-devel
+BuildRequires: sqlite-devel
+#BuildRequires: tk-devel
+BuildRequires: xz
+#BuildRequires: pkgconfig(x11)
+Requires: python3-base = %{version}
+Recommends: python3-curses
+Recommends: python3-dbm
+Recommends: python3-idle
+Recommends: python3-pip
+#Recommends: python3-tk
# some compatibility Provides
#Provides: python = %{python_version}
Provides: python3 = %{python_version}
Provides: python3-xml = %{version}
Obsoletes: python3-xml < %{version}
+#
+# do not add patches here, please edit python3-base.spec instead
+# and run pre_checkin.sh
+#
+# see PACKAGING-NOTES for details
+#
+
%description
Python 3 is modern interpreted, object-oriented programming language,
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.
+
+This package supplies rich command line features provided by readline,
+XML processing tools, "ensurepip" installer, and sqlite3 support for
+the interpreter core, thus forming a so called "extended" runtime.
+Installing "python3" is sufficient for the vast majority of usecases.
+In addition, recommended packages provide UI toolkit support (python3-curses,
+python3-tk), legacy UNIX database bindings (python3-dbm), and the IDLE
+development environment (python3-idle).
+
+%package tk
+Summary: TkInter - Python Tk Interface
+Group: Development/Libraries/Python
+Requires: %{name} = %{version}
+%description tk
+Python interface to Tk. Tk is the GUI toolkit that comes with Tcl. The
+"xrpm" package uses this Python interface.
%package curses
-Requires: %{name} = %{version}
Summary: Python Interface to the (N)Curses Library
Group: Development/Libraries/Python
+Requires: %{name} = %{version}
%description curses
An easy to use interface to the (n)curses CUI library. CUI stands for
Console User Interface.
+#%package dbm
+#Summary: Python Interface to the GDBM Library
+#Group: Development/Languages/Python
+#Requires: %{name} = %{version}
+
+#%description dbm
+#An easy to use interface for Unix DBM databases, and more specifically,
+#the GNU implementation GDBM.
%prep
%setup -q -n %{tarname}
# fix shebangs - convert /usr/local/bin/python and /usr/bin/env/python to /usr/bin/python3
for dir in Lib Tools; do
# find *.py, filter to files that contain bad shebangs
+ # break up "/""usr" like this to prevent replacing with %{_prefix}
find $dir -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@'
+ | xargs -0 grep -lE '^#! *(/''usr/.*bin/(env +)?)?python' \
+ | xargs sed -r -i -e '1s@^#![[:space:]]*(/''usr/(local/)?bin/(env +)?)?python([0-9]+(\.[0-9]+)?)?@#!%{_bindir}/python3@'
done
+# drop in-tree libffi and expat
+rm -r Modules/_ctypes/libffi* Modules/_ctypes/darwin
+rm -r Modules/expat
+
+# drop duplicate README from site-packages
+rm Lib/site-packages/README.txt
+
### COMMON-PREP-END ###
%build
-export SUSE_ASNEEDED=0
-export OPT="%{optflags} -DOPENSSL_LOAD_CONF"
+### COMMON-CONFIG-BEGIN ###
+# use rpm_opt_flags
+export OPT="%{optflags} -DOPENSSL_LOAD_CONF $(pkg-config --cflags-only-I libffi)"
+
+touch -r %{SOURCE0} Makefile.pre.in
-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 Objects/typeslots.inc
+autoreconf -fi
-./configure \
+%if 0%{?sles_version}
+sed -e 's/-fprofile-correction//' -i Makefile.pre.in
+%endif
+
+%configure \
--prefix=%{_prefix} \
--libdir=%{_libdir} \
--mandir=%{_mandir} \
--enable-ipv6 \
--with-fpectl \
--enable-shared \
+ --with-ensurepip=no \
--with-system-ffi \
--with-system-expat \
- --with-ensurepip=no \
+ --enable-lto \
--enable-loadable-sqlite-extensions
-make %{?_smp_mflags} BASE_LIB=%{_lib}
+# prevent make from trying to rebuild PYTHON_FOR_GEN stuff
+make -t Python/Python-ast.c \
+ Include/Python-ast.h \
+ Objects/typeslots.inc \
+ Python/opcode_targets.h \
+ Include/opcode.h
+
+### COMMON-CONFIG-END ###
+
+make %{?_smp_mflags}
%check
# Limit virtual memory to avoid spurious failures
# only test the parts skipped in python3-base
TESTS="test_curses test_dbm_gnu test_dbm_ndbm test_idle \
- test_readline test_sqlite test_ssl test_tcl \
+ test_readline test_sqlite test_tcl test_tix test_tk \
test_ttk_textonly"
# redo tests with SSL parts
-TESTS="$TESTS test_asyncio test_hashlib test_urllib test_httplib \
- test_imaplib test_ftplib test_urllib2_localnet test_nntplib"
+%if !0%{?qemu_user_space_build}
+TESTS="$TESTS test_asyncio"
+%endif
-# ensurepip-based tests
-TESTS="$TESTS test_venv test_ensurepip test_tools"
+# XML tests
+TESTS="$TESTS test_docxmlrpc test_minidom test_pulldom test_pyexpat \
+ test_xml_etree test_xml_etree_c test_xmlrpc test_xmlrpc_net"
+# XML-dependent tests
+TESTS="$TESTS test_plistlib test_venv \
+ test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_spawn"
-make test TESTOPTS="-u curses $TESTS"
+make -j1 test TESTOPTS="-u curses $TESTS"
%install
rm -rf $RPM_BUILD_ROOT
make \
OPT="%{optflags} -fPIC" \
- DESTDIR=$RPM_BUILD_ROOT \
+ DESTDIR=%{buildroot} \
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 %{buildroot}%{_bindir}/*
+rm %{buildroot}%{_libdir}/lib*
+rm -r %{buildroot}%{_libdir}/pkgconfig
+rm -r %{buildroot}%{_mandir}/*
+rm -r %{buildroot}%{_includedir}/*
-rm -rf $RPM_BUILD_ROOT%{sitedir}/config*
-find $RPM_BUILD_ROOT%{sitedir} -name "*.egg-info" -exec rm -f {} ";"
-rm -rf $RPM_BUILD_ROOT%{sitedir}/__pycache__
-rm -rf $RPM_BUILD_ROOT%{sitedir}/site-packages
-rm $RPM_BUILD_ROOT%{sitedir}/*.*
+rm -r %{buildroot}%{sitedir}/config*
+find %{buildroot}%{sitedir} -name "*.egg-info" -exec rm {} ";"
+rm -r %{buildroot}%{sitedir}/__pycache__
+rm -r %{buildroot}%{sitedir}/site-packages
+rm %{buildroot}%{sitedir}/*.*
for module in \
asyncio ctypes collections concurrent distutils email encodings \
html http \
- importlib json logging multiprocessing plat-* pydoc_data unittest \
+ importlib json logging multiprocessing pydoc_data unittest \
urllib venv wsgiref lib2to3 test idlelib turtledemo
do
- rm -rf $RPM_BUILD_ROOT%{sitedir}/$module
+ rm -r %{buildroot}%{sitedir}/$module
done
for library in \
- array audioop binascii _bisect _bz2 cmath _codecs_* _crypt _csv \
- _ctypes _datetime _decimal _elementtree fcntl grp _heapq _json _lsprof \
+ array _asyncio audioop binascii _bisect _bz2 cmath _codecs_* _crypt _csv \
+ _ctypes _datetime _decimal fcntl grp _hashlib _heapq _json _lsprof \
_lzma math mmap _multibytecodec _multiprocessing nis _opcode ossaudiodev \
- parser _pickle _posixsubprocess _random resource select _socket spwd \
+ parser _pickle _posixsubprocess _random resource select _ssl _socket spwd \
_struct syslog termios _testbuffer _testimportmultiple _testmultiphase \
unicodedata zlib _ctypes_test _testcapi xxlimited \
- _md5 _sha1 _sha256 _sha512
+ _md5 _sha1 _sha256 _sha512 _blake2 _sha3
do
- eval rm -f "$RPM_BUILD_ROOT%{sitedir}/lib-dynload/$library.*"
+ eval rm "%{buildroot}%{sitedir}/lib-dynload/$library.*"
done
rm -rf $RPM_BUILD_ROOT%{sitedir}/tkinter
rm -rf $RPM_BUILD_ROOT%{sitedir}/dbm
rm -f $RPM_BUILD_ROOT%{sitedir}/lib-dynload/_gdbm.*
-%fdupes $RPM_BUILD_ROOT/%{_libdir}/python%{python_version}
+%fdupes %{buildroot}/%{_libdir}/python%{python_version}
#%files tk
#%defattr(644, root, root, 755)
%files curses
%defattr(644, root, root, 755)
+%license LICENSE
%{sitedir}/curses
%{dynlib _curses}
%{dynlib _curses_panel}
#%files dbm
#%defattr(644, root, root, 755)
+#%license LICENSE
#%{sitedir}/dbm
#%{dynlib _dbm}
#%{dynlib _gdbm}
%defattr(644, root, root, 755)
%dir %{sitedir}
%dir %{sitedir}/lib-dynload
+%license LICENSE
%{sitedir}/ensurepip
%{sitedir}/sqlite3
%exclude %{sitedir}/sqlite3/test
%{sitedir}/xml
%{sitedir}/xmlrpc
-%{dynlib _hashlib}
+%{dynlib _elementtree}
%{dynlib pyexpat}
%{dynlib readline}
%{dynlib _sqlite3}
-%{dynlib _ssl}
-%{dynlib time}
%changelog
+