Blame python34.spec

e32ce18
# ======================================================
e32ce18
# Conditionals and other variables controlling the build
e32ce18
# ======================================================
e32ce18
e32ce18
%global pybasever 3.4
e32ce18
e32ce18
# pybasever without the dot:
e32ce18
%global pyshortver 34
e32ce18
e32ce18
%global pylibdir %{_libdir}/python%{pybasever}
e32ce18
%global dynload_dir %{pylibdir}/lib-dynload
e32ce18
e32ce18
# SOABI is defined in the upstream configure.in from Python-3.2a2 onwards,
e32ce18
# for PEP 3149:
e32ce18
#   http://www.python.org/dev/peps/pep-3149/
e32ce18
e32ce18
# ("configure.in" became "configure.ac" in Python 3.3 onwards, and in
e32ce18
# backports)
e32ce18
e32ce18
# ABIFLAGS, LDVERSION and SOABI are in the upstream Makefile
e32ce18
# With Python 3.3, we lose the "u" suffix due to PEP 393
e32ce18
%global ABIFLAGS_optimized m
e32ce18
%global ABIFLAGS_debug     dm
e32ce18
e32ce18
%global LDVERSION_optimized %{pybasever}%{ABIFLAGS_optimized}
e32ce18
%global LDVERSION_debug     %{pybasever}%{ABIFLAGS_debug}
e32ce18
e32ce18
%global SOABI_optimized cpython-%{pyshortver}%{ABIFLAGS_optimized}
e32ce18
%global SOABI_debug     cpython-%{pyshortver}%{ABIFLAGS_debug}
e32ce18
e32ce18
# All bytecode files are now in a __pycache__ subdirectory, with a name
e32ce18
# reflecting the version of the bytecode (to permit sharing of python libraries
e32ce18
# between different runtimes)
e32ce18
# See http://www.python.org/dev/peps/pep-3147/
e32ce18
# For example,
e32ce18
#   foo/bar.py
e32ce18
# now has bytecode at:
e32ce18
#   foo/__pycache__/bar.cpython-34.pyc
e32ce18
#   foo/__pycache__/bar.cpython-34.pyo
e32ce18
%global bytecode_suffixes .cpython-34.py?
e32ce18
e32ce18
# Python's configure script defines SOVERSION, and this is used in the Makefile
e32ce18
# to determine INSTSONAME, the name of the libpython DSO:
e32ce18
#   LDLIBRARY='libpython$(VERSION).so'
e32ce18
#   INSTSONAME="$LDLIBRARY".$SOVERSION
e32ce18
# We mirror this here in order to make it easier to add the -gdb.py hooks.
e32ce18
# (if these get out of sync, the payload of the libs subpackage will fail
e32ce18
# and halt the build)
e32ce18
%global py_SOVERSION 1.0
e32ce18
%global py_INSTSONAME_optimized libpython%{LDVERSION_optimized}.so.%{py_SOVERSION}
e32ce18
%global py_INSTSONAME_debug     libpython%{LDVERSION_debug}.so.%{py_SOVERSION}
e32ce18
d28efab
%global with_debug_build 0
e32ce18
e32ce18
%global with_gdb_hooks 1
e32ce18
e32ce18
%global with_systemtap 1
e32ce18
e32ce18
# some arches don't have valgrind so we need to disable its support on them
ab52cf7
%ifarch %{valgrind_arches}
e32ce18
%global with_valgrind 1
e32ce18
%else
e32ce18
%global with_valgrind 0
e32ce18
%endif
e32ce18
e32ce18
%global with_gdbm 1
e32ce18
e32ce18
# Change from yes to no to turn this off
e32ce18
%global with_computed_gotos yes
e32ce18
e32ce18
# Turn this to 0 to turn off the "check" phase:
e32ce18
%global run_selftest_suite 1
e32ce18
0d60256
# Disable automatic bytecompilation. The python3 binary is not yet be
0d60256
# available in /usr/bin when Python is built. Also, the bytecompilation fails
0d60256
# on files that test invalid syntax.
0d60256
%undefine py_auto_byte_compile
e32ce18
e32ce18
# We need to get a newer configure generated out of configure.in for the following
e32ce18
# patches:
e32ce18
#   patch 55 (systemtap)
e32ce18
#   patch 113 (more config flags)
e32ce18
#
e32ce18
# For patch 55 (systemtap), we need to get a new header for configure to use
e32ce18
#
e32ce18
# configure.in requires autoconf-2.65, but the version in Fedora is currently
e32ce18
# autoconf-2.66
e32ce18
#
e32ce18
# For now, we'll generate a patch to the generated configure script and
e32ce18
# pyconfig.h.in on a machine that has a local copy of autoconf 2.65
e32ce18
#
e32ce18
# Instructions on obtaining such a copy can be seen at
e32ce18
#   http://bugs.python.org/issue7997
e32ce18
#
e32ce18
# To make it easy to regenerate the patch, this specfile can be run in two
e32ce18
# ways:
e32ce18
# (i) regenerate_autotooling_patch  0 : the normal approach: prep the
e32ce18
# source tree using a pre-generated patch to the "configure" script, and do a
e32ce18
# full build
e32ce18
# (ii) regenerate_autotooling_patch 1 : intended to be run on a developer's
e32ce18
# workstation: prep the source tree without patching configure, then rerun a
e32ce18
# local copy of autoconf-2.65, regenerate the patch, then exit, without doing
e32ce18
# the rest of the build
e32ce18
%global regenerate_autotooling_patch 0
e32ce18
e32ce18
e32ce18
# ==================
e32ce18
# Top-level metadata
e32ce18
# ==================
590bf1d
Summary: Version 3.4 of the Python programming language
b5ef396
Name: python%{pyshortver}
25d559a
Version: %{pybasever}.9
659fdac
Release: 6%{?dist}
e32ce18
License: Python
e32ce18
Group: Development/Languages
e32ce18
c276ba9
# Whether to use RPM build wheels from the python-{pip,setuptools}-wheel package
c276ba9
# Uses upstream bundled prebuilt wheels otherwise
c276ba9
%bcond_without rpmwheels
e32ce18
e32ce18
# =======================
e32ce18
# Build-time requirements
e32ce18
# =======================
e32ce18
e32ce18
# (keep this list alphabetized)
e32ce18
e32ce18
BuildRequires: autoconf
e32ce18
BuildRequires: bluez-libs-devel
e32ce18
BuildRequires: bzip2
e32ce18
BuildRequires: bzip2-devel
e32ce18
e32ce18
# expat 2.1.0 added the symbol XML_SetHashSalt without bumping SONAME.  We use
e32ce18
# it (in pyexpat) in order to enable the fix in Python-3.2.3 for CVE-2012-0876:
e32ce18
BuildRequires: expat-devel >= 2.1.0
e32ce18
e32ce18
BuildRequires: findutils
e32ce18
BuildRequires: gcc-c++
e32ce18
%if %{with_gdbm}
e32ce18
BuildRequires: gdbm-devel
e32ce18
%endif
feceac5
BuildRequires: glibc-all-langpacks
e32ce18
BuildRequires: glibc-devel
e32ce18
BuildRequires: gmp-devel
e32ce18
BuildRequires: libffi-devel
e32ce18
BuildRequires: libGL-devel
e32ce18
BuildRequires: libX11-devel
e32ce18
BuildRequires: ncurses-devel
e32ce18
# workaround http://bugs.python.org/issue19804 (test_uuid requires ifconfig)
e32ce18
BuildRequires: net-tools
e32ce18
BuildRequires: pkgconfig
e32ce18
BuildRequires: readline-devel
e32ce18
BuildRequires: sqlite-devel
92f62d9
BuildRequires: compat-openssl10-devel
92f62d9
e32ce18
%if 0%{?with_systemtap}
e32ce18
BuildRequires: systemtap-sdt-devel
e32ce18
# (this introduces a dependency on "python", in that systemtap-sdt-devel's
e32ce18
# /usr/bin/dtrace is a python 2 script)
e32ce18
%global tapsetdir      /usr/share/systemtap/tapset
e32ce18
%endif # with_systemtap
e32ce18
e32ce18
BuildRequires: tar
e32ce18
BuildRequires: tcl-devel
e32ce18
BuildRequires: tix-devel
e32ce18
BuildRequires: tk-devel
e32ce18
e32ce18
%if 0%{?with_valgrind}
e32ce18
BuildRequires: valgrind-devel
e32ce18
%endif
e32ce18
e32ce18
BuildRequires: xz-devel
e32ce18
BuildRequires: zlib-devel
e32ce18
590bf1d
Requires: expat >= 2.1.0
028378c
# Python 3 built with glibc >= 2.24.90-26 needs to require it (rhbz#1410644).
159bbc7
Requires: glibc%{?_isa} >= 2.24.90-26
590bf1d
BuildRequires: python-rpm-macros
590bf1d
c276ba9
%if %{with rpmwheels}
c276ba9
BuildRequires: python-setuptools-wheel
c276ba9
BuildRequires: python-pip-wheel
c276ba9
%endif
e32ce18
e32ce18
# =======================
e32ce18
# Source code and patches
e32ce18
# =======================
e32ce18
e32ce18
Source: http://www.python.org/ftp/python/%{version}/Python-%{version}.tar.xz
e32ce18
e32ce18
# Supply an RPM macro "py_byte_compile" for the python3-devel subpackage
e32ce18
# to enable specfiles to selectively byte-compile individual files and paths
e32ce18
# with different Python runtimes as necessary:
e32ce18
Source3: macros.pybytecompile%{pybasever}
e32ce18
e32ce18
# Systemtap tapset to make it easier to use the systemtap static probes
e32ce18
# (actually a template; LIBRARY_PATH will get fixed up during install)
e32ce18
# Written by dmalcolm; not yet sent upstream
e32ce18
Source5: libpython.stp
e32ce18
e32ce18
# Example systemtap script using the tapset
e32ce18
# Written by wcohen, mjw, dmalcolm; not yet sent upstream
e32ce18
Source6: systemtap-example.stp
e32ce18
e32ce18
# Another example systemtap script that uses the tapset
e32ce18
# Written by dmalcolm; not yet sent upstream
e32ce18
Source7: pyfuntop.stp
e32ce18
e32ce18
# A simple script to check timestamps of bytecode files
e32ce18
# Run in check section with Python that is currently being built
e32ce18
# Written by bkabrda
e32ce18
Source8: check-pyc-and-pyo-timestamps.py
e32ce18
e32ce18
# Fixup distutils/unixccompiler.py to remove standard library path from rpath:
e32ce18
# Was Patch0 in ivazquez' python3000 specfile:
e32ce18
Patch1:         Python-3.1.1-rpath.patch
e32ce18
e32ce18
# 00055 #
e32ce18
# Systemtap support: add statically-defined probe points
e32ce18
# Patch sent upstream as http://bugs.python.org/issue14776
e32ce18
# with some subsequent reworking to cope with LANG=C in an rpmbuild
e32ce18
# (where sys.getfilesystemencoding() == 'ascii')
e32ce18
Patch55: 00055-systemtap.patch
e32ce18
e32ce18
Patch102: 00102-lib64.patch
e32ce18
e32ce18
# 00104 #
e32ce18
# Only used when "%{_lib}" == "lib64"
e32ce18
# Another lib64 fix, for distutils/tests/test_install.py; not upstream:
e32ce18
Patch104: 00104-lib64-fix-for-test_install.patch
e32ce18
e32ce18
# 00111 #
e32ce18
# Patch the Makefile.pre.in so that the generated Makefile doesn't try to build
e32ce18
# a libpythonMAJOR.MINOR.a (bug 550692):
e32ce18
# Downstream only: not appropriate for upstream
e32ce18
Patch111: 00111-no-static-lib.patch
e32ce18
e32ce18
# 00113 #
e32ce18
# Add configure-time support for the COUNT_ALLOCS and CALL_PROFILE options
e32ce18
# described at http://svn.python.org/projects/python/trunk/Misc/SpecialBuilds.txt
e32ce18
# so that if they are enabled, they will be in that build's pyconfig.h, so that
e32ce18
# extension modules will reliably use them
e32ce18
# Not yet sent upstream
e32ce18
Patch113: 00113-more-configuration-flags.patch
e32ce18
e32ce18
# 00125 #
e32ce18
# COUNT_ALLOCS is useful for debugging, but the upstream behaviour of always
e32ce18
# emitting debug info to stdout on exit is too verbose and makes it harder to
e32ce18
# use the debug build.  Add a "PYTHONDUMPCOUNTS" environment variable which
e32ce18
# must be set to enable the output on exit
e32ce18
# Not yet sent upstream
e32ce18
Patch125: 00125-less-verbose-COUNT_ALLOCS.patch
e32ce18
e32ce18
# 00131 #
e32ce18
# The four tests in test_io built on top of check_interrupted_write_retry
e32ce18
# fail when built in Koji, for ppc and ppc64; for some reason, the SIGALRM
e32ce18
# handlers are never called, and the call to write runs to completion
e32ce18
# (rhbz#732998)
e32ce18
Patch131: 00131-disable-tests-in-test_io.patch
e32ce18
e32ce18
# 00132 #
e32ce18
# Add non-standard hooks to unittest for use in the "check" phase below, when
e32ce18
# running selftests within the build:
e32ce18
#   @unittest._skipInRpmBuild(reason)
e32ce18
# for tests that hang or fail intermittently within the build environment, and:
e32ce18
#   @unittest._expectedFailureInRpmBuild
e32ce18
# for tests that always fail within the build environment
e32ce18
#
e32ce18
# The hooks only take effect if WITHIN_PYTHON_RPM_BUILD is set in the
e32ce18
# environment, which we set manually in the appropriate portion of the "check"
e32ce18
# phase below (and which potentially other python-* rpms could set, to reuse
e32ce18
# these unittest hooks in their own "check" phases)
e32ce18
Patch132: 00132-add-rpmbuild-hooks-to-unittest.patch
e32ce18
e32ce18
# 00134 #
e32ce18
# Fix a failure in test_sys.py when configured with COUNT_ALLOCS enabled
e32ce18
# Not yet sent upstream
e32ce18
Patch134: 00134-fix-COUNT_ALLOCS-failure-in-test_sys.patch
e32ce18
e32ce18
# 00135 #
e32ce18
# test_weakref's test_callback_in_cycle_resurrection doesn't work with
e32ce18
# COUNT_ALLOCS, as the metrics keep "C" alive.  Work around this for our
e32ce18
# debug build:
e32ce18
# Not yet sent upstream
e32ce18
Patch135: 00135-fix-test-within-test_weakref-in-debug-build.patch
e32ce18
e32ce18
# 00137 #
e32ce18
# Some tests within distutils fail when run in an rpmbuild:
e32ce18
Patch137: 00137-skip-distutils-tests-that-fail-in-rpmbuild.patch
e32ce18
e32ce18
# 00139 #
e32ce18
# ARM-specific: skip known failure in test_float:
e32ce18
#  http://bugs.python.org/issue8265 (rhbz#706253)
e32ce18
Patch139: 00139-skip-test_float-known-failure-on-arm.patch
e32ce18
e32ce18
# ideally short lived patch disabling a test thats fragile on different arches
e32ce18
Patch140: python3-arm-skip-failing-fragile-test.patch
e32ce18
e32ce18
# 00141 #
e32ce18
# Fix tests for case when  tests for case when configured with
e32ce18
# COUNT_ALLOCS (debug build): http://bugs.python.org/issue19527
e32ce18
# Applies to: test_gc, test_module, test_io, test_logging, test_warnings,
e32ce18
#             test_threading
e32ce18
Patch141: 00141-fix-tests_with_COUNT_ALLOCS.patch
e32ce18
e32ce18
# 00143 #
e32ce18
# Fix the --with-tsc option on ppc64, and rework it on 32-bit ppc to avoid
e32ce18
# aliasing violations (rhbz#698726)
e32ce18
# Sent upstream as http://bugs.python.org/issue12872
e32ce18
Patch143: 00143-tsc-on-ppc.patch
e32ce18
e32ce18
# 00146 #
e32ce18
# Support OpenSSL FIPS mode (e.g. when OPENSSL_FORCE_FIPS_MODE=1 is set)
e32ce18
# - handle failures from OpenSSL (e.g. on attempts to use MD5 in a
e32ce18
#   FIPS-enforcing environment)
e32ce18
# - add a new "usedforsecurity" keyword argument to the various digest
e32ce18
#   algorithms in hashlib so that you can whitelist a callsite with
e32ce18
#   "usedforsecurity=False"
e32ce18
# (sent upstream for python 3 as http://bugs.python.org/issue9216 ; see RHEL6
e32ce18
# python patch 119)
e32ce18
# - enforce usage of the _hashlib implementation: don't fall back to the _md5
e32ce18
#   and _sha* modules (leading to clearer error messages if fips selftests
e32ce18
#   fail)
e32ce18
# - don't build the _md5 and _sha* modules; rely on the _hashlib implementation
e32ce18
#   of hashlib
e32ce18
# (rhbz#563986)
e32ce18
# Note: Up to Python 3.4.0.b1, upstream had their own implementation of what
e32ce18
# they assumed would become sha3. This patch was adapted to give it the
e32ce18
# usedforsecurity argument, even though it did nothing (OpenSSL didn't have
e32ce18
# sha3 implementation at that time).In 3.4.0.b2, sha3 implementation was reverted
e32ce18
# (see http://bugs.python.org/issue16113), but the alterations were left in the
e32ce18
# patch, since they may be useful again if upstream decides to rerevert sha3
e32ce18
# implementation and OpenSSL still doesn't support it. For now, they're harmless.
e32ce18
Patch146: 00146-hashlib-fips.patch
e32ce18
e32ce18
# 00150 #
e32ce18
# temporarily disable rAssertAlmostEqual in test_cmath on PPC (bz #750811)
e32ce18
# caused by a glibc bug. This patch can be removed when we have a glibc with
e32ce18
# the patch mentioned here:
e32ce18
#   http://sourceware.org/bugzilla/show_bug.cgi?id=13472
e32ce18
Patch150: 00150-disable-rAssertAlmostEqual-cmath-on-ppc.patch
e32ce18
e32ce18
# 00155 #
e32ce18
# Avoid allocating thunks in ctypes unless absolutely necessary, to avoid
e32ce18
# generating SELinux denials on "import ctypes" and "import uuid" when
e32ce18
# embedding Python within httpd (rhbz#814391)
e32ce18
Patch155: 00155-avoid-ctypes-thunks.patch
e32ce18
e32ce18
# 00157 #
e32ce18
# Update uid/gid handling throughout the standard library: uid_t and gid_t are
e32ce18
# unsigned 32-bit values, but existing code often passed them through C long
e32ce18
# values, which are signed 32-bit values on 32-bit architectures, leading to
e32ce18
# negative int objects for uid/gid values >= 2^31 on 32-bit architectures.
e32ce18
#
e32ce18
# Introduce _PyObject_FromUid/Gid to convert uid_t/gid_t values to python
e32ce18
# objects, using int objects where the value will fit (long objects otherwise),
e32ce18
# and _PyArg_ParseUid/Gid to convert int/long to uid_t/gid_t, with -1 allowed
e32ce18
# as a special case (since this is given special meaning by the chown syscall)
e32ce18
#
e32ce18
# Update standard library to use this throughout for uid/gid values, so that
e32ce18
# very large uid/gid values are round-trippable, and -1 remains usable.
e32ce18
# (rhbz#697470)
e32ce18
Patch157: 00157-uid-gid-overflows.patch
e32ce18
e32ce18
# 00160 #
e32ce18
# Python 3.3 added os.SEEK_DATA and os.SEEK_HOLE, which may be present in the
e32ce18
# header files in the build chroot, but may not be supported in the running
e32ce18
# kernel, hence we disable this test in an rpm build.
e32ce18
# Adding these was upstream issue http://bugs.python.org/issue10142
e32ce18
# Not yet sent upstream
e32ce18
Patch160: 00160-disable-test_fs_holes-in-rpm-build.patch
e32ce18
e32ce18
# 00163 #
e32ce18
# Some tests within test_socket fail intermittently when run inside Koji;
e32ce18
# disable them using unittest._skipInRpmBuild
e32ce18
# Not yet sent upstream
e32ce18
Patch163: 00163-disable-parts-of-test_socket-in-rpm-build.patch
e32ce18
e32ce18
# 0164 #
e32ce18
# some tests in test._io interrupted_write-* fail on PPC (rhbz#846849)
e32ce18
# testChainingDescriptors  test in test_exceptions fails on PPc, too (rhbz#846849)
e32ce18
# disable those tests so that rebuilds on PPC can continue
e32ce18
Patch164: 00164-disable-interrupted_write-tests-on-ppc.patch
e32ce18
e32ce18
# 00170 #                                                                                           
e32ce18
# In debug builds, try to print repr() when a C-level assert fails in the                           
e32ce18
# garbage collector (typically indicating a reference-counting error                                
e32ce18
# somewhere else e.g in an extension module)                                                        
e32ce18
# Backported to 2.7 from a patch I sent upstream for py3k                                           
e32ce18
#   http://bugs.python.org/issue9263  (rhbz#614680)                                                 
e32ce18
# hiding the proposed new macros/functions within gcmodule.c to avoid exposing                      
e32ce18
# them within the extension API.                                                                    
e32ce18
# (rhbz#850013
e32ce18
Patch170: 00170-gc-assertions.patch
e32ce18
e32ce18
# 00173 #
e32ce18
# Workaround for ENOPROTOOPT seen in Koji withi test.support.bind_port()
e32ce18
# (rhbz#913732)
e32ce18
Patch173: 00173-workaround-ENOPROTOOPT-in-bind_port.patch
e32ce18
e32ce18
# 00178 #
e32ce18
# Don't duplicate various FLAGS in sysconfig values
e32ce18
# http://bugs.python.org/issue17679
e32ce18
# Does not affect python2 AFAICS (different sysconfig values initialization)
e32ce18
Patch178: 00178-dont-duplicate-flags-in-sysconfig.patch
e32ce18
e32ce18
# 00179 #
e32ce18
# Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=951802
e32ce18
# Reported upstream in http://bugs.python.org/issue17737
e32ce18
# This patch basically looks at every frame and if it is somehow corrupted,
e32ce18
# it just stops printing the traceback - it doesn't fix the actual bug.
e32ce18
# This bug seems to only affect ARM.
e32ce18
# Doesn't seem to affect Python 2 AFAICS.
e32ce18
Patch179: 00179-dont-raise-error-on-gdb-corrupted-frames-in-backtrace.patch
e32ce18
e32ce18
# 00180 #
e32ce18
# Enable building on ppc64p7
e32ce18
# Not appropriate for upstream, Fedora-specific naming
e32ce18
Patch180: 00180-python-add-support-for-ppc64p7.patch
e32ce18
e32ce18
# 00184 #
e32ce18
# Fix for https://bugzilla.redhat.com/show_bug.cgi?id=979696
e32ce18
# Fixes build of ctypes against libffi with multilib wrapper
e32ce18
# Python recognizes ffi.h only if it contains "#define LIBFFI_H",
e32ce18
# but the wrapper doesn't contain that, which makes the build fail
e32ce18
# We patch this by also accepting "#define ffi_wrapper_h"
e32ce18
Patch184: 00184-ctypes-should-build-with-libffi-multilib-wrapper.patch
e32ce18
e32ce18
# 00186 #
e32ce18
# Fix for https://bugzilla.redhat.com/show_bug.cgi?id=1023607
e32ce18
# Previously, this fixed a problem where some *.py files were not being
e32ce18
# bytecompiled properly during build. This was result of py_compile.compile
e32ce18
# raising exception when trying to convert test file with bad encoding, and
e32ce18
# thus not continuing bytecompilation for other files.
e32ce18
# This was fixed upstream, but the test hasn't been merged yet, so we keep it
e32ce18
Patch186: 00186-dont-raise-from-py_compile.patch
e32ce18
e32ce18
# 00188 #
e32ce18
# Downstream only patch that should be removed when we compile all guaranteed
e32ce18
# hashlib algorithms properly. The problem is this:
e32ce18
# - during tests, test_hashlib is imported and executed before test_lib2to3
e32ce18
# - if at least one hash function has failed, trying to import it triggers an
e32ce18
#   exception that is being caught and exception is logged:
e32ce18
#   http://hg.python.org/cpython/file/2de806c8b070/Lib/hashlib.py#l217
e32ce18
# - logging the exception makes logging module run basicConfig
e32ce18
# - when lib2to3 tests are run again, lib2to3 runs basicConfig again, which
e32ce18
#   doesn't do anything, because it was run previously
e32ce18
#   (logging.root.handlers != []), which means that the default setup
e32ce18
#   (most importantly logging level) is not overriden. That means that a test
e32ce18
#   relying on this will fail (test_filename_changing_on_output_single_dir)
e32ce18
Patch188: 00188-fix-lib2to3-tests-when-hashlib-doesnt-compile-properly.patch
e32ce18
c276ba9
# 00189 #
c276ba9
# Instead of bundled wheels, use our RPM packaged wheels from
c276ba9
# /usr/share/python-wheels
c276ba9
Patch189: 00189-use-rpm-wheels.patch
c276ba9
e32ce18
# Tests requiring SIGHUP to work don't work in Koji
e32ce18
# see rhbz#1088233
e32ce18
Patch194: temporarily-disable-tests-requiring-SIGHUP.patch
e32ce18
e32ce18
# 00196
e32ce18
#
e32ce18
#  Fix test_gdb failure on ppc64le
e32ce18
Patch196: 00196-test-gdb-match-addr-before-builtin.patch
e32ce18
e32ce18
# 00200 #                                                                                           
e32ce18
# Fix for gettext plural form headers (lines that begin with "#")                                   
e32ce18
# Note: Backported from scl
e32ce18
Patch200: 00200-gettext-plural-fix.patch
e32ce18
e32ce18
# 00201 #                                                                                           
e32ce18
# Fixes memory leak in gdbm module (rhbz#977308)                                                    
e32ce18
# This was upstreamed as a part of bigger patch, but for our purposes                               
e32ce18
# this is ok: http://bugs.python.org/issue18404                                                     
e32ce18
# Note: Backported from scl
e32ce18
Patch201: 00201-fix-memory-leak-in-gdbm.patch 
e32ce18
e32ce18
# test_threading fails in koji dues to it's handling of signals
e32ce18
Patch203: 00203-disable-threading-test-koji.patch
e32ce18
028378c
# 00250 #
028378c
# After  glibc-2.24.90, Python 3 failed to start on EL7 kernel
028378c
# rhbz#1410175: https://bugzilla.redhat.com/show_bug.cgi?id=1410175
028378c
# http://bugs.python.org/issue29157
028378c
# Using the patch for python 2 as it is closer to the logic used
028378c
# for random.c in Python 3.4
028378c
# https://hg.python.org/cpython/rev/13a39142c047
028378c
Patch250: 00250-getentropy.patch
028378c
833e4bd
# 00273 #
833e4bd
# Skip test_float_with_comma, which fails in Koji with UnicodeDecodeError
833e4bd
# See https://bugzilla.redhat.com/show_bug.cgi?id=1484497
833e4bd
Patch273: 00273-skip-float-test.patch
833e4bd
bded33c
# 00290 #
bded33c
# Not every target system may provide a crypt() function in its stdlibc
bded33c
# and may use an external or replacement library, like libxcrypt, for
bded33c
# providing such functions.
bded33c
# Fixed upstream: https://bugs.python.org/issue32635
bded33c
Patch290: 00290-cryptmodule-Include-crypt.h-for-declaration-of-crypt.patch
c7590d4
246bfef
# 00302 #
246bfef
# Fix multiprocessing regression on newer glibcs
246bfef
# See: https://bugzilla.redhat.com/show_bug.cgi?id=1569933
246bfef
# and: https://bugs.python.org/issue33329
246bfef
Patch302: 00302-fix-multiprocessing-regression-on-newer-glibcs.patch
246bfef
47f3a0b
# 00310 #
47f3a0b
# CVE-2018-14647
47f3a0b
# Use XML_SetHashSalt in _elementtree
47f3a0b
# rhbz#1631822
47f3a0b
# Fixed upstream https://bugs.python.org/issue34623
47f3a0b
Patch310: 00310-use-xml-sethashsalt-in-elementtree.patch
47f3a0b
fd00b4e
# 00315 #
fd00b4e
# Fix mktime() error in test_email
fd00b4e
# http://bugs.python.org/issue35317
fd00b4e
# https://bugzilla.redhat.com/show_bug.cgi?id=1652843
fd00b4e
Patch315: 00315-test_email-mktime.patch
fd00b4e
e32ce18
# (New patches go here ^^^)
e32ce18
#
e32ce18
# When adding new patches to "python" and "python3" in Fedora 17 onwards,
e32ce18
# please try to keep the patch numbers in-sync between the two specfiles:
e32ce18
#
e32ce18
#   - use the same patch number across both specfiles for conceptually-equivalent
e32ce18
#     fixes, ideally with the same name
e32ce18
#
e32ce18
#   - when a patch is relevant to both specfiles, use the same introductory
e32ce18
#     comment in both specfiles where possible (to improve "diff" output when
e32ce18
#     comparing them)
e32ce18
#
e32ce18
#   - when a patch is only relevant for one of the two specfiles, leave a gap
e32ce18
#     in the patch numbering in the other specfile, adding a comment when
e32ce18
#     omitting a patch, both in the manifest section here, and in the "prep"
e32ce18
#     phase below
e32ce18
#
e32ce18
# Hopefully this will make it easier to ensure that all relevant fixes are
e32ce18
# applied to both versions.
e32ce18
e32ce18
# This is the generated patch to "configure"; see the description of
e32ce18
#   %{regenerate_autotooling_patch}
e32ce18
# above:
e32ce18
Patch5000: 05000-autotool-intermediates.patch
e32ce18
e32ce18
e32ce18
# ======================================================
e32ce18
# Additional metadata, and subpackages
e32ce18
# ======================================================
e32ce18
e32ce18
URL: http://www.python.org/
e32ce18
a8b8514
# We don't want to provide this
590bf1d
# No package in Fedora shall ever depend on this
f3528a4
%global __requires_exclude ^python\\(abi\\) = 3\\..$
f3528a4
%global __provides_exclude ^python\\(abi\\) = 3\\..$
e32ce18
c276ba9
%if %{with rpmwheels}
c276ba9
Requires: python-setuptools-wheel
c276ba9
Requires: python-pip-wheel
c276ba9
%else
2e36981
Provides: bundled(python3-pip) = 9.0.1
2e36981
Provides: bundled(python3-setuptools) = 28.8.0
c276ba9
%endif
fb10582
e32ce18
%description
b689106
Python %{pybasever} package for developers.
b689106
b689106
This package exists to allow developers to test their code against an older
b689106
version of Python. This is not a full Python stack and if you wish to run
b689106
your applications with Python %{pybasever}, see other distributions
b689106
that support it, such as CentOS or RHEL with Software Collections.
b689106
e32ce18
e32ce18
# ======================================================
e32ce18
# The prep phase of the build:
e32ce18
# ======================================================
e32ce18
e32ce18
%prep
e32ce18
%setup -q -n Python-%{version}%{?prerel}
e32ce18
e32ce18
%if 0%{?with_systemtap}
e32ce18
# Provide an example of usage of the tapset:
e32ce18
cp -a %{SOURCE6} .
e32ce18
cp -a %{SOURCE7} .
e32ce18
%endif # with_systemtap
e32ce18
e32ce18
# Ensure that we're using the system copy of various libraries, rather than
e32ce18
# copies shipped by upstream in the tarball:
e32ce18
#   Remove embedded copy of expat:
e32ce18
rm -r Modules/expat || exit 1
e32ce18
e32ce18
#   Remove embedded copy of libffi:
e32ce18
for SUBDIR in darwin libffi libffi_arm_wince libffi_msvc libffi_osx ; do
e32ce18
  rm -r Modules/_ctypes/$SUBDIR || exit 1 ;
