File python36.spec of Package python36.30826
#
# spec file for package python36
#
# Copyright (c) 2020 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
# do not add defs here, please edit python36-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.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_major 1
%define so_minor 0
%define so_version %{python_version_soname}%{abi_kind}%{so_major}_%{so_minor}
# 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}%{?armsuffix}.so
### COMMON-DEF-END ###
#
Name: python36
Version: 3.6.10
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
Source20: idle36.desktop
Source21: idle36.appdata.xml
BuildRequires: automake
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: gdbm-devel
BuildRequires: gettext-tools
BuildRequires: gmp-devel
BuildRequires: intltool
BuildRequires: libbz2-devel
BuildRequires: libexpat-devel
BuildRequires: libffi-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)
# required for idle36 (.desktop and .appdata.xml files)
BuildRequires: update-desktop-files
Requires: python36-base = %{version}
Recommends: python36-curses
Recommends: python36-dbm
Recommends: python36-pip
Provides: python = %{python_version}
#
# do not add patches here, please edit python36-base.spec instead
# and run pre_checkin.sh
#
# see PACKAGING-NOTES for details
#
### COMMON-PATCH-BEGIN ###
# implement "--record-rpm" option for distutils installations
Patch01: Python-3.0b1-record-rpm.patch
# support lib-vs-lib64 distinction
Patch02: python-3.6.0-multilib-new.patch
# support finding packages in /usr/local, install to /usr/local by default
Patch04: python-3.3.0b1-localpath.patch
# PATCH-FEATURE-UPSTREAM pep538_coerce_legacy_c_locale.patch bpo#28180 mcepl@suse.com
# This patches coerces locale to be C.UTF-8 irrespective to the system locale
Patch05: pep538_coerce_legacy_c_locale.patch
# replace DATE, TIME and COMPILER by fixed definitions to aid reproducible builds
Patch06: python-3.3.0b1-fix_date_time_compiler.patch
# fix wrong include path in curses-panel module
Patch07: python-3.3.0b1-curses-panel.patch
# POSIX_FADV_WILLNEED throws EINVAL. Use a different constant in test
Patch09: python-3.3.0b1-test-posix_fadvise.patch
# Disable global and distutils sysconfig comparison test, we deviate from the default depending on optflags
Patch12: python-3.3.3-skip-distutils-test_sysconfig_module.patch
# Raise timeout value for test_subprocess
Patch15: subprocess-raise-timeout.patch
# PATCH-FIX-UPSTREAM python-3.6-CVE-2017-18207.patch psimons@suse.com -- Add check for channels of wav file in Lib/wave.py
# Suggested in https://github.com/python/cpython/pull/4437.
Patch20: python-3.6-CVE-2017-18207.patch
# PATCH-FIX-UPSTREAM bmwiedemann@suse.de -- https://github.com/python/cpython/pull/296
Patch21: 0001-allow-for-reproducible-builds-of-python-packages.patch
# PATCH-FEATURE-OPENSUSE order files for compilation until the underlying cause of bsc#1049186 is resolved
Patch22: distutils-reproducible-compile.patch
# skip some tests only for PowerPC
Patch23: skip_random_failing_tests.patch
# PATCH-FIX-UPSTREAM sorted tar https://github.com/python/cpython/pull/2263
Patch24: python3-sorted_tar.patch
# PATCH-FIX-UPSTREAM bpo23395-PyErr_SetInterrupt-signal.patch boo#1094814 mcepl@suse.com
# handle situation when the SIGINT signal is ignored or not handled
Patch29: bpo23395-PyErr_SetInterrupt-signal.patch
# PATCH-FIX-OPENSUSE aarch64-prolong-timeout.patch bsc#1149121 mcepl@suse.com
# Our buildbots are apparently too busy on aarch64 to make time right
Patch30: aarch64-prolong-timeout.patch
# PATCH-FIX-UPSTREAM bpo-36576-skip_tests_for_OpenSSL-111.patch bsc#1149792 mcepl@suse.com
# Skip tests failing with OpenSSL 1.1.1
Patch32: bpo-36576-skip_tests_for_OpenSSL-111.patch
# PATCH-FIX-OPENSUSE bpo36263-Fix_hashlib_scrypt.patch boo#1151490 mcepl@suse.com
# There is a regression in OpenSSL, which causes bpo#36263, and until it
# is fixed in OpenSSL, we need to protect against it.
Patch33: bpo36263-Fix_hashlib_scrypt.patch
# PATCH-FIX-UPSTREAM CVE-2020-8492-urllib-ReDoS.patch bsc#1162367 mcepl@suse.com
# Fixes Python urrlib allowed an HTTP server to conduct Regular
# Expression Denial of Service (ReDoS)
Patch34: CVE-2020-8492-urllib-ReDoS.patch
# PATCH-FIX-UPSTREAM CVE-2019-9674-zip-bomb.patch bsc#1162825 mcepl@suse.com
# Improve documentation warning against the possible zip bombs
Patch35: CVE-2019-9674-zip-bomb.patch
# PATCH-FIX-UPSTREAM CVE-2019-18348-CRLF_injection_via_host_part.patch bsc#1155094
# disallow control characters in hostnames in httplib
Patch36: CVE-2019-18348-CRLF_injection_via_host_part.patch
# PATCH-FIX-UPSTREAM CVE-2023-40217-avoid-ssl-pre-close.patch gh#python/cpython#108315
Patch37: CVE-2023-40217-avoid-ssl-pre-close.patch
### COMMON-PATCH-END ###
%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 python36-doc
package.
This package supplies rich command line features provided by readline,
and sqlite3 support for the interpreter core, thus forming a so called
"extended" runtime.
Installing "python36" is sufficient for the vast majority of usecases.
In addition, recommended packages provide UI toolkit support (python36-curses,
python36-tk), legacy UNIX database bindings (python36-dbm), and the IDLE
development environment (python36-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
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.
%package -n python36-idle
Summary: An Integrated Development Environment for Python
Group: Development/Languages/Python
Requires: %{name} = %{version}
Requires: python36-tk
%description -n python36-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.
%prep
%setup -q -n %{tarname}
### COMMON-PREP-BEGIN ###
%patch01 -p1
%patch02 -p1
%patch04
%patch05 -p1
%patch06 -p1
%patch07
%patch09 -p1
%patch12 -p1
%patch15 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%ifarch ppc ppc64 ppc64le
%patch23 -p1
%endif
%patch24 -p1
%patch29 -p1
%patch30 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
# drop Autoconf version requirement
sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac
# fix shebangs - convert /usr/local/bin/python and /usr/bin/env/python to /usr/bin/python36
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]+)?)?@#!%{_bindir}/python36@'
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 -fwrapv $(pkg-config --cflags-only-I libffi) -DOPENSSL_NO_SSL2 -DOPENSSL_NO_SSL3"
touch -r %{SOURCE0} Makefile.pre.in
autoreconf -fvi
%if 0%{?sles_version}
sed -e 's/-fprofile-correction//' -i Makefile.pre.in
%endif
%configure \
--docdir=%{_docdir}/python \
--enable-ipv6 \
--with-fpectl \
--enable-shared \
--with-ensurepip=no \
--with-system-ffi \
--with-system-expat \
--enable-loadable-sqlite-extensions
# 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
# 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"
# we patch out the message to recommend zypper in and thus this would fail
EXCLUDE="$EXCLUDE test_pydoc"
%ifarch %{arm}
# test_multiprocessing_forkserver is racy
EXCLUDE="$EXCLUDE test_multiprocessing_forkserver"
%endif
%ifarch ppc ppc64 ppc64le
# exclue test_faulthandler due to bnc#831629
EXCLUDE="$EXCLUDE test_faulthandler"
%endif
# some tests break in QEMU
%if 0%{?qemu_user_space_build} > 0
EXCLUDE="$EXCLUDE test_asyncio 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
# 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 the uuid module.
EXCLUDE="$EXCLUDE test_uuid"
# These tests fails for SUSE_SLE-12-SP2_Update
EXCLUDE="$EXCLUDE test_minidom test_xml_etree test_xml_etree_c"
# Limit virtual memory to avoid spurious failures
if test $(ulimit -v) = unlimited || test $(ulimit -v) -gt 10000000; then
ulimit -v 10000000 || :
fi
make -j1 test TESTOPTS="-u curses -x $EXCLUDE"
# use network, be verbose:
#make test TESTOPTS="-l -u network -v"
%install
%make_install
# clean out stuff that is in python-base and subpackages
find %{buildroot}%{_bindir} -mindepth 1 -not -name "*idle*" -print -delete
rm %{buildroot}%{_libdir}/lib*
rm -r %{buildroot}%{_libdir}/pkgconfig
rm -r %{buildroot}%{_mandir}/*
rm -r %{buildroot}%{_includedir}/*
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 \
ensurepip html http \
importlib json logging multiprocessing pydoc_data unittest \
urllib venv wsgiref lib2to3 test turtledemo \
xml xmlrpc
do
rm -r %{buildroot}%{sitedir}/$module
done
for library in \
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 _ssl _socket spwd \
_struct syslog termios _testbuffer _testimportmultiple _testmultiphase \
unicodedata zlib _ctypes_test _testcapi xxlimited \
_elementtree pyexpat \
_md5 _sha1 _sha256 _sha512 _blake2 _sha3
do
eval rm "%{buildroot}%{sitedir}/lib-dynload/$library.*"
done
# Idle is not packaged in base due to the appstream-glib dependency
# move idle config into /etc
install -d -m 755 %{buildroot}%{_sysconfdir}/idle36
(
cd %{buildroot}/%{sitedir}/idlelib/
for file in *.def ; do
mv $file %{buildroot}%{_sysconfdir}/idle36/
ln -sf %{_sysconfdir}/idle36/$file %{buildroot}/%{sitedir}/idlelib/
done
)
# install idle icons
for size in 16 32 48 ; do
install -m 644 -D Lib/idlelib/Icons/idle_${size}.png \
%{buildroot}%{_datadir}/icons/hicolor/${size}x${size}/apps/idle.png
done
# install idle desktop file
install -m 644 -D -t %{buildroot}%{_datadir}/applications %{SOURCE20}
%suse_update_desktop_file idle36
install -m 644 -D -t %{buildroot}%{_datadir}/metainfo %{SOURCE21}
# rename binaries and manpage to *36 versions
mv -v %{buildroot}%{_bindir}/idle3{,6}
%fdupes %{buildroot}/%{_libdir}/python%{python_version}
%files tk
%defattr(644, root, root, 755)
%{sitedir}/tkinter
%exclude %{sitedir}/tkinter/test
%{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
%exclude %{sitedir}/sqlite3/test
%{dynlib readline}
%{dynlib _sqlite3}
%files idle
%defattr(644, root, root, 755)
%{sitedir}/idlelib
%dir %{_sysconfdir}/idle36
%config %{_sysconfdir}/idle36/*
%doc Lib/idlelib/NEWS.txt
%doc Lib/idlelib/README.txt
%doc Lib/idlelib/TODO.txt
%doc Lib/idlelib/extend.txt
%doc Lib/idlelib/ChangeLog
%{_bindir}/idle36
%{_datadir}/applications/idle36.desktop
%dir %{_datadir}/metainfo
%{_datadir}/metainfo/idle36.appdata.xml
%{_datadir}/icons/hicolor/*/apps/idle.png
%dir %{_datadir}/icons/hicolor
%dir %{_datadir}/icons/hicolor/16x16
%dir %{_datadir}/icons/hicolor/32x32
%dir %{_datadir}/icons/hicolor/48x48
%dir %{_datadir}/icons/hicolor/*/apps
%attr(755, root, root) %{_bindir}/idle%{python_version}
%changelog