Blame python3.5.spec

a8ffdf3
# ======================================================
a8ffdf3
# Conditionals and other variables controlling the build
a8ffdf3
# ======================================================
a8ffdf3
a8ffdf3
%global pybasever 3.5
a8ffdf3
a8ffdf3
# pybasever without the dot:
a8ffdf3
%global pyshortver 35
a8ffdf3
a8ffdf3
%global pylibdir %{_libdir}/python%{pybasever}
a8ffdf3
%global dynload_dir %{pylibdir}/lib-dynload
a8ffdf3
a8ffdf3
# SOABI is defined in the upstream configure.in from Python-3.2a2 onwards,
a8ffdf3
# for PEP 3149:
a8ffdf3
#   http://www.python.org/dev/peps/pep-3149/
a8ffdf3
a8ffdf3
# ("configure.in" became "configure.ac" in Python 3.3 onwards, and in
a8ffdf3
# backports)
a8ffdf3
a8ffdf3
# ABIFLAGS, LDVERSION and SOABI are in the upstream Makefile
a8ffdf3
# With Python 3.3, we lose the "u" suffix due to PEP 393
a8ffdf3
%global ABIFLAGS_optimized m
a8ffdf3
%global ABIFLAGS_debug     dm
a8ffdf3
a8ffdf3
%global LDVERSION_optimized %{pybasever}%{ABIFLAGS_optimized}
a8ffdf3
%global LDVERSION_debug     %{pybasever}%{ABIFLAGS_debug}
a8ffdf3
a8ffdf3
%global SOABI_optimized cpython-%{pyshortver}%{ABIFLAGS_optimized}-%{_arch}-linux%{_gnu}
a8ffdf3
%global SOABI_debug     cpython-%{pyshortver}%{ABIFLAGS_debug}-%{_arch}-linux%{_gnu}
a8ffdf3
a8ffdf3
# All bytecode files are now in a __pycache__ subdirectory, with a name
a8ffdf3
# reflecting the version of the bytecode (to permit sharing of python libraries
a8ffdf3
# between different runtimes)
a8ffdf3
# See http://www.python.org/dev/peps/pep-3147/
a8ffdf3
# For example,
a8ffdf3
#   foo/bar.py
a8ffdf3
# now has bytecode at:
a8ffdf3
#   foo/__pycache__/bar.cpython-35.pyc
a8ffdf3
#   foo/__pycache__/bar.cpython-35.pyo
a8ffdf3
%global bytecode_suffixes .cpython-35*.py?
a8ffdf3
a8ffdf3
# Python's configure script defines SOVERSION, and this is used in the Makefile
a8ffdf3
# to determine INSTSONAME, the name of the libpython DSO:
a8ffdf3
#   LDLIBRARY='libpython$(VERSION).so'
a8ffdf3
#   INSTSONAME="$LDLIBRARY".$SOVERSION
a8ffdf3
# We mirror this here in order to make it easier to add the -gdb.py hooks.
a8ffdf3
# (if these get out of sync, the payload of the libs subpackage will fail
a8ffdf3
# and halt the build)
a8ffdf3
%global py_SOVERSION 1.0
a8ffdf3
%global py_INSTSONAME_optimized libpython%{LDVERSION_optimized}.so.%{py_SOVERSION}
a8ffdf3
%global py_INSTSONAME_debug     libpython%{LDVERSION_debug}.so.%{py_SOVERSION}
a8ffdf3
08ffab1
%global with_debug_build 0
a8ffdf3
a8ffdf3
%global with_gdb_hooks 1
a8ffdf3
a8ffdf3
%global with_systemtap 1
a8ffdf3
a8ffdf3
# some arches don't have valgrind so we need to disable its support on them
65d04c0
%ifarch %{valgrind_arches}
a8ffdf3
%global with_valgrind 1
a8ffdf3
%else
a8ffdf3
%global with_valgrind 0
a8ffdf3
%endif
a8ffdf3
a8ffdf3
%global with_gdbm 1
a8ffdf3
a8ffdf3
# Change from yes to no to turn this off
a8ffdf3
%global with_computed_gotos yes
a8ffdf3
a8ffdf3
# Turn this to 0 to turn off the "check" phase:
a8ffdf3
%global run_selftest_suite 1
a8ffdf3
82af650
# Disable automatic bytecompilation. The python3 binary is not yet be
82af650
# available in /usr/bin when Python is built. Also, the bytecompilation fails
82af650
# on files that test invalid syntax.
82af650
%undefine py_auto_byte_compile
a8ffdf3
a8ffdf3
# ==================
a8ffdf3
# Top-level metadata
a8ffdf3
# ==================
12dd214
Name: python%{pybasever}
606c85e
Summary: Version %{pybasever} of the Python programming language
606c85e
URL: https://www.python.org/
606c85e
659f305
%global general_version %{pybasever}.9
fb10851
#global prerel ...
9aa8c49
%global upstream_version %{general_version}%{?prerel}
9aa8c49
Version: %{general_version}%{?prerel:~%{prerel}}
e31cf36
Release: 6%{?dist}
a8ffdf3
License: Python
a8ffdf3
0c847d2
# Whether to use RPM build wheels from the python-{pip,setuptools}-wheel package
0c847d2
# Uses upstream bundled prebuilt wheels otherwise
0c847d2
%bcond_without rpmwheels
a8ffdf3
a8ffdf3
# =======================
a8ffdf3
# Build-time requirements
a8ffdf3
# =======================
a8ffdf3
a8ffdf3
# (keep this list alphabetized)
a8ffdf3
a8ffdf3
BuildRequires: autoconf
a8ffdf3
BuildRequires: bluez-libs-devel
a8ffdf3
BuildRequires: bzip2
a8ffdf3
BuildRequires: bzip2-devel
a8ffdf3
a8ffdf3
# expat 2.1.0 added the symbol XML_SetHashSalt without bumping SONAME.  We use
a8ffdf3
# it (in pyexpat) in order to enable the fix in Python-3.2.3 for CVE-2012-0876:
a8ffdf3
BuildRequires: expat-devel >= 2.1.0
a8ffdf3
a8ffdf3
BuildRequires: findutils
a8ffdf3
BuildRequires: gcc-c++
a8ffdf3
%if %{with_gdbm}
a8ffdf3
BuildRequires: gdbm-devel
a8ffdf3
%endif
80530f1
BuildRequires: glibc-all-langpacks
a8ffdf3
BuildRequires: glibc-devel
a8ffdf3
BuildRequires: gmp-devel
606c85e
BuildRequires: gnupg2
a8ffdf3
BuildRequires: libffi-devel
a8ffdf3
BuildRequires: libGL-devel
a8ffdf3
BuildRequires: libX11-devel
a8ffdf3
BuildRequires: ncurses-devel
a8ffdf3
# workaround http://bugs.python.org/issue19804 (test_uuid requires ifconfig)
a8ffdf3
BuildRequires: net-tools
fc3d7ff
BuildRequires: openssl-devel
a8ffdf3
BuildRequires: pkgconfig
a8ffdf3
BuildRequires: readline-devel
a8ffdf3
BuildRequires: sqlite-devel
a8ffdf3
a8ffdf3
%if 0%{?with_systemtap}
a8ffdf3
BuildRequires: systemtap-sdt-devel
a8ffdf3
# (this introduces a dependency on "python", in that systemtap-sdt-devel's
a8ffdf3
# /usr/bin/dtrace is a python 2 script)
a8ffdf3
%global tapsetdir      /usr/share/systemtap/tapset
a8ffdf3
%endif # with_systemtap
a8ffdf3
a8ffdf3
BuildRequires: tar
a8ffdf3
BuildRequires: tcl-devel
a8ffdf3
BuildRequires: tix-devel
a8ffdf3
BuildRequires: tk-devel
a8ffdf3
a8ffdf3
%if 0%{?with_valgrind}
a8ffdf3
BuildRequires: valgrind-devel
a8ffdf3
%endif
a8ffdf3
a8ffdf3
BuildRequires: xz-devel
a8ffdf3
BuildRequires: zlib-devel
a8ffdf3
0c847d2
%if %{with rpmwheels}
0c847d2
BuildRequires: python-setuptools-wheel
0c847d2
BuildRequires: python-pip-wheel
0c847d2
%endif
0c847d2
b7f58ea
Requires:      expat >= 2.1.0
3f83550
3f83550
# Python 3 built with glibc >= 2.24.90-26 needs to require it (rhbz#1410644).
d5a4946
Requires: glibc%{?_isa} >= 2.24.90-26
3f83550
b7f58ea
BuildRequires: python-rpm-macros
a8ffdf3
12dd214
# Provide and obsolete the old python3X name
12dd214
Provides:  python%{pyshortver} = %{version}-%{release}
12dd214
Obsoletes: python%{pyshortver} < %{version}-%{release}
2cbb322
a8ffdf3
# =======================
a8ffdf3
# Source code and patches
a8ffdf3
# =======================
a8ffdf3
606c85e
Source0: %{url}ftp/python/%{general_version}/Python-%{upstream_version}.tar.xz
606c85e
Source1: %{url}ftp/python/%{general_version}/Python-%{upstream_version}.tar.xz.asc
606c85e
Source2: %{url}static/files/pubkeys.txt
a8ffdf3
a8ffdf3
# Supply an RPM macro "py_byte_compile" for the python3-devel subpackage
a8ffdf3
# to enable specfiles to selectively byte-compile individual files and paths
a8ffdf3
# with different Python runtimes as necessary:
a8ffdf3
Source3: macros.pybytecompile%{pybasever}
a8ffdf3
a8ffdf3
# Systemtap tapset to make it easier to use the systemtap static probes
a8ffdf3
# (actually a template; LIBRARY_PATH will get fixed up during install)
a8ffdf3
# Written by dmalcolm; not yet sent upstream
a8ffdf3
Source5: libpython.stp
a8ffdf3
a8ffdf3
# Example systemtap script using the tapset
a8ffdf3
# Written by wcohen, mjw, dmalcolm; not yet sent upstream
a8ffdf3
Source6: systemtap-example.stp
a8ffdf3
a8ffdf3
# Another example systemtap script that uses the tapset
a8ffdf3
# Written by dmalcolm; not yet sent upstream
a8ffdf3
Source7: pyfuntop.stp
a8ffdf3
a8ffdf3
# A simple script to check timestamps of bytecode files
a8ffdf3
# Run in check section with Python that is currently being built
af9b3e7
# Originally written by bkabrda
af9b3e7
Source8: check-pyc-timestamps.py
a8ffdf3
a8ffdf3
# Fixup distutils/unixccompiler.py to remove standard library path from rpath:
a8ffdf3
# Was Patch0 in ivazquez' python3000 specfile:
e32bdb1
Patch1: 00001-rpath.patch
a8ffdf3
a8ffdf3
# 00055 #
a8ffdf3
# Systemtap support: add statically-defined probe points
a8ffdf3
# Patch sent upstream as http://bugs.python.org/issue14776
a8ffdf3
# with some subsequent reworking to cope with LANG=C in an rpmbuild
a8ffdf3
# (where sys.getfilesystemencoding() == 'ascii')
a8ffdf3
Patch55: 00055-systemtap.patch
a8ffdf3
e592aed
# 00102 #
97e3884
# Only used when "%%{_lib}" == "lib64"
e592aed
Patch102: 00102-lib64.patch
a8ffdf3
a8ffdf3
# 00111 #
a8ffdf3
# Patch the Makefile.pre.in so that the generated Makefile doesn't try to build
a8ffdf3
# a libpythonMAJOR.MINOR.a (bug 550692):
a8ffdf3
# Downstream only: not appropriate for upstream
a8ffdf3
Patch111: 00111-no-static-lib.patch
a8ffdf3
a8ffdf3
# 00132 #
a8ffdf3
# Add non-standard hooks to unittest for use in the "check" phase below, when
a8ffdf3
# running selftests within the build:
a8ffdf3
#   @unittest._skipInRpmBuild(reason)
a8ffdf3
# for tests that hang or fail intermittently within the build environment, and:
a8ffdf3
#   @unittest._expectedFailureInRpmBuild
a8ffdf3
# for tests that always fail within the build environment
a8ffdf3
#
a8ffdf3
# The hooks only take effect if WITHIN_PYTHON_RPM_BUILD is set in the
a8ffdf3
# environment, which we set manually in the appropriate portion of the "check"
a8ffdf3
# phase below (and which potentially other python-* rpms could set, to reuse
a8ffdf3
# these unittest hooks in their own "check" phases)
a8ffdf3
Patch132: 00132-add-rpmbuild-hooks-to-unittest.patch
a8ffdf3
a8ffdf3
# 00137 #
a8ffdf3
# Some tests within distutils fail when run in an rpmbuild:
a8ffdf3
Patch137: 00137-skip-distutils-tests-that-fail-in-rpmbuild.patch
a8ffdf3
a8ffdf3
# 00143 #
a8ffdf3
# Fix the --with-tsc option on ppc64, and rework it on 32-bit ppc to avoid
a8ffdf3
# aliasing violations (rhbz#698726)
a8ffdf3
# Sent upstream as http://bugs.python.org/issue12872
a8ffdf3
Patch143: 00143-tsc-on-ppc.patch
a8ffdf3
a8ffdf3
# 00155 #
a8ffdf3
# Avoid allocating thunks in ctypes unless absolutely necessary, to avoid
a8ffdf3
# generating SELinux denials on "import ctypes" and "import uuid" when
a8ffdf3
# embedding Python within httpd (rhbz#814391)
a8ffdf3
Patch155: 00155-avoid-ctypes-thunks.patch
a8ffdf3
a8ffdf3
# 00157 #
a8ffdf3
# Update uid/gid handling throughout the standard library: uid_t and gid_t are
a8ffdf3
# unsigned 32-bit values, but existing code often passed them through C long
a8ffdf3
# values, which are signed 32-bit values on 32-bit architectures, leading to
a8ffdf3
# negative int objects for uid/gid values >= 2^31 on 32-bit architectures.
a8ffdf3
#
a8ffdf3
# Introduce _PyObject_FromUid/Gid to convert uid_t/gid_t values to python
a8ffdf3
# objects, using int objects where the value will fit (long objects otherwise),
a8ffdf3
# and _PyArg_ParseUid/Gid to convert int/long to uid_t/gid_t, with -1 allowed
a8ffdf3
# as a special case (since this is given special meaning by the chown syscall)
a8ffdf3
#
a8ffdf3
# Update standard library to use this throughout for uid/gid values, so that
a8ffdf3
# very large uid/gid values are round-trippable, and -1 remains usable.
a8ffdf3
# (rhbz#697470)
a8ffdf3
Patch157: 00157-uid-gid-overflows.patch
a8ffdf3
a8ffdf3
# 00160 #
a8ffdf3
# Python 3.3 added os.SEEK_DATA and os.SEEK_HOLE, which may be present in the
a8ffdf3
# header files in the build chroot, but may not be supported in the running
a8ffdf3
# kernel, hence we disable this test in an rpm build.
a8ffdf3
# Adding these was upstream issue http://bugs.python.org/issue10142
a8ffdf3
# Not yet sent upstream
a8ffdf3
Patch160: 00160-disable-test_fs_holes-in-rpm-build.patch
a8ffdf3
a8ffdf3
# 00163 #
a8ffdf3
# Some tests within test_socket fail intermittently when run inside Koji;
a8ffdf3
# disable them using unittest._skipInRpmBuild
a8ffdf3
# Not yet sent upstream
a8ffdf3
Patch163: 00163-disable-parts-of-test_socket-in-rpm-build.patch
a8ffdf3
a8ffdf3
# 00170 #
a8ffdf3
# In debug builds, try to print repr() when a C-level assert fails in the
a8ffdf3
# garbage collector (typically indicating a reference-counting error
a8ffdf3
# somewhere else e.g in an extension module)
a8ffdf3
# Backported to 2.7 from a patch I sent upstream for py3k
a8ffdf3
#   http://bugs.python.org/issue9263  (rhbz#614680)
a8ffdf3
# hiding the proposed new macros/functions within gcmodule.c to avoid exposing
a8ffdf3
# them within the extension API.
a8ffdf3
# (rhbz#850013
a8ffdf3
Patch170: 00170-gc-assertions.patch
a8ffdf3
a8ffdf3
# 00178 #
a8ffdf3
# Don't duplicate various FLAGS in sysconfig values
a8ffdf3
# http://bugs.python.org/issue17679
a8ffdf3
# Does not affect python2 AFAICS (different sysconfig values initialization)
a8ffdf3
Patch178: 00178-dont-duplicate-flags-in-sysconfig.patch
a8ffdf3
a8ffdf3
# 00180 #
a8ffdf3
# Enable building on ppc64p7
a8ffdf3
# Not appropriate for upstream, Fedora-specific naming
a8ffdf3
Patch180: 00180-python-add-support-for-ppc64p7.patch
a8ffdf3
a8ffdf3
# 00186 #
a8ffdf3
# Fix for https://bugzilla.redhat.com/show_bug.cgi?id=1023607
a8ffdf3
# Previously, this fixed a problem where some *.py files were not being
a8ffdf3
# bytecompiled properly during build. This was result of py_compile.compile
a8ffdf3
# raising exception when trying to convert test file with bad encoding, and
a8ffdf3
# thus not continuing bytecompilation for other files.
a8ffdf3
# This was fixed upstream, but the test hasn't been merged yet, so we keep it
a8ffdf3
Patch186: 00186-dont-raise-from-py_compile.patch
a8ffdf3
a8ffdf3
# 00188 #
a8ffdf3
# Downstream only patch that should be removed when we compile all guaranteed
a8ffdf3
# hashlib algorithms properly. The problem is this:
a8ffdf3
# - during tests, test_hashlib is imported and executed before test_lib2to3
a8ffdf3
# - if at least one hash function has failed, trying to import it triggers an
a8ffdf3
#   exception that is being caught and exception is logged:
a8ffdf3
#   http://hg.python.org/cpython/file/2de806c8b070/Lib/hashlib.py#l217
a8ffdf3
# - logging the exception makes logging module run basicConfig
a8ffdf3
# - when lib2to3 tests are run again, lib2to3 runs basicConfig again, which
a8ffdf3
#   doesn't do anything, because it was run previously
a8ffdf3
#   (logging.root.handlers != []), which means that the default setup
a8ffdf3
#   (most importantly logging level) is not overriden. That means that a test
a8ffdf3
#   relying on this will fail (test_filename_changing_on_output_single_dir)
a8ffdf3
Patch188: 00188-fix-lib2to3-tests-when-hashlib-doesnt-compile-properly.patch
a8ffdf3
0c847d2
# 00189 #
0c847d2
# Instead of bundled wheels, use our RPM packaged wheels from
0c847d2
# /usr/share/python-wheels
0c847d2
Patch189: 00189-use-rpm-wheels.patch
66ab813
# The following versions of setuptools/pip are bundled when this patch is not applied.
66ab813
# The versions are written in Lib/ensurepip/__init__.py, this patch removes them.
66ab813
# When the bundled setuptools/pip wheel is updated, the patch no longer applies cleanly.
66ab813
# In such cases, the patch needs to be amended and the versions updated here:
66ab813
%global pip_version 9.0.1
66ab813
%global setuptools_version 28.8.0
0c847d2
a8ffdf3
# 00205 #
a8ffdf3
# LIBPL variable in makefile takes LIBPL from configure.ac
a8ffdf3
# but the LIBPL variable defined there doesn't respect libdir macro
a8ffdf3
Patch205: 00205-make-libpl-respect-lib64.patch
a8ffdf3
a8ffdf3
# 00206 #
a8ffdf3
# Remove hf flag from arm triplet which is used
a8ffdf3
# by debian but fedora infra uses only eabi without hf
a8ffdf3
Patch206: 00206-remove-hf-from-arm-triplet.patch
a8ffdf3
90c54fb
# 00243 #
a8ffdf3
# Fix the triplet used on 64-bit MIPS
a8ffdf3
# rhbz#1322526: https://bugzilla.redhat.com/show_bug.cgi?id=1322526
a8ffdf3
# Upstream uses Debian-like style mips64-linux-gnuabi64
a8ffdf3
# Fedora needs the default mips64-linux-gnu
90c54fb
Patch243: 00243-fix-mips64-triplet.patch
a8ffdf3
ff4d630
# 00264 #
ff4d630
# test_pass_by_value was added in Python 3.5.4 and on aarch64
ff4d630
# it is catching an error that was there, but wasn't tested before.
ff4d630
# Since the Python 3.5 branch is on security bug fix mode only
ff4d630
# we backport the fix from the master branch.
ff4d630
# Fixed upstream: http://bugs.python.org/issue29804
ff4d630
Patch264: 00264-fix-test-failing-on-aarch64.patch
9dab8a4
f83409d
# 00270 #
f83409d
# Fix test_alpn_protocols from test_ssl as openssl > 1.1.0f
f83409d
# changed the behaviour of the ALPN hook.
f83409d
# Fixed upstream: http://bugs.python.org/issue30714
f83409d
Patch270: 00270-fix-ssl-alpn-hook-test.patch
f83409d
ff4d630
# 00273 #
ff4d630
# Skip test_float_with_comma, which fails in Koji with UnicodeDecodeError
ff4d630
# See https://bugzilla.redhat.com/show_bug.cgi?id=1484497
ff4d630
# Reported upstream: https://bugs.python.org/issue31900
ff4d630
Patch273: 00273-skip-float-test.patch
ff4d630
56f993d
# 00290 #
56f993d
# Not every target system may provide a crypt() function in its stdlibc
56f993d
# and may use an external or replacement library, like libxcrypt, for
56f993d
# providing such functions.
7ee46fb
# Fixed upstream: https://bugs.python.org/issue32635
56f993d
Patch290: 00290-cryptmodule-Include-crypt.h-for-declaration-of-crypt.patch
56f993d
7c14b22
# 00315 #
7c14b22
# Fix mktime() error in test_email
7c14b22
# http://bugs.python.org/issue35317
7c14b22
# https://bugzilla.redhat.com/show_bug.cgi?id=1652843
7c14b22
Patch315: 00315-test_email-mktime.patch
7c14b22
Victor Stinner 9970557
# 00343 #
Victor Stinner 9970557
# bpo-38965: Fix faulthandler._stack_overflow() on GCC 10
Victor Stinner 9970557
# Fixed upstream and backported from the 3.7 branch:
Victor Stinner 9970557
# https://bugs.python.org/issue38965
Victor Stinner 9970557
# https://github.com/python/cpython/commit/f4a21d3b239bf4f4e4e2a8a5936b9b040645b246
Victor Stinner 9970557
#
Victor Stinner 9970557
# bpo-21131: Fix faulthandler.register(chain=True) stack (GH-15276)
Victor Stinner 9970557
# https://bugs.python.org/issue21131
Victor Stinner 9970557
# https://github.com/python/cpython/commit/ac827edc493d3ac3f5b9b0cc353df1d4b418a9aa
Victor Stinner 9970557
Patch343: 00343-faulthandler-gcc10.patch
Victor Stinner 9970557
0848610
# 00348 #
0848610
# bpo-34652: Always disable lchmod on Linux.
0848610
# Backport of commit, upstream is doing only security fixes for python35
0848610
# https://bugs.python.org/issue34652
0848610
# https://github.com/python/cpython/commit/40caa05fa4d1810a1a6bfc34e0ec930c351089b7
0848610
Patch348: 00348-always-disable-lchmod.patch
0848610
a8ffdf3
# (New patches go here ^^^)
a8ffdf3
#
90c54fb
# When adding new patches to "python" and "python3" in Fedora, EL, etc.,
90c54fb
# please try to keep the patch numbers in-sync between all specfiles.
a8ffdf3
#
90c54fb
# More information, and a patch number catalog, is at:
a8ffdf3
#
90c54fb
#     https://fedoraproject.org/wiki/SIGs/Python/PythonPatches
90c54fb
a8ffdf3
a8ffdf3
# add correct arch for ppc64/ppc64le
a8ffdf3
# it should be ppc64le-linux-gnu/ppc64-linux-gnu instead powerpc64le-linux-gnu/powerpc64-linux-gnu
a8ffdf3
Patch5001: python3-powerppc-arch.patch
a8ffdf3
a8ffdf3
a8ffdf3
# ======================================================
a8ffdf3
# Additional metadata, and subpackages
a8ffdf3
# ======================================================
a8ffdf3
b7f58ea
# We'll not provide this, on purpose
b7f58ea
# No package in Fedora shall ever depend on this
97e3884
# Provides: python(abi) = %%{pybasever}
8bdbc88
%global __requires_exclude ^python\\(abi\\) = 3\\..$
8bdbc88
%global __provides_exclude ^python\\(abi\\) = 3\\..$
a8ffdf3
0c847d2
%if %{with rpmwheels}
0c847d2
Requires: python-setuptools-wheel
0c847d2
Requires: python-pip-wheel
0c847d2
%else
66ab813
Provides: bundled(python3dist(pip)) = %{pip_version}
66ab813
Provides: bundled(python3dist(setuptools)) = %{setuptools_version}
0c847d2
%endif
c2323f2
a8ffdf3
%description
f375de3
Python %{pybasever} package for developers.
f375de3
bb42e73
This package exists to allow developers to test their code against an older
f375de3
version of Python. This is not a full Python stack and if you wish to run
bb42e73
your applications with Python %{pybasever}, see other distributions
bb42e73
that support it, such as CentOS or RHEL with Software Collections
bb42e73
or older Fedora releases.
a8ffdf3
a8ffdf3
a8ffdf3
# ======================================================
a8ffdf3
# The prep phase of the build:
a8ffdf3
# ======================================================
a8ffdf3
a8ffdf3
%prep
606c85e
%gpgverify -k2 -s1 -d0
9aa8c49
%setup -q -n Python-%{upstream_version}
a8ffdf3
a8ffdf3
%if 0%{?with_systemtap}
a8ffdf3
# Provide an example of usage of the tapset:
a8ffdf3
cp -a %{SOURCE6} .
a8ffdf3
cp -a %{SOURCE7} .
a8ffdf3
%endif # with_systemtap
a8ffdf3
a8ffdf3
# Ensure that we're using the system copy of various libraries, rather than
a8ffdf3
# copies shipped by upstream in the tarball:
a8ffdf3
#   Remove embedded copy of expat:
a8ffdf3
rm -r Modules/expat || exit 1
a8ffdf3
a8ffdf3
#   Remove embedded copy of libffi:
a8ffdf3
for SUBDIR in darwin libffi libffi_arm_wince libffi_msvc libffi_osx ; do
a8ffdf3
  rm -r Modules/_ctypes/$SUBDIR || exit 1 ;