e32ce18
done
e32ce18
e32ce18
#   Remove embedded copy of zlib:
e32ce18
rm -r Modules/zlib || exit 1
e32ce18
e32ce18
# Don't build upstream Python's implementation of these crypto algorithms;
e32ce18
# instead rely on _hashlib and OpenSSL.
e32ce18
#
e32ce18
# For example, in our builds hashlib.md5 is implemented within _hashlib via
e32ce18
# OpenSSL (and thus respects FIPS mode), and does not fall back to _md5
e32ce18
# TODO: there seems to be no OpenSSL support in Python for sha3 so far
e32ce18
# when it is there, also remove _sha3/ dir
e32ce18
for f in md5module.c sha1module.c sha256module.c sha512module.c; do
e32ce18
    rm Modules/$f
e32ce18
done
e32ce18
e32ce18
#
e32ce18
# Apply patches:
e32ce18
#
e32ce18
%patch1 -p1
e32ce18
# 3: upstream as of Python 3.3.1
e32ce18
e32ce18
%if 0%{?with_systemtap}
e32ce18
%patch55 -p1 -b .systemtap
e32ce18
%endif
e32ce18
e32ce18
%if "%{_lib}" == "lib64"
e32ce18
%patch102 -p1
e32ce18
%patch104 -p1
e32ce18
%endif
e32ce18
e32ce18
e32ce18
%patch111 -p1
e32ce18
%patch113 -p1
e32ce18
e32ce18
%patch125 -p1 -b .less-verbose-COUNT_ALLOCS
e32ce18
e32ce18
%ifarch ppc %{power64}
e32ce18
%patch131 -p1
e32ce18
%endif
e32ce18
e32ce18
%patch132 -p1
e32ce18
%patch134 -p1
e32ce18
%patch135 -p1
e32ce18
%patch137 -p1
7144156
e32ce18
%ifarch %{arm}
e32ce18
%patch139 -p1
e32ce18
%patch140 -p1
e32ce18
%endif
7144156
e32ce18
%patch141 -p1
e32ce18
%patch143 -p1 -b .tsc-on-ppc
e32ce18
%patch146 -p1
7144156
e32ce18
%ifarch ppc %{power64}
e32ce18
%patch150 -p1
e32ce18
%endif
7144156
e32ce18
%patch155 -p1
e32ce18
%patch157 -p1
e32ce18
%patch160 -p1
e32ce18
%patch163 -p1
7144156
e32ce18
%ifarch ppc %{power64}
e32ce18
%patch164 -p1
e32ce18
%endif
7144156
e32ce18
%patch173 -p1
e32ce18
%patch178 -p1
e32ce18
%patch179 -p1
e32ce18
%patch180 -p1
e32ce18
%patch184  -p1
e32ce18
%patch186 -p1
e32ce18
%patch188 -p1
e32ce18
c276ba9
%if %{with rpmwheels}
c276ba9
%patch189 -p1
c276ba9
rm Lib/ensurepip/_bundled/*.whl
c276ba9
rmdir Lib/ensurepip/_bundled
c276ba9
%endif
c276ba9
e32ce18
%patch194 -p1
e32ce18
%patch196 -p1
e32ce18
%patch203 -p1
028378c
%patch250 -p1
833e4bd
%patch273 -p1
bded33c
%patch290 -p1
246bfef
%patch302 -p1
47f3a0b
%patch310 -p1
fd00b4e
%patch315 -p1
e32ce18
e32ce18
# Currently (2010-01-15), http://docs.python.org/library is for 2.6, and there
e32ce18
# are many differences between 2.6 and the Python 3 library.
e32ce18
#
e32ce18
# Fix up the URLs within pydoc to point at the documentation for this
e32ce18
# MAJOR.MINOR version:
e32ce18
#
e32ce18
sed --in-place \
e32ce18
    --expression="s|http://docs.python.org/library|http://docs.python.org/%{pybasever}/library|g" \
e32ce18
    Lib/pydoc.py || exit 1
e32ce18
e32ce18
%if ! 0%{regenerate_autotooling_patch}
e32ce18
# Normally we apply the patch to "configure"
e32ce18
# We don't apply the patch if we're working towards regenerating it
e32ce18
%patch5000 -p0 -b .autotool-intermediates
e32ce18
%endif
e32ce18
e32ce18
# ======================================================
e32ce18
# Configuring and building the code:
e32ce18
# ======================================================
e32ce18
e32ce18
%build
e32ce18
topdir=$(pwd)
e32ce18
export CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC -fwrapv"
e32ce18
export CXXFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC -fwrapv"
e32ce18
export CPPFLAGS="`pkg-config --cflags-only-I libffi`"
e32ce18
export OPT="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC -fwrapv"
e32ce18
export LINKCC="gcc"
e32ce18
export CFLAGS="$CFLAGS `pkg-config --cflags openssl`"
e32ce18
export LDFLAGS="$RPM_LD_FLAGS `pkg-config --libs-only-L openssl`"
e32ce18
e32ce18
%if 0%{regenerate_autotooling_patch}
e32ce18
# If enabled, this code regenerates the patch to "configure", using a
e32ce18
# local copy of autoconf-2.65, then exits the build
e32ce18
#
e32ce18
# The following assumes that the copy is installed to ~/autoconf-2.65/bin
e32ce18
# as per these instructions:
e32ce18
#   http://bugs.python.org/issue7997
e32ce18
e32ce18
for f in pyconfig.h.in configure ; do
e32ce18
    cp $f $f.autotool-intermediates ;
e32ce18
done
e32ce18
e32ce18
# Rerun the autotools:
e32ce18
autoreconf
e32ce18
e32ce18
# Regenerate the patch:
e32ce18
gendiff . .autotool-intermediates > %{PATCH5000}
e32ce18
e32ce18
e32ce18
# Exit the build
e32ce18
exit 1
e32ce18
%endif
e32ce18
e32ce18
# Define a function, for how to perform a "build" of python for a given
e32ce18
# configuration:
e32ce18
BuildPython() {
e32ce18
  ConfName=$1	      
e32ce18
  BinaryName=$2
e32ce18
  SymlinkName=$3
e32ce18
  ExtraConfigArgs=$4
e32ce18
  PathFixWithThisBinary=$5
e32ce18
  MoreCFlags=$6
e32ce18
e32ce18
  ConfDir=build/$ConfName
e32ce18
e32ce18
  echo STARTING: BUILD OF PYTHON FOR CONFIGURATION: $ConfName - %{_bindir}/$BinaryName
e32ce18
  mkdir -p $ConfDir
e32ce18
e32ce18
  pushd $ConfDir
e32ce18
e32ce18
  # Use the freshly created "configure" script, but in the directory two above:
e32ce18
  %global _configure $topdir/configure
e32ce18
e32ce18
%configure \
e32ce18
  --enable-ipv6 \
e32ce18
  --enable-shared \
e32ce18
  --with-computed-gotos=%{with_computed_gotos} \
e32ce18
  --with-dbmliborder=gdbm:ndbm:bdb \
e32ce18
  --with-system-expat \
e32ce18
  --with-system-ffi \
e32ce18
  --enable-loadable-sqlite-extensions \
e32ce18
%if 0%{?with_systemtap}
e32ce18
  --with-systemtap \
e32ce18
%endif
e32ce18
%if 0%{?with_valgrind}
e32ce18
  --with-valgrind \
e32ce18
%endif
e32ce18
  $ExtraConfigArgs \
e32ce18
  %{nil}
e32ce18
e32ce18
  # Set EXTRA_CFLAGS to our CFLAGS (rather than overriding OPT, as we've done
e32ce18
  # in the past).
e32ce18
  # This should fix a problem with --with-valgrind where it adds
e32ce18
  #   -DDYNAMIC_ANNOTATIONS_ENABLED=1
e32ce18
  # to OPT which must be passed to all compilation units in the build,
e32ce18
  # otherwise leading to linker errors, e.g.
e32ce18
  #    missing symbol AnnotateRWLockDestroy
e32ce18
  #
e32ce18
  # Invoke the build:
e32ce18
  make EXTRA_CFLAGS="$CFLAGS $MoreCFlags" %{?_smp_mflags}
e32ce18
e32ce18
  popd
e32ce18
  echo FINISHED: BUILD OF PYTHON FOR CONFIGURATION: $ConfDir
e32ce18
}
e32ce18
e32ce18
# Use "BuildPython" to support building with different configurations:
e32ce18
e32ce18
%if 0%{?with_debug_build}
e32ce18
BuildPython debug \
e32ce18
  python-debug \
e32ce18
  python%{pybasever}-debug \
e32ce18
%ifarch %{ix86} x86_64 ppc %{power64}
e32ce18
  "--with-pydebug --with-tsc --with-count-allocs --with-call-profile --without-ensurepip" \
e32ce18
%else
e32ce18
  "--with-pydebug --with-count-allocs --with-call-profile --without-ensurepip" \
e32ce18
%endif
e32ce18
  false \
e32ce18
  -O0
e32ce18
%endif # with_debug_build
e32ce18
e32ce18
BuildPython optimized \
e32ce18
  python \
e32ce18
  python%{pybasever} \
e32ce18
  "--without-ensurepip" \
e32ce18
  true
e32ce18
e32ce18
# ======================================================
e32ce18
# Installing the built code:
e32ce18
# ======================================================
e32ce18
e32ce18
%install
e32ce18
topdir=$(pwd)
e32ce18
rm -fr %{buildroot}
e32ce18
mkdir -p %{buildroot}%{_prefix} %{buildroot}%{_mandir}
e32ce18
e32ce18
InstallPython() {
e32ce18
e32ce18
  ConfName=$1	      
e32ce18
  PyInstSoName=$2
e32ce18
  MoreCFlags=$3
e32ce18
e32ce18
  ConfDir=build/$ConfName
e32ce18
e32ce18
  echo STARTING: INSTALL OF PYTHON FOR CONFIGURATION: $ConfName
e32ce18
  mkdir -p $ConfDir
e32ce18
e32ce18
  pushd $ConfDir
e32ce18
e32ce18
make install DESTDIR=%{buildroot} INSTALL="install -p" EXTRA_CFLAGS="$MoreCFlags"
e32ce18
e32ce18
  popd
e32ce18
e32ce18
  # We install a collection of hooks for gdb that make it easier to debug
e32ce18
  # executables linked against libpython3* (such as /usr/bin/python3 itself)
e32ce18
  #
e32ce18
  # These hooks are implemented in Python itself (though they are for the version
e32ce18
  # of python that gdb is linked with, in this case Python 2.7)
e32ce18
  #
e32ce18
  # gdb-archer looks for them in the same path as the ELF file, with a -gdb.py suffix.
e32ce18
  # We put them in the debuginfo package by installing them to e.g.:
e32ce18
  #  /usr/lib/debug/usr/lib/libpython3.2.so.1.0.debug-gdb.py
e32ce18
  #
e32ce18
  # See https://fedoraproject.org/wiki/Features/EasierPythonDebugging for more
e32ce18
  # information
e32ce18
  #
e32ce18
  # Copy up the gdb hooks into place; the python file will be autoloaded by gdb
e32ce18
  # when visiting libpython.so, provided that the python file is installed to the
e32ce18
  # same path as the library (or its .debug file) plus a "-gdb.py" suffix, e.g:
e32ce18
  #  /usr/lib/debug/usr/lib64/libpython3.2.so.1.0.debug-gdb.py
e32ce18
  # (note that the debug path is /usr/lib/debug for both 32/64 bit)
e32ce18
  #
e32ce18
  # Initially I tried:
e32ce18
  #  /usr/lib/libpython3.1.so.1.0-gdb.py
e32ce18
  # but doing so generated noise when ldconfig was rerun (rhbz:562980)
e32ce18
  #
e32ce18
%if 0%{?with_gdb_hooks}
e32ce18
  DirHoldingGdbPy=%{_prefix}/lib/debug/%{_libdir}
e32ce18
  PathOfGdbPy=$DirHoldingGdbPy/$PyInstSoName.debug-gdb.py
e32ce18
e32ce18
  mkdir -p %{buildroot}$DirHoldingGdbPy
e32ce18
  cp Tools/gdb/libpython.py %{buildroot}$PathOfGdbPy
e32ce18
%endif # with_gdb_hooks
e32ce18
e32ce18
  echo FINISHED: INSTALL OF PYTHON FOR CONFIGURATION: $ConfName
e32ce18
}
e32ce18
e32ce18
# Use "InstallPython" to support building with different configurations:
e32ce18
e32ce18
# Install the "debug" build first, so that we can move some files aside
e32ce18
%if 0%{?with_debug_build}
e32ce18
InstallPython debug \
e32ce18
  %{py_INSTSONAME_debug} \
e32ce18
  -O0
e32ce18
%endif # with_debug_build
e32ce18
e32ce18
# Now the optimized build:
e32ce18
InstallPython optimized \
e32ce18
  %{py_INSTSONAME_optimized}
e32ce18
e32ce18
install -d -m 0755 ${RPM_BUILD_ROOT}%{pylibdir}/site-packages/__pycache__
e32ce18
e32ce18
# Documentation tools
e32ce18
install -m755 -d %{buildroot}%{pylibdir}/Doc
e32ce18
cp -ar Doc/tools %{buildroot}%{pylibdir}/Doc/
e32ce18
e32ce18
# Fix for bug #136654
e32ce18
rm -f %{buildroot}%{pylibdir}/email/test/data/audiotest.au %{buildroot}%{pylibdir}/test/audiotest.au
e32ce18
e32ce18
%if "%{_lib}" == "lib64"
e32ce18
install -d -m 0755 %{buildroot}/%{_prefix}/lib/python%{pybasever}/site-packages/__pycache__
e32ce18
%endif
e32ce18
e32ce18
# Make python3-devel multilib-ready (bug #192747, #139911)
e32ce18
%global _pyconfig32_h pyconfig-32.h
e32ce18
%global _pyconfig64_h pyconfig-64.h
e32ce18
e32ce18
%ifarch %{power64} s390x x86_64 ia64 alpha sparc64 aarch64
e32ce18
%global _pyconfig_h %{_pyconfig64_h}
e32ce18
%else
e32ce18
%global _pyconfig_h %{_pyconfig32_h}
e32ce18
%endif
e32ce18
e32ce18
# ABIFLAGS, LDVERSION and SOABI are in the upstream Makefile
e32ce18
%global ABIFLAGS_optimized m
e32ce18
%global ABIFLAGS_debug     dm
e32ce18
e32ce18
%global LDVERSION_optimized %{pybasever}%{ABIFLAGS_optimized}
e32ce18
%global LDVERSION_debug     %{pybasever}%{ABIFLAGS_debug}
e32ce18
e32ce18
%global SOABI_optimized cpython-%{pyshortver}%{ABIFLAGS_optimized}
e32ce18
%global SOABI_debug     cpython-%{pyshortver}%{ABIFLAGS_debug}
e32ce18
e32ce18
%if 0%{?with_debug_build}
e32ce18
%global PyIncludeDirs python%{LDVERSION_optimized} python%{LDVERSION_debug}
e32ce18
e32ce18
%else
e32ce18
%global PyIncludeDirs python%{LDVERSION_optimized}
e32ce18
%endif
e32ce18
e32ce18
for PyIncludeDir in %{PyIncludeDirs} ; do
e32ce18
  mv %{buildroot}%{_includedir}/$PyIncludeDir/pyconfig.h \
e32ce18
     %{buildroot}%{_includedir}/$PyIncludeDir/%{_pyconfig_h}
e32ce18
  cat > %{buildroot}%{_includedir}/$PyIncludeDir/pyconfig.h << EOF
e32ce18
#include <bits/wordsize.h>
e32ce18
e32ce18
#if __WORDSIZE == 32
e32ce18
#include "%{_pyconfig32_h}"
e32ce18
#elif __WORDSIZE == 64
e32ce18
#include "%{_pyconfig64_h}"
e32ce18
#else
e32ce18
#error "Unknown word size"
e32ce18
#endif
e32ce18
EOF
e32ce18
done
e32ce18
e32ce18
# Fix for bug 201434: make sure distutils looks at the right pyconfig.h file
e32ce18
# Similar for sysconfig: sysconfig.get_config_h_filename tries to locate
e32ce18
# pyconfig.h so it can be parsed, and needs to do this at runtime in site.py
e32ce18
# when python starts up (bug 653058)
e32ce18
#
e32ce18
# Split this out so it goes directly to the pyconfig-32.h/pyconfig-64.h
e32ce18
# variants:
e32ce18
sed -i -e "s/'pyconfig.h'/'%{_pyconfig_h}'/" \
e32ce18
  %{buildroot}%{pylibdir}/distutils/sysconfig.py \
e32ce18
  %{buildroot}%{pylibdir}/sysconfig.py
e32ce18
e32ce18
# Switch all shebangs to refer to the specific Python version.
e32ce18
LD_LIBRARY_PATH=./build/optimized ./build/optimized/python \
e32ce18
  Tools/scripts/pathfix.py \
baa9bad
  -i "%{_bindir}/python%{pybasever}" -p \
baa9bad
  %{buildroot} \
baa9bad
  %{?with_gdb_hooks:%{buildroot}$DirHoldingGdbPy/*.py}
e32ce18
e32ce18
# Remove shebang lines from .py files that aren't executable, and
e32ce18
# remove executability from .py files that don't have a shebang line:
e32ce18
find %{buildroot} -name \*.py \
e32ce18
  \( \( \! -perm /u+x,g+x,o+x -exec sed -e '/^#!/Q 0' -e 'Q 1' {} \; \
e32ce18
  -print -exec sed -i '1d' {} \; \) -o \( \
e32ce18
  -perm /u+x,g+x,o+x ! -exec grep -m 1 -q '^#!' {} \; \
e32ce18
  -exec chmod a-x {} \; \) \)
e32ce18
648bb82
# Remove tests for tools, we don't ship those
648bb82
rm -rf %{buildroot}%{pylibdir}/test/test_tools
648bb82
e32ce18
# .xpm and .xbm files should not be executable:
e32ce18
find %{buildroot} \
e32ce18
  \( -name \*.xbm -o -name \*.xpm -o -name \*.xpm.1 \) \
e32ce18
  -exec chmod a-x {} \;
e32ce18
e32ce18
# Remove executable flag from files that shouldn't have it:
e32ce18
chmod a-x \
648bb82
  %{buildroot}%{pylibdir}/distutils/tests/Setup.sample
e32ce18
e32ce18
# Get rid of DOS batch files:
e32ce18
find %{buildroot} -name \*.bat -exec rm {} \;
e32ce18
e32ce18
# Get rid of backup files:
e32ce18
find %{buildroot}/ -name "*~" -exec rm -f {} \;
e32ce18
find . -name "*~" -exec rm -f {} \;
e32ce18
rm -f %{buildroot}%{pylibdir}/LICENSE.txt
e32ce18
# Junk, no point in putting in -test sub-pkg
e32ce18
rm -f ${RPM_BUILD_ROOT}/%{pylibdir}/idlelib/testcode.py*
e32ce18
e32ce18
# Get rid of stray patch file from buildroot:
e32ce18
rm -f %{buildroot}%{pylibdir}/test/test_imp.py.apply-our-changes-to-expected-shebang # from patch 4
e32ce18
e32ce18
# Fix end-of-line encodings:
e32ce18
find %{buildroot}/ -name \*.py -exec sed -i 's/\r//' {} \;
e32ce18
e32ce18
# Fix an encoding:
e32ce18
iconv -f iso8859-1 -t utf-8 %{buildroot}/%{pylibdir}/Demo/rpc/README > README.conv && mv -f README.conv %{buildroot}/%{pylibdir}/Demo/rpc/README
e32ce18
e32ce18
# Note that 
e32ce18
#  %{pylibdir}/Demo/distutils/test2to3/setup.py
e32ce18
# is in iso-8859-1 encoding, and that this is deliberate; this is test data
e32ce18
# for the 2to3 tool, and one of the functions of the 2to3 tool is to fixup
e32ce18
# character encodings within python source code
e32ce18
e32ce18
# Do bytecompilation with the newly installed interpreter.
e32ce18
# This is similar to the script in macros.pybytecompile
e32ce18
# compile *.pyo
e32ce18
find %{buildroot} -type f -a -name "*.py" -print0 | \
e32ce18
    LD_LIBRARY_PATH="%{buildroot}%{dynload_dir}/:%{buildroot}%{_libdir}" \
e32ce18
    PYTHONPATH="%{buildroot}%{_libdir}/python%{pybasever} %{buildroot}%{_libdir}/python%{pybasever}/site-packages" \
e32ce18
    xargs -0 %{buildroot}%{_bindir}/python%{pybasever} -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("%{buildroot}")[2]) for f in sys.argv[1:]]' || :
e32ce18
# compile *.pyc
e32ce18
find %{buildroot} -type f -a -name "*.py" -print0 | \
e32ce18
    LD_LIBRARY_PATH="%{buildroot}%{dynload_dir}/:%{buildroot}%{_libdir}" \
e32ce18
    PYTHONPATH="%{buildroot}%{_libdir}/python%{pybasever} %{buildroot}%{_libdir}/python%{pybasever}/site-packages" \
e32ce18
    xargs -0 %{buildroot}%{_bindir}/python%{pybasever} -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("%{buildroot}")[2], optimize=0) for f in sys.argv[1:]]' || :
e32ce18
e32ce18
# Fixup permissions for shared libraries from non-standard 555 to standard 755:
e32ce18
find %{buildroot} \
e32ce18
    -perm 555 -exec chmod 755 {} \;
e32ce18
e32ce18
# Install macros for rpm:
e32ce18
mkdir -p %{buildroot}/%{_rpmconfigdir}/macros.d/
e32ce18
install -m 644 %{SOURCE3} %{buildroot}/%{_rpmconfigdir}/macros.d/
e32ce18
e32ce18
# Ensure that the curses module was linked against libncursesw.so, rather than
e32ce18
# libncurses.so (bug 539917)
e32ce18
ldd %{buildroot}/%{dynload_dir}/_curses*.so \
e32ce18
    | grep curses \
e32ce18
    | grep libncurses.so && (echo "_curses.so linked against libncurses.so" ; exit 1)
e32ce18
e32ce18
# Ensure that the debug modules are linked against the debug libpython, and
e32ce18
# likewise for the optimized modules and libpython:
e32ce18
for Module in %{buildroot}/%{dynload_dir}/*.so ; do
e32ce18
    case $Module in
e32ce18
    *.%{SOABI_debug})
e32ce18
        ldd $Module | grep %{py_INSTSONAME_optimized} &&
e32ce18
            (echo Debug module $Module linked against optimized %{py_INSTSONAME_optimized} ; exit 1)
e32ce18
            
e32ce18
        ;;
e32ce18
    *.%{SOABI_optimized})
e32ce18
        ldd $Module | grep %{py_INSTSONAME_debug} &&
e32ce18
            (echo Optimized module $Module linked against debug %{py_INSTSONAME_debug} ; exit 1)
e32ce18
        ;;
e32ce18
    esac
e32ce18
done
e32ce18
e32ce18
#
e32ce18
# Systemtap hooks:
e32ce18
#
e32ce18
%if 0%{?with_systemtap}
e32ce18
# Install a tapset for this libpython into tapsetdir, fixing up the path to the
e32ce18
# library:
e32ce18
mkdir -p %{buildroot}%{tapsetdir}
e32ce18
%ifarch %{power64} s390x x86_64 ia64 alpha sparc64 aarch64
e32ce18
%global libpython_stp_optimized libpython%{pybasever}-64.stp
e32ce18
%global libpython_stp_debug     libpython%{pybasever}-debug-64.stp
e32ce18
%else
e32ce18
%global libpython_stp_optimized libpython%{pybasever}-32.stp
e32ce18
%global libpython_stp_debug     libpython%{pybasever}-debug-32.stp
e32ce18
%endif
e32ce18
e32ce18
sed \
e32ce18
   -e "s|LIBRARY_PATH|%{_libdir}/%{py_INSTSONAME_optimized}|" \
e32ce18
   %{_sourcedir}/libpython.stp \
e32ce18
   > %{buildroot}%{tapsetdir}/%{libpython_stp_optimized}
e32ce18
e32ce18
%if 0%{?with_debug_build}
e32ce18
# In Python 3, python3 and python3-debug don't point to the same binary,
e32ce18
# so we have to replace "python3" with "python3-debug" to get systemtap
e32ce18
# working with debug build
e32ce18
sed \
e32ce18
   -e "s|LIBRARY_PATH|%{_libdir}/%{py_INSTSONAME_debug}|" \
e32ce18
   -e 's|"python3"|"python3-debug"|' \
e32ce18
   %{_sourcedir}/libpython.stp \
e32ce18
   > %{buildroot}%{tapsetdir}/%{libpython_stp_debug}
e32ce18
%endif # with_debug_build
e32ce18
e32ce18
%endif # with_systemtap
e32ce18
e32ce18
# Rename the script that differs on different arches to arch specific name
e32ce18
mv %{buildroot}%{_bindir}/python%{LDVERSION_optimized}-{,`uname -m`-}config
e32ce18
echo -e '#!/bin/sh\nexec `dirname $0`/python%{LDVERSION_optimized}-`uname -m`-config "$@"' > \
e32ce18
  %{buildroot}%{_bindir}/python%{LDVERSION_optimized}-config
e32ce18
echo '[ $? -eq 127 ] && echo "Could not find python%{LDVERSION_optimized}-`uname -m`-config. Look around to see available arches." >&2' >> \
e32ce18
  %{buildroot}%{_bindir}/python%{LDVERSION_optimized}-config
e32ce18
  chmod +x %{buildroot}%{_bindir}/python%{LDVERSION_optimized}-config
e32ce18
3fbbcab
# Remove stuff that would conflict with python3 package
3fbbcab
mv %{buildroot}%{_bindir}/python{3,%{pyshortver}}
2b37324
rm %{buildroot}%{_bindir}/*3  # also matches 2to3
3fbbcab
rm %{buildroot}%{_bindir}/python3-*
3fbbcab
rm %{buildroot}%{_bindir}/pyvenv
3fbbcab
rm %{buildroot}%{_libdir}/libpython3.so
3fbbcab
rm %{buildroot}%{_mandir}/man1/python3.1*
3fbbcab
rm %{buildroot}%{_libdir}/pkgconfig/python3.pc
3fbbcab
e32ce18
# ======================================================
e32ce18
# Running the upstream test suite
e32ce18
# ======================================================
e32ce18
e32ce18
%check
e32ce18
e32ce18
# first of all, check timestamps of bytecode files
e32ce18
find %{buildroot} -type f -a -name "*.py" -print0 | \
e32ce18
    LD_LIBRARY_PATH="%{buildroot}%{dynload_dir}/:%{buildroot}%{_libdir}" \
e32ce18
    PYTHONPATH="%{buildroot}%{_libdir}/python%{pybasever} %{buildroot}%{_libdir}/python%{pybasever}/site-packages" \
e32ce18
    xargs -0 %{buildroot}%{_bindir}/python%{pybasever} %{SOURCE8}
e32ce18
e32ce18
e32ce18
topdir=$(pwd)
e32ce18
CheckPython() {
e32ce18
  ConfName=$1	      
e32ce18
  ConfDir=$(pwd)/build/$ConfName
e32ce18
e32ce18
  echo STARTING: CHECKING OF PYTHON FOR CONFIGURATION: $ConfName
e32ce18
e32ce18
  # Note that we're running the tests using the version of the code in the
e32ce18
  # builddir, not in the buildroot.
e32ce18
e32ce18
  # Run the upstream test suite, setting "WITHIN_PYTHON_RPM_BUILD" so that the
e32ce18
  # our non-standard decorators take effect on the relevant tests:
e32ce18
  #   @unittest._skipInRpmBuild(reason)
e32ce18
  #   @unittest._expectedFailureInRpmBuild
e32ce18
  # test_faulthandler.test_register_chain currently fails on ppc64le and
e32ce18
  #   aarch64, see upstream bug http://bugs.python.org/issue21131
bded33c
  # test_buffer fails with Decimal on ppc64le,
bded33c
  #   see https://bugzilla.redhat.com/show_bug.cgi?id=1544833
e32ce18
  WITHIN_PYTHON_RPM_BUILD= \
e32ce18
  LD_LIBRARY_PATH=$ConfDir $ConfDir/python -m test.regrtest \
e32ce18
    --verbose --findleaks \
e32ce18
    -x test_distutils \
e32ce18
    %ifarch ppc64le aarch64
e32ce18
    -x test_faulthandler \
e32ce18
    %endif
bded33c
    %ifarch ppc64le
bded33c
    -x test_buffer \
bded33c
    %endif
e32ce18
    %ifarch %{power64} s390 s390x armv7hl aarch64
daebc62
    -x test_gdb \
e32ce18
    %endif
e32ce18
e32ce18
  echo FINISHED: CHECKING OF PYTHON FOR CONFIGURATION: $ConfName
e32ce18
e32ce18
}
e32ce18
e32ce18
%if 0%{run_selftest_suite}
e32ce18
e32ce18
# Check each of the configurations:
e32ce18
%if 0%{?with_debug_build}
e32ce18
CheckPython debug
e32ce18
%endif # with_debug_build
e32ce18
CheckPython optimized
e32ce18
e32ce18
%endif # run_selftest_suite
e32ce18
e32ce18
e32ce18
%files
e32ce18
%doc LICENSE README
08fb60f
%doc Misc/README.valgrind Misc/valgrind-python.supp Misc/gdbinit
08fb60f
3fbbcab
%{_bindir}/pydoc%{pybasever}
e32ce18
%{_bindir}/python%{pybasever}
3fbbcab
%{_bindir}/python%{pyshortver}
e32ce18
%{_bindir}/python%{pybasever}m
e32ce18
%{_bindir}/pyvenv-%{pybasever}
e32ce18
%{_mandir}/*/*
e32ce18
08fb60f
%{pylibdir}/
e32ce18
e32ce18
%if "%{_lib}" == "lib64"
e32ce18
%attr(0755,root,root) %dir %{_prefix}/lib/python%{pybasever}
e32ce18
%attr(0755,root,root) %dir %{_prefix}/lib/python%{pybasever}/site-packages
e32ce18
%attr(0755,root,root) %dir %{_prefix}/lib/python%{pybasever}/site-packages/__pycache__/
e32ce18
%endif
e32ce18
e32ce18
%{_libdir}/%{py_INSTSONAME_optimized}
e32ce18
%if 0%{?with_systemtap}
e32ce18
%dir %(dirname %{tapsetdir})
e32ce18
%dir %{tapsetdir}
e32ce18
%{tapsetdir}/%{libpython_stp_optimized}
e32ce18
%doc systemtap-example.stp pyfuntop.stp
e32ce18
%endif
e32ce18
08fb60f
%{_includedir}/python%{LDVERSION_optimized}/
590bf1d
e32ce18
%{_bindir}/python%{pybasever}-config
e32ce18
%{_bindir}/python%{LDVERSION_optimized}-config
e32ce18
%{_bindir}/python%{LDVERSION_optimized}-*-config
e32ce18
%{_libdir}/libpython%{LDVERSION_optimized}.so
e32ce18
%{_libdir}/pkgconfig/python-%{LDVERSION_optimized}.pc
e32ce18
%{_libdir}/pkgconfig/python-%{pybasever}.pc
08fb60f
%exclude %{_rpmconfigdir}/macros.d/macros.pybytecompile%{pybasever}
e32ce18
e32ce18
%{_bindir}/2to3-%{pybasever}
3fbbcab
%{_bindir}/idle%{pybasever}
e32ce18
213612f
# https://bugzilla.redhat.com/show_bug.cgi?id=1476593
213612f
%exclude /usr/lib/debug%{_libdir}/__pycache__/libpython%{pybasever}m.so.1.0.debug-gdb.cpython-%{pyshortver}.py*
213612f
%exclude /usr/lib/debug%{_libdir}/libpython%{pybasever}m.so.1.0.debug-gdb.py
213612f
e32ce18
%if 0%{?with_debug_build}
e32ce18
%{_bindir}/python%{LDVERSION_debug}
e32ce18
e32ce18
%{_libdir}/%{py_INSTSONAME_debug}
e32ce18
%if 0%{?with_systemtap}
e32ce18
%{tapsetdir}/%{libpython_stp_debug}
e32ce18
%endif
e32ce18
e32ce18
%{_includedir}/python%{LDVERSION_debug}
e32ce18
%{_bindir}/python%{LDVERSION_debug}-config
e32ce18
%{_libdir}/libpython%{LDVERSION_debug}.so
08fb60f
%{_libdir}/libpython%{LDVERSION_debug}.so.1.0
e32ce18
%{_libdir}/pkgconfig/python-%{LDVERSION_debug}.pc
e32ce18
e32ce18
%endif # with_debug_build
e32ce18
e32ce18
e32ce18
# ======================================================
e32ce18
# Finally, the changelog:
e32ce18
# ======================================================
e32ce18
e32ce18
%changelog
659fdac
* Mon Jan 14 2019 Björn Esser <besser82@fedoraproject.org> - 3.4.9-6
659fdac
- Rebuilt for libcrypt.so.2 (#1666033)
659fdac
666196f
* Fri Jan 11 2019 Björn Esser <besser82@fedoraproject.org> - 3.4.9-5
666196f
- Add missing semicolon in patch 00290
666196f
47f3a0b
* Mon Sep 24 2018 Miro Hrončok <mhroncok@redhat.com> - 3.4.9-4
47f3a0b
- Security fix for CVE-2018-14647 (#1631822)
47f3a0b
c276ba9
* Tue Aug 21 2018 Miro Hrončok <mhroncok@redhat.com> - 3.4.9-3
c276ba9
- Use RPM built wheels of pip and setuptools in ensurepip instead of bundled ones
c276ba9
2e36981
* Wed Aug 08 2018 Miro Hrončok <mhroncok@redhat.com> - 3.4.9-2
2e36981
- Fix bundled pip/setuptools versions
2e36981
25d559a
* Sun Aug 05 2018 Miro Hrončok <mhroncok@redhat.com> - 3.4.9-1
25d559a
- Rebased to 3.4.9
25d559a
52a4d45
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.8-4
52a4d45
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
52a4d45
246bfef
* Tue Apr 24 2018 Miro Hrončok <mhroncok@redhat.com> - 3.4.8-3
246bfef
- Fix multiprocessing regression on newer glibcs
246bfef
- Enable test_multiprocessing_fork(server) and _spawn again
246bfef
Resolves: rhbz#1569933
246bfef
daebc62
* Fri Apr 20 2018 Miro Hrončok <mhroncok@redhat.com> - 3.4.8-2
648bb82
- Do not ship the Tools directory
daebc62
- Skip test_multiprocessing_fork(server) and _spawn for now
648bb82
bded33c
* Tue Feb 13 2018 Petr Viktorin <pviktori@redhat.com> - 3.4.8-1
bded33c
- Update to 3.4.8 bugfix release
bded33c
- Add patch 00290 to fix build with libxcrypt
bded33c
- Disable test_buffer on ppc64le
bded33c
8a190c9
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.7-4
8a190c9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
8a190c9
4650752
* Sat Jan 20 2018 Björn Esser <besser82@fedoraproject.org> - 3.4.7-3
4650752
- Rebuilt for switch to libxcrypt
4650752
c7590d4
* Fri Dec 08 2017 Miro Hrončok <mhroncok@redhat.com> - 3.4.7-2
c7590d4
- Fix for CVE-2017-1000158
c7590d4
- rhbz#1519601: https://bugzilla.redhat.com/show_bug.cgi?id=1519601
c7590d4
833e4bd
* Thu Nov 02 2017 Charalampos Stratakis <cstratak@redhat.com> - 3.4.7-1
833e4bd
- Update to 3.4.7
833e4bd
d1a121a
* Mon Aug 14 2017 David "Sanqui" Labský <dlabsky@redhat.com> - 3.4.5-8
d1a121a
- Drop unused db4-devel dependency
d1a121a
d86265a
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.5-7
d86265a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
d86265a
bdf815c
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.5-6
bdf815c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
bdf815c
2206251
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.5-5
2206251
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
2206251
Igor Gnatenko c5cd760
* Thu Jan 12 2017 Igor Gnatenko <ignatenko@redhat.com> - 3.4.5-4
Igor Gnatenko c5cd760
- Rebuild for readline 7.x
Igor Gnatenko c5cd760
028378c
* Tue Jan 10 2017 Charalampos Stratakis <cstratak@redhat.com> - 3.4.5-3
028378c
- Require glibc >= 2.24.90-26 (rhbz#1410644)
028378c
- Don't blow up on EL7 kernel (random generator) (rhbz#1410175, rhbz#1410187)
028378c
b689106
* Fri Oct 21 2016 Miro Hrončok <mhroncok@redhat.com> - 3.4.5-2
b689106
- Reword the description
92f62d9
- On Fedora 26+, BR compat-openssl10-devel
b689106
57f132b
* Thu Sep 22 2016 Miro Hrončok <mhroncok@redhat.com> - 3.4.5-1
57f132b
- Updated to 3.4.5
57f132b
b5ef396
* Thu Aug 11 2016 Miro Hrončok <mhroncok@redhat.com> - 3.4.3-11
b5ef396
- Imported from F23