a8ffdf3
done
a8ffdf3
a8ffdf3
#   Remove embedded copy of zlib:
a8ffdf3
rm -r Modules/zlib || exit 1
a8ffdf3
c632071
## Disabling hashlib patch for now as it needs to be reimplemented
c632071
## for OpenSSL 1.1.0.
a8ffdf3
# Don't build upstream Python's implementation of these crypto algorithms;
a8ffdf3
# instead rely on _hashlib and OpenSSL.
a8ffdf3
#
a8ffdf3
# For example, in our builds hashlib.md5 is implemented within _hashlib via
a8ffdf3
# OpenSSL (and thus respects FIPS mode), and does not fall back to _md5
a8ffdf3
# TODO: there seems to be no OpenSSL support in Python for sha3 so far
a8ffdf3
# when it is there, also remove _sha3/ dir
c632071
#for f in md5module.c sha1module.c sha256module.c sha512module.c; do
c632071
#    rm Modules/$f
c632071
#done
a8ffdf3
a8ffdf3
#
a8ffdf3
# Apply patches:
a8ffdf3
#
a8ffdf3
%patch1 -p1
a8ffdf3
a8ffdf3
%if 0%{?with_systemtap}
a8ffdf3
%patch55 -p1 -b .systemtap
a8ffdf3
%endif
a8ffdf3
a8ffdf3
%if "%{_lib}" == "lib64"
a8ffdf3
%patch102 -p1
a8ffdf3
%endif
a8ffdf3
%patch111 -p1
a8ffdf3
%patch132 -p1
a8ffdf3
%patch137 -p1
a8ffdf3
%patch143 -p1 -b .tsc-on-ppc
a8ffdf3
%patch155 -p1
a8ffdf3
%patch157 -p1
a8ffdf3
%patch160 -p1
a8ffdf3
%patch163 -p1
a8ffdf3
%patch170 -p0
a8ffdf3
%patch178 -p1
a8ffdf3
%patch180 -p1
a8ffdf3
%patch186 -p1
a8ffdf3
%patch188 -p1
0c847d2
0c847d2
%if %{with rpmwheels}
0c847d2
%patch189 -p1
0c847d2
rm Lib/ensurepip/_bundled/*.whl
0c847d2
rmdir Lib/ensurepip/_bundled
0c847d2
%endif
0c847d2
a8ffdf3
%patch205 -p1
a8ffdf3
%patch206 -p1
90c54fb
%patch243 -p1
ff4d630
%patch264 -p1
f83409d
%patch270 -p1
ff4d630
%patch273 -p1
56f993d
%patch290 -p1
7c14b22
%patch315 -p1
Victor Stinner 9970557
%patch343 -p1
0848610
%patch348 -p1
a8ffdf3
a8ffdf3
# Currently (2010-01-15), http://docs.python.org/library is for 2.6, and there
a8ffdf3
# are many differences between 2.6 and the Python 3 library.
a8ffdf3
#
a8ffdf3
# Fix up the URLs within pydoc to point at the documentation for this
a8ffdf3
# MAJOR.MINOR version:
a8ffdf3
#
a8ffdf3
sed --in-place \
a8ffdf3
    --expression="s|http://docs.python.org/library|http://docs.python.org/%{pybasever}/library|g" \
a8ffdf3
    Lib/pydoc.py || exit 1
a8ffdf3
a8ffdf3
%patch5001 -p1
a8ffdf3
a8ffdf3
# ======================================================
a8ffdf3
# Configuring and building the code:
a8ffdf3
# ======================================================
a8ffdf3
a8ffdf3
%build
a8ffdf3
topdir=$(pwd)
a8ffdf3
export CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC -fwrapv"
a8ffdf3
export CXXFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC -fwrapv"
a8ffdf3
export CPPFLAGS="`pkg-config --cflags-only-I libffi`"
a8ffdf3
export OPT="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC -fwrapv"
a8ffdf3
export LINKCC="gcc"
a8ffdf3
export CFLAGS="$CFLAGS `pkg-config --cflags openssl`"
a8ffdf3
export LDFLAGS="$RPM_LD_FLAGS `pkg-config --libs-only-L openssl`"
a8ffdf3
a8ffdf3
a8ffdf3
# Define a function, for how to perform a "build" of python for a given
a8ffdf3
# configuration:
a8ffdf3
BuildPython() {
a8ffdf3
  ConfName=$1
a8ffdf3
  BinaryName=$2
a8ffdf3
  SymlinkName=$3
a8ffdf3
  ExtraConfigArgs=$4
a8ffdf3
  PathFixWithThisBinary=$5
a8ffdf3
  MoreCFlags=$6
a8ffdf3
a8ffdf3
  ConfDir=build/$ConfName
a8ffdf3
a8ffdf3
  echo STARTING: BUILD OF PYTHON FOR CONFIGURATION: $ConfName - %{_bindir}/$BinaryName
a8ffdf3
  mkdir -p $ConfDir
a8ffdf3
a8ffdf3
  pushd $ConfDir
a8ffdf3
a8ffdf3
  # Use the freshly created "configure" script, but in the directory two above:
a8ffdf3
  %global _configure $topdir/configure
a8ffdf3
a8ffdf3
%configure \
a8ffdf3
  --enable-ipv6 \
a8ffdf3
  --enable-shared \
a8ffdf3
  --with-computed-gotos=%{with_computed_gotos} \
a8ffdf3
  --with-dbmliborder=gdbm:ndbm:bdb \
a8ffdf3
  --with-system-expat \
a8ffdf3
  --with-system-ffi \
a8ffdf3
  --enable-loadable-sqlite-extensions \
a8ffdf3
%if 0%{?with_systemtap}
a8ffdf3
  --with-systemtap \
a8ffdf3
%endif
a8ffdf3
%if 0%{?with_valgrind}
a8ffdf3
  --with-valgrind \
a8ffdf3
%endif
a8ffdf3
  $ExtraConfigArgs \
a8ffdf3
  %{nil}
a8ffdf3
a8ffdf3
  # Set EXTRA_CFLAGS to our CFLAGS (rather than overriding OPT, as we've done
a8ffdf3
  # in the past).
a8ffdf3
  # This should fix a problem with --with-valgrind where it adds
a8ffdf3
  #   -DDYNAMIC_ANNOTATIONS_ENABLED=1
a8ffdf3
  # to OPT which must be passed to all compilation units in the build,
a8ffdf3
  # otherwise leading to linker errors, e.g.
a8ffdf3
  #    missing symbol AnnotateRWLockDestroy
a8ffdf3
  #
a8ffdf3
  # Invoke the build:
a1e9ff3
  %make_build EXTRA_CFLAGS="$CFLAGS $MoreCFlags"
a8ffdf3
a8ffdf3
  popd
a8ffdf3
  echo FINISHED: BUILD OF PYTHON FOR CONFIGURATION: $ConfDir
a8ffdf3
}
a8ffdf3
a8ffdf3
# Use "BuildPython" to support building with different configurations:
a8ffdf3
a8ffdf3
%if 0%{?with_debug_build}
a8ffdf3
BuildPython debug \
a8ffdf3
  python-debug \
a8ffdf3
  python%{pybasever}-debug \
a8ffdf3
%ifarch %{ix86} x86_64 ppc %{power64}
8a7a7a7
  "--with-pydebug --with-tsc --without-ensurepip" \
a8ffdf3
%else
8a7a7a7
  "--with-pydebug --without-ensurepip" \
a8ffdf3
%endif
a8ffdf3
  false \
a8ffdf3
  -O0
a8ffdf3
%endif # with_debug_build
a8ffdf3
a8ffdf3
BuildPython optimized \
a8ffdf3
  python \
a8ffdf3
  python%{pybasever} \
9dab8a4
%ifarch %{ix86} x86_64
9dab8a4
  "--without-ensurepip --enable-optimizations" \
9dab8a4
%else
9dab8a4
   "--without-ensurepip" \
9dab8a4
%endif
a8ffdf3
  true
a8ffdf3
a8ffdf3
# ======================================================
a8ffdf3
# Installing the built code:
a8ffdf3
# ======================================================
a8ffdf3
a8ffdf3
%install
a8ffdf3
topdir=$(pwd)
a8ffdf3
rm -fr %{buildroot}
a8ffdf3
mkdir -p %{buildroot}%{_prefix} %{buildroot}%{_mandir}
a8ffdf3
a8ffdf3
InstallPython() {
a8ffdf3
a8ffdf3
  ConfName=$1
a8ffdf3
  PyInstSoName=$2
a8ffdf3
  MoreCFlags=$3
a8ffdf3
a8ffdf3
  ConfDir=build/$ConfName
a8ffdf3
a8ffdf3
  echo STARTING: INSTALL OF PYTHON FOR CONFIGURATION: $ConfName
a8ffdf3
  mkdir -p $ConfDir
a8ffdf3
a8ffdf3
  pushd $ConfDir
a8ffdf3
a1e9ff3
  %make_install EXTRA_CFLAGS="$MoreCFlags"
a8ffdf3
a8ffdf3
  popd
a8ffdf3
a8ffdf3
  # We install a collection of hooks for gdb that make it easier to debug
a8ffdf3
  # executables linked against libpython3* (such as /usr/bin/python3 itself)
a8ffdf3
  #
a8ffdf3
  # These hooks are implemented in Python itself (though they are for the version
a8ffdf3
  # of python that gdb is linked with, in this case Python 2.7)
a8ffdf3
  #
a8ffdf3
  # gdb-archer looks for them in the same path as the ELF file, with a -gdb.py suffix.
a8ffdf3
  # We put them in the debuginfo package by installing them to e.g.:
a8ffdf3
  #  /usr/lib/debug/usr/lib/libpython3.2.so.1.0.debug-gdb.py
a8ffdf3
  #
a8ffdf3
  # See https://fedoraproject.org/wiki/Features/EasierPythonDebugging for more
a8ffdf3
  # information
a8ffdf3
  #
a8ffdf3
  # Copy up the gdb hooks into place; the python file will be autoloaded by gdb
a8ffdf3
  # when visiting libpython.so, provided that the python file is installed to the
a8ffdf3
  # same path as the library (or its .debug file) plus a "-gdb.py" suffix, e.g:
a8ffdf3
  #  /usr/lib/debug/usr/lib64/libpython3.2.so.1.0.debug-gdb.py
a8ffdf3
  # (note that the debug path is /usr/lib/debug for both 32/64 bit)
a8ffdf3
  #
a8ffdf3
  # Initially I tried:
a8ffdf3
  #  /usr/lib/libpython3.1.so.1.0-gdb.py
a8ffdf3
  # but doing so generated noise when ldconfig was rerun (rhbz:562980)
a8ffdf3
  #
a8ffdf3
%if 0%{?with_gdb_hooks}
a8ffdf3
  DirHoldingGdbPy=%{_prefix}/lib/debug/%{_libdir}
a8ffdf3
  PathOfGdbPy=$DirHoldingGdbPy/$PyInstSoName.debug-gdb.py
a8ffdf3
a8ffdf3
  mkdir -p %{buildroot}$DirHoldingGdbPy
a8ffdf3
  cp Tools/gdb/libpython.py %{buildroot}$PathOfGdbPy
a8ffdf3
%endif # with_gdb_hooks
a8ffdf3
a8ffdf3
  echo FINISHED: INSTALL OF PYTHON FOR CONFIGURATION: $ConfName
a8ffdf3
}
a8ffdf3
a8ffdf3
# Use "InstallPython" to support building with different configurations:
a8ffdf3
a8ffdf3
# Install the "debug" build first, so that we can move some files aside
a8ffdf3
%if 0%{?with_debug_build}
a8ffdf3
InstallPython debug \
a8ffdf3
  %{py_INSTSONAME_debug} \
a8ffdf3
  -O0
a8ffdf3
%endif # with_debug_build
a8ffdf3
a8ffdf3
# Now the optimized build:
a8ffdf3
InstallPython optimized \
a8ffdf3
  %{py_INSTSONAME_optimized}
a8ffdf3
a8ffdf3
install -d -m 0755 ${RPM_BUILD_ROOT}%{pylibdir}/site-packages/__pycache__
a8ffdf3
a04dbe7
rm ${RPM_BUILD_ROOT}%{_bindir}/2to3
a8ffdf3
a8ffdf3
# Documentation tools
a8ffdf3
install -m755 -d %{buildroot}%{pylibdir}/Doc
a8ffdf3
cp -ar Doc/tools %{buildroot}%{pylibdir}/Doc/
a8ffdf3
a8ffdf3
# Fix for bug #136654
a8ffdf3
rm -f %{buildroot}%{pylibdir}/email/test/data/audiotest.au %{buildroot}%{pylibdir}/test/audiotest.au
a8ffdf3
a8ffdf3
%if "%{_lib}" == "lib64"
a8ffdf3
install -d -m 0755 %{buildroot}/%{_prefix}/lib/python%{pybasever}/site-packages/__pycache__
a8ffdf3
%endif
a8ffdf3
a8ffdf3
# Make python3-devel multilib-ready (bug #192747, #139911)
a8ffdf3
%global _pyconfig32_h pyconfig-32.h
a8ffdf3
%global _pyconfig64_h pyconfig-64.h
a8ffdf3
a8ffdf3
%ifarch %{power64} s390x x86_64 ia64 alpha sparc64 aarch64 %{mips64}
a8ffdf3
%global _pyconfig_h %{_pyconfig64_h}
a8ffdf3
%else
a8ffdf3
%global _pyconfig_h %{_pyconfig32_h}
a8ffdf3
%endif
a8ffdf3
a8ffdf3
# ABIFLAGS, LDVERSION and SOABI are in the upstream Makefile
a8ffdf3
%global ABIFLAGS_optimized m
a8ffdf3
%global ABIFLAGS_debug     dm
a8ffdf3
a8ffdf3
%global LDVERSION_optimized %{pybasever}%{ABIFLAGS_optimized}
a8ffdf3
%global LDVERSION_debug     %{pybasever}%{ABIFLAGS_debug}
a8ffdf3
a8ffdf3
%global SOABI_optimized cpython-%{pyshortver}%{ABIFLAGS_optimized}-%{_arch}-linux%{_gnu}
a8ffdf3
%global SOABI_debug     cpython-%{pyshortver}%{ABIFLAGS_debug}-%{_arch}-linux%{_gnu}
a8ffdf3
a8ffdf3
%if 0%{?with_debug_build}
a8ffdf3
%global PyIncludeDirs python%{LDVERSION_optimized} python%{LDVERSION_debug}
a8ffdf3
a8ffdf3
%else
a8ffdf3
%global PyIncludeDirs python%{LDVERSION_optimized}
a8ffdf3
%endif
a8ffdf3
a8ffdf3
for PyIncludeDir in %{PyIncludeDirs} ; do
a8ffdf3
  mv %{buildroot}%{_includedir}/$PyIncludeDir/pyconfig.h \
a8ffdf3
     %{buildroot}%{_includedir}/$PyIncludeDir/%{_pyconfig_h}
a8ffdf3
  cat > %{buildroot}%{_includedir}/$PyIncludeDir/pyconfig.h << EOF
a8ffdf3
#include <bits/wordsize.h>
a8ffdf3
a8ffdf3
#if __WORDSIZE == 32
a8ffdf3
#include "%{_pyconfig32_h}"
a8ffdf3
#elif __WORDSIZE == 64
a8ffdf3
#include "%{_pyconfig64_h}"
a8ffdf3
#else
a8ffdf3
#error "Unknown word size"
a8ffdf3
#endif
a8ffdf3
EOF
a8ffdf3
done
a8ffdf3
a8ffdf3
# Fix for bug 201434: make sure distutils looks at the right pyconfig.h file
a8ffdf3
# Similar for sysconfig: sysconfig.get_config_h_filename tries to locate
a8ffdf3
# pyconfig.h so it can be parsed, and needs to do this at runtime in site.py
a8ffdf3
# when python starts up (bug 653058)
a8ffdf3
#
a8ffdf3
# Split this out so it goes directly to the pyconfig-32.h/pyconfig-64.h
a8ffdf3
# variants:
a8ffdf3
sed -i -e "s/'pyconfig.h'/'%{_pyconfig_h}'/" \
a8ffdf3
  %{buildroot}%{pylibdir}/distutils/sysconfig.py \
a8ffdf3
  %{buildroot}%{pylibdir}/sysconfig.py
a8ffdf3
a8ffdf3
# Switch all shebangs to refer to the specific Python version.
a8ffdf3
LD_LIBRARY_PATH=./build/optimized ./build/optimized/python \
a8ffdf3
  Tools/scripts/pathfix.py \
d5dc5b2
  -i "%{_bindir}/python%{pybasever}" -p \
d5dc5b2
  %{buildroot} \
d5dc5b2
  %{?with_gdb_hooks:%{buildroot}$DirHoldingGdbPy/*.py}
a8ffdf3
a8ffdf3
# Remove shebang lines from .py files that aren't executable, and
a8ffdf3
# remove executability from .py files that don't have a shebang line:
a8ffdf3
find %{buildroot} -name \*.py \
a8ffdf3
  \( \( \! -perm /u+x,g+x,o+x -exec sed -e '/^#!/Q 0' -e 'Q 1' {} \; \
a8ffdf3
  -print -exec sed -i '1d' {} \; \) -o \( \
a8ffdf3
  -perm /u+x,g+x,o+x ! -exec grep -m 1 -q '^#!' {} \; \
a8ffdf3
  -exec chmod a-x {} \; \) \)
a8ffdf3
9828dfc
# Remove tests for tools, we don't ship those
9828dfc
rm -rf %{buildroot}%{pylibdir}/test/test_tools
9828dfc
a8ffdf3
# .xpm and .xbm files should not be executable:
a8ffdf3
find %{buildroot} \
a8ffdf3
  \( -name \*.xbm -o -name \*.xpm -o -name \*.xpm.1 \) \
a8ffdf3
  -exec chmod a-x {} \;
a8ffdf3
a8ffdf3
# Remove executable flag from files that shouldn't have it:
a8ffdf3
chmod a-x \
9828dfc
  %{buildroot}%{pylibdir}/distutils/tests/Setup.sample
a8ffdf3
a8ffdf3
# Get rid of DOS batch files:
a8ffdf3
find %{buildroot} -name \*.bat -exec rm {} \;
a8ffdf3
a8ffdf3
# Get rid of backup files:
a8ffdf3
find %{buildroot}/ -name "*~" -exec rm -f {} \;
a8ffdf3
find . -name "*~" -exec rm -f {} \;
a8ffdf3
# Junk, no point in putting in -test sub-pkg
a8ffdf3
rm -f ${RPM_BUILD_ROOT}/%{pylibdir}/idlelib/testcode.py*
a8ffdf3
a8ffdf3
# Get rid of stray patch file from buildroot:
a8ffdf3
rm -f %{buildroot}%{pylibdir}/test/test_imp.py.apply-our-changes-to-expected-shebang # from patch 4
a8ffdf3
a8ffdf3
# Fix end-of-line encodings:
a8ffdf3
find %{buildroot}/ -name \*.py -exec sed -i 's/\r//' {} \;
a8ffdf3
a8ffdf3
# Fix an encoding:
a8ffdf3
iconv -f iso8859-1 -t utf-8 %{buildroot}/%{pylibdir}/Demo/rpc/README > README.conv && mv -f README.conv %{buildroot}/%{pylibdir}/Demo/rpc/README
a8ffdf3
a8ffdf3
# Note that
a8ffdf3
#  %{pylibdir}/Demo/distutils/test2to3/setup.py
a8ffdf3
# is in iso-8859-1 encoding, and that this is deliberate; this is test data
a8ffdf3
# for the 2to3 tool, and one of the functions of the 2to3 tool is to fixup
a8ffdf3
# character encodings within python source code
a8ffdf3
a8ffdf3
# Do bytecompilation with the newly installed interpreter.
a8ffdf3
# This is similar to the script in macros.pybytecompile
a8ffdf3
# compile *.pyc
a8ffdf3
find %{buildroot} -type f -a -name "*.py" -print0 | \
a8ffdf3
    LD_LIBRARY_PATH="%{buildroot}%{dynload_dir}/:%{buildroot}%{_libdir}" \
a8ffdf3
    PYTHONPATH="%{buildroot}%{_libdir}/python%{pybasever} %{buildroot}%{_libdir}/python%{pybasever}/site-packages" \
b54c87b
    xargs -0 %{buildroot}%{_bindir}/python%{pybasever} -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("%{buildroot}")[2], optimize=opt) for opt in range(3) for f in sys.argv[1:]]' || :
a8ffdf3
a8ffdf3
# Fixup permissions for shared libraries from non-standard 555 to standard 755:
a8ffdf3
find %{buildroot} \
a8ffdf3
    -perm 555 -exec chmod 755 {} \;
a8ffdf3
a8ffdf3
# Install macros for rpm:
a8ffdf3
mkdir -p %{buildroot}/%{_rpmconfigdir}/macros.d/
a8ffdf3
install -m 644 %{SOURCE3} %{buildroot}/%{_rpmconfigdir}/macros.d/
a8ffdf3
a8ffdf3
# Ensure that the curses module was linked against libncursesw.so, rather than
a8ffdf3
# libncurses.so (bug 539917)
a8ffdf3
ldd %{buildroot}/%{dynload_dir}/_curses*.so \
a8ffdf3
    | grep curses \
a8ffdf3
    | grep libncurses.so && (echo "_curses.so linked against libncurses.so" ; exit 1)
a8ffdf3
a8ffdf3
# Ensure that the debug modules are linked against the debug libpython, and
a8ffdf3
# likewise for the optimized modules and libpython:
a8ffdf3
for Module in %{buildroot}/%{dynload_dir}/*.so ; do
a8ffdf3
    case $Module in
a8ffdf3
    *.%{SOABI_debug})
a8ffdf3
        ldd $Module | grep %{py_INSTSONAME_optimized} &&
a8ffdf3
            (echo Debug module $Module linked against optimized %{py_INSTSONAME_optimized} ; exit 1)
a8ffdf3
a8ffdf3
        ;;
a8ffdf3
    *.%{SOABI_optimized})
a8ffdf3
        ldd $Module | grep %{py_INSTSONAME_debug} &&
a8ffdf3
            (echo Optimized module $Module linked against debug %{py_INSTSONAME_debug} ; exit 1)
a8ffdf3
        ;;
a8ffdf3
    esac
a8ffdf3
done
a8ffdf3
a8ffdf3
#
a8ffdf3
# Systemtap hooks:
a8ffdf3
#
a8ffdf3
%if 0%{?with_systemtap}
a8ffdf3
# Install a tapset for this libpython into tapsetdir, fixing up the path to the
a8ffdf3
# library:
a8ffdf3
mkdir -p %{buildroot}%{tapsetdir}
a8ffdf3
%ifarch %{power64} s390x x86_64 ia64 alpha sparc64 aarch64 %{mips64}
a8ffdf3
%global libpython_stp_optimized libpython%{pybasever}-64.stp
a8ffdf3
%global libpython_stp_debug     libpython%{pybasever}-debug-64.stp
a8ffdf3
%else
a8ffdf3
%global libpython_stp_optimized libpython%{pybasever}-32.stp
a8ffdf3
%global libpython_stp_debug     libpython%{pybasever}-debug-32.stp
a8ffdf3
%endif
a8ffdf3
a8ffdf3
sed \
a8ffdf3
   -e "s|LIBRARY_PATH|%{_libdir}/%{py_INSTSONAME_optimized}|" \
a8ffdf3
   %{_sourcedir}/libpython.stp \
a8ffdf3
   > %{buildroot}%{tapsetdir}/%{libpython_stp_optimized}
a8ffdf3
a8ffdf3
%if 0%{?with_debug_build}
a8ffdf3
# In Python 3, python3 and python3-debug don't point to the same binary,
a8ffdf3
# so we have to replace "python3" with "python3-debug" to get systemtap
a8ffdf3
# working with debug build
a8ffdf3
sed \
a8ffdf3
   -e "s|LIBRARY_PATH|%{_libdir}/%{py_INSTSONAME_debug}|" \
a8ffdf3
   -e 's|"python3"|"python3-debug"|' \
a8ffdf3
   %{_sourcedir}/libpython.stp \
a8ffdf3
   > %{buildroot}%{tapsetdir}/%{libpython_stp_debug}
a8ffdf3
%endif # with_debug_build
a8ffdf3
a8ffdf3
%endif # with_systemtap
a8ffdf3
a8ffdf3
# Rename the script that differs on different arches to arch specific name
a8ffdf3
mv %{buildroot}%{_bindir}/python%{LDVERSION_optimized}-{,`uname -m`-}config
a8ffdf3
echo -e '#!/bin/sh\nexec `dirname $0`/python%{LDVERSION_optimized}-`uname -m`-config "$@"' > \
a8ffdf3
  %{buildroot}%{_bindir}/python%{LDVERSION_optimized}-config
a8ffdf3
echo '[ $? -eq 127 ] && echo "Could not find python%{LDVERSION_optimized}-`uname -m`-config. Look around to see available arches." >&2' >> \
a8ffdf3
  %{buildroot}%{_bindir}/python%{LDVERSION_optimized}-config
a8ffdf3
  chmod +x %{buildroot}%{_bindir}/python%{LDVERSION_optimized}-config
a8ffdf3
50f1f6a
# Remove stuff that would conflict with python3 package
50f1f6a
mv %{buildroot}%{_bindir}/python{3,%{pyshortver}}
50f1f6a
rm %{buildroot}%{_bindir}/*3
50f1f6a
rm %{buildroot}%{_bindir}/python3-*
50f1f6a
rm %{buildroot}%{_bindir}/pyvenv
50f1f6a
rm %{buildroot}%{_libdir}/libpython3.so
50f1f6a
rm %{buildroot}%{_mandir}/man1/python3.1*
50f1f6a
rm %{buildroot}%{_libdir}/pkgconfig/python3.pc
50f1f6a
a8ffdf3
# ======================================================
a8ffdf3
# Running the upstream test suite
a8ffdf3
# ======================================================
a8ffdf3
a8ffdf3
%check
a8ffdf3
a8ffdf3
# first of all, check timestamps of bytecode files
a8ffdf3
find %{buildroot} -type f -a -name "*.py" -print0 | \
a8ffdf3
    LD_LIBRARY_PATH="%{buildroot}%{dynload_dir}/:%{buildroot}%{_libdir}" \
a8ffdf3
    PYTHONPATH="%{buildroot}%{_libdir}/python%{pybasever} %{buildroot}%{_libdir}/python%{pybasever}/site-packages" \
a8ffdf3
    xargs -0 %{buildroot}%{_bindir}/python%{pybasever} %{SOURCE8}
a8ffdf3
a8ffdf3
# For ppc64 we need a larger stack than default (rhbz#1292462)
a8ffdf3
%ifarch %{power64}
a8ffdf3
  ulimit -a
a8ffdf3
  ulimit -s 16384
a8ffdf3
%endif
a8ffdf3
a8ffdf3
topdir=$(pwd)
a8ffdf3
CheckPython() {
a8ffdf3
  ConfName=$1
a8ffdf3
  ConfDir=$(pwd)/build/$ConfName
a8ffdf3
a8ffdf3
  echo STARTING: CHECKING OF PYTHON FOR CONFIGURATION: $ConfName
a8ffdf3
a8ffdf3
  # Note that we're running the tests using the version of the code in the
a8ffdf3
  # builddir, not in the buildroot.
a8ffdf3
a8ffdf3
  # Run the upstream test suite, setting "WITHIN_PYTHON_RPM_BUILD" so that the
a8ffdf3
  # our non-standard decorators take effect on the relevant tests:
a8ffdf3
  #   @unittest._skipInRpmBuild(reason)
a8ffdf3
  #   @unittest._expectedFailureInRpmBuild
a8ffdf3
  # test_faulthandler.test_register_chain currently fails on ppc64le and
a8ffdf3
  #   aarch64, see upstream bug http://bugs.python.org/issue21131
a8ffdf3
  WITHIN_PYTHON_RPM_BUILD= \
a8ffdf3
  LD_LIBRARY_PATH=$ConfDir $ConfDir/python -m test.regrtest \
a8ffdf3
    --verbose --findleaks \
a8ffdf3
    -x test_distutils \
a8ffdf3
    %ifarch ppc64le aarch64
a8ffdf3
    -x test_faulthandler \
a8ffdf3
    %endif
a8ffdf3
    %ifarch %{mips64}
a8ffdf3
    -x test_ctypes \
a8ffdf3
    %endif
a8ffdf3
    %ifarch %{power64} s390 s390x armv7hl aarch64 %{mips}
05356b4
    -x test_gdb \
a8ffdf3
    %endif
a8ffdf3
a8ffdf3
  echo FINISHED: CHECKING OF PYTHON FOR CONFIGURATION: $ConfName
a8ffdf3
a8ffdf3
}
a8ffdf3
a8ffdf3
%if 0%{run_selftest_suite}
a8ffdf3
a8ffdf3
# Check each of the configurations:
a8ffdf3
%if 0%{?with_debug_build}
a8ffdf3
CheckPython debug
a8ffdf3
%endif # with_debug_build
a8ffdf3
CheckPython optimized
a8ffdf3
a8ffdf3
%endif # run_selftest_suite
a8ffdf3
a8ffdf3
a8ffdf3
%files
529acb4
%doc README
cb3ed8f
%doc Misc/README.valgrind Misc/valgrind-python.supp Misc/gdbinit
529acb4
%license %{pylibdir}/LICENSE.txt
cb3ed8f
50f1f6a
%{_bindir}/pydoc%{pybasever}
a8ffdf3
%{_bindir}/python%{pybasever}
50f1f6a
%{_bindir}/python%{pyshortver}
a8ffdf3
%{_bindir}/python%{pybasever}m
a8ffdf3
%{_bindir}/pyvenv-%{pybasever}
a8ffdf3
%{_mandir}/*/*
a8ffdf3
cb3ed8f
%{pylibdir}/
a8ffdf3
a8ffdf3
%if "%{_lib}" == "lib64"
a8ffdf3
%attr(0755,root,root) %dir %{_prefix}/lib/python%{pybasever}
a8ffdf3
%attr(0755,root,root) %dir %{_prefix}/lib/python%{pybasever}/site-packages
a8ffdf3
%attr(0755,root,root) %dir %{_prefix}/lib/python%{pybasever}/site-packages/__pycache__/
a8ffdf3
%endif
a8ffdf3
a8ffdf3
%{_libdir}/%{py_INSTSONAME_optimized}
a8ffdf3
%if 0%{?with_systemtap}
a8ffdf3
%dir %(dirname %{tapsetdir})
a8ffdf3
%dir %{tapsetdir}
a8ffdf3
%{tapsetdir}/%{libpython_stp_optimized}
a8ffdf3
%doc systemtap-example.stp pyfuntop.stp
a8ffdf3
%endif
a8ffdf3
cb3ed8f
%{_includedir}/python%{LDVERSION_optimized}/
cb3ed8f
a8ffdf3
%{_bindir}/python%{pybasever}-config
a8ffdf3
%{_bindir}/python%{LDVERSION_optimized}-config
a8ffdf3
%{_bindir}/python%{LDVERSION_optimized}-*-config
a8ffdf3
%{_libdir}/libpython%{LDVERSION_optimized}.so
a8ffdf3
%{_libdir}/pkgconfig/python-%{LDVERSION_optimized}.pc
a8ffdf3
%{_libdir}/pkgconfig/python-%{pybasever}.pc
cb3ed8f
%exclude %{_rpmconfigdir}/macros.d/macros.pybytecompile%{pybasever}
a8ffdf3
a8ffdf3
%{_bindir}/2to3-%{pybasever}
50f1f6a
%{_bindir}/idle%{pybasever}
a8ffdf3
9d5d442
# https://bugzilla.redhat.com/show_bug.cgi?id=1476593
9d5d442
%exclude /usr/lib/debug%{_libdir}/__pycache__/libpython%{pybasever}m.so.1.0.debug-gdb.cpython-%{pyshortver}.*py*
9d5d442
%exclude /usr/lib/debug%{_libdir}/libpython%{pybasever}m.so.1.0.debug-gdb.py
9d5d442
a8ffdf3
%if 0%{?with_debug_build}
a8ffdf3
%{_bindir}/python%{LDVERSION_debug}
a8ffdf3
a8ffdf3
%{_libdir}/%{py_INSTSONAME_debug}
a8ffdf3
%if 0%{?with_systemtap}
a8ffdf3
%{tapsetdir}/%{libpython_stp_debug}
a8ffdf3
%endif
a8ffdf3
a8ffdf3
%{_includedir}/python%{LDVERSION_debug}
a8ffdf3
%{_bindir}/python%{LDVERSION_debug}-config
a8ffdf3
%{_libdir}/libpython%{LDVERSION_debug}.so
a8ffdf3
%{_libdir}/libpython%{LDVERSION_debug}.so.1.0
a8ffdf3
%{_libdir}/pkgconfig/python-%{LDVERSION_debug}.pc
a8ffdf3
a8ffdf3
%endif # with_debug_build
a8ffdf3
a8ffdf3
a8ffdf3
# ======================================================
a8ffdf3
# Finally, the changelog:
a8ffdf3
# ======================================================
a8ffdf3
a8ffdf3
%changelog
e31cf36
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.9-6
e31cf36
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
e31cf36
12dd214
* Wed May 06 2020 Miro Hrončok <mhroncok@redhat.com> - 3.5.9-5
12dd214
- Rename from python35 to python3.5
12dd214
0848610
* Tue May 05 2020 Tomas Hrnciar <thrnciar@redhat.com> - 3.5.9-4
0848610
- Fix a build/test failure with glibc 2.31.9000+ (#1819759)
0848610
66ed56b
* Wed Feb 12 2020 Miro Hrončok <mhroncok@redhat.com> - 3.5.9-3
66ed56b
- Update the ensurepip module to work with setuptools >= 45
66ed56b
9307dee
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.9-2
9307dee
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
9307dee
659f305
* Mon Nov 25 2019 Miro Hrončok <mhroncok@redhat.com> - 3.5.9-1
659f305
- Update to 3.5.9 (version number update only)
659f305
502df2c
* Wed Oct 30 2019 Miro Hrončok <mhroncok@redhat.com> - 3.5.8-2
502df2c
- Use the correct upstream tarball
502df2c
- https://mail.python.org/archives/list/python-dev@python.org/message/OYNQS2BZYABXACBRHBHV4RCEPQU5R6EP/
502df2c
fb10851
* Tue Oct 29 2019 Miro Hrončok <mhroncok@redhat.com> - 3.5.8-1
fb10851
- Update to 3.5.8
fb10851
5c418db
* Sat Oct 12 2019 Miro Hrončok <mhroncok@redhat.com> - 3.5.8~rc2-1
5c418db
- Update to 3.5.8rc2
5c418db
a67446d
* Mon Sep 09 2019 Miro Hrončok <mhroncok@redhat.com> - 3.5.8~rc1-1
a67446d
- Update to 3.5.8rc1
a67446d
fc3d7ff
* Sat Aug 10 2019 Miro Hrončok <mhroncok@redhat.com> - 3.5.7-4
fc3d7ff
- Build against OpenSSL 1.1.x, not 1.0.x
fc3d7ff
911d628
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.7-3
911d628
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
911d628
35c70e3
* Tue Apr 02 2019 Victor Stinner <vstinner@redhat.com> - 3.5.7-2
35c70e3
- Skip test_ssl and test_asyncio tests failing with OpenSSL 1.1.1 (rhbz#1685609)
35c70e3
ada3a90
* Tue Mar 19 2019 Miro Hrončok <mhroncok@redhat.com> - 3.5.7-1
ada3a90
- Update to 3.5.7
ada3a90
9aa8c49
* Tue Mar 05 2019 Miro Hrončok <mhroncok@redhat.com> - 3.5.7~rc1-1
9aa8c49
- Update to 3.5.7rc1
9aa8c49
9d23af5
* Sun Feb 17 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.5.6-6
9d23af5
- Rebuild for readline 8.0
9d23af5
96ae6bc
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.6-5
96ae6bc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
96ae6bc
cd287bd
* Mon Jan 14 2019 Björn Esser <besser82@fedoraproject.org> - 3.5.6-4
cd287bd
- Rebuilt for libcrypt.so.2 (#1666033)
cd287bd
b0ac866
* Mon Sep 24 2018 Miro Hrončok <mhroncok@redhat.com> - 3.5.6-3
b0ac866
- Security fix for CVE-2018-14647 (#1631822)
b0ac866
0c847d2
* Tue Aug 21 2018 Miro Hrončok <mhroncok@redhat.com> - 3.5.6-2
0c847d2
- Use RPM built wheels of pip and setuptools in ensurepip instead of bundled ones
0c847d2
9e434a4
* Sun Aug 05 2018 Miro Hrončok <mhroncok@redhat.com> - 3.5.6-1
9e434a4
- Rebased to version 3.5.6
9e434a4
046a3d0
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.5-3
046a3d0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
046a3d0
712f383
* Mon Apr 23 2018 Miro Hrončok <mhroncok@redhat.com> - 3.5.5-2
712f383
- Fix multiprocessing regression on newer glibcs
712f383
- Enable test_multiprocessing_fork(server) and _spawn again
712f383
Resolves: rhbz#1569933
712f383
05356b4
* Fri Apr 20 2018 Miro Hrončok <mhroncok@redhat.com> - 3.5.5-1
97e3884
- Rebased to version 3.5.5
9828dfc
- Do not ship the Tools directory
05356b4
- Skip test_multiprocessing_fork(server) and _spawn for now
3562e2a
- Skip test_rapid_restart on non x86 arches
ee04c1b
- Skip test_buffer on ppc64le
97e3884
fa48f89
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.4-4
fa48f89
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
fa48f89
a249397
* Sat Jan 20 2018 Björn Esser <besser82@fedoraproject.org> - 3.5.4-3
a249397
- Rebuilt for switch to libxcrypt
a249397
930be24
* Tue Dec 05 2017 Miro Hrončok <mhroncok@redhat.com> - 3.5.4-2
930be24
- Fix for CVE-2017-1000158
930be24
- rhbz#1519603: https://bugzilla.redhat.com/show_bug.cgi?id=1519603
930be24
ff4d630
* Mon Oct 30 2017 Charalampos Stratakis <cstratak@redhat.com> - 3.5.4-1
ff4d630
- Rebased to version 3.5.4
ff4d630
f2a8e82
* Mon Aug 14 2017 David "Sanqui" Labský <dlabsky@redhat.com> - 3.5.3-5
f2a8e82
- Drop unused db4-devel dependency
f2a8e82
c88a93b
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.3-4
c88a93b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
c88a93b
41c1c2d
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.3-3
41c1c2d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
41c1c2d
f83409d
* Mon Jun 26 2017 Charalampos Stratakis <cstratak@redhat.com> - 3.5.3-2
f83409d
- Fix test_alpn_protocols from test_ssl
f83409d
9dab8a4
* Thu May 11 2017 Charalampos Stratakis <cstratak@redhat.com> - 3.5.3-1
9dab8a4
- Rebased to version 3.5.3 from F25
9dab8a4
- Enable profile guided optimizations for x86_64 and i686 architectures
9dab8a4
- Make pip installable in a new venv when using the --system-site-packages flag
9dab8a4
- Fix syntax error in %%py_byte_compile macro
9dab8a4
- Add patch 259 to work around magic number bump in Python 3.5.3
9dab8a4
0221a74
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.2-9
0221a74
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
0221a74
Igor Gnatenko d0f50ba
* Thu Jan 12 2017 Igor Gnatenko <ignatenko@redhat.com> - 3.5.2-8
Igor Gnatenko d0f50ba
- Rebuild for readline 7.x
Igor Gnatenko d0f50ba
3f83550
* Tue Jan 10 2017 Charalampos Stratakis <cstratak@redhat.com> - 3.5.2-7
3f83550
- Require glibc >= 2.24.90-26 (rhbz#1410644)
3f83550
3ab335d
* Thu Jan 05 2017 Miro Hrončok <mhroncok@redhat.com> - 3.5.2-6
3ab335d
- Don't blow up on EL7 kernel (random generator) (rhbz#1410175, rhbz#1410187)
3ab335d
bb42e73
* Sun Jan 01 2017 Miro Hrončok <mhroncok@redhat.com> - 3.5.2-5
bb42e73
- Update description
bb42e73
c632071
* Sun Jan 01 2017 Miro Hrončok <mhroncok@redhat.com> - 3.5.2-4
c632071
- Add patch for OpenSSL 1.1.0
c632071
f375de3
* Fri Oct 21 2016 Miro Hrončok <mhroncok@redhat.com> - 3.5.2-3
f375de3
- Reword the description
f375de3
e4abf75
* Tue Sep 13 2016 Miro Hrončok <mhroncok@redhat.com> - 3.5.2-2
e4abf75
- Fixed .pyc bytecompilation
e4abf75
- Remove unused configure flags
e4abf75
90c54fb
* Mon Aug 15 2016 Tomas Orsava <torsava@redhat.com> - 3.5.2-1
90c54fb
- Rebased to version 3.5.2 from F26
90c54fb
f0e2965
* Tue Aug 09 2016 Miro Hrončok <mhroncok@redhat.com> - 3.5.1-14
f0e2965
- Imported from F25