churchyard / rpms / python3

Forked from rpms/python3 4 years ago
Clone

Blame python37.spec

043c574
# ==================
043c574
# Top-level metadata
043c574
# ==================
043c574
d668c1e
%global pybasever 3.7
c769a6b
043c574
# pybasever without the dot:
d668c1e
%global pyshortver 37
d668c1e
63459d7
Name: python%{pyshortver}
63459d7
Summary:  Version %{pybasever} of the Python interpreter
63459d7
URL: https://www.python.org/
63459d7
63459d7
d668c1e
# Second alpha
c9349a7
%global prerel a4
043c574
b7855d3
#  WARNING  When rebasing to a new Python version,
b7855d3
#           remember to update the python3-docs package as well
d668c1e
Version: %{pybasever}.0
7f3ae64
Release: 0.3.%{?prerel}%{?dist}
043c574
License: Python
043c574
043c574
043c574
# ==================================
043c574
# Conditionals controlling the build
043c574
# ==================================
043c574
043c574
# Note that the bcond macros are named for the CLI option they create.
043c574
# "%%bcond_without" means "ENABLE by default and create a --without option"
043c574
63459d7
63459d7
# Flat package, i.e. python36, python37, python38 for tox etc.
63459d7
# warning: changes some other defaults
63459d7
# in Fedora, never turn this on for the python3 package
63459d7
# and always keep it on for python37 etc.
63459d7
# WARNING: This does not change the package name and summary above
63459d7
%bcond_without flatpackage
63459d7
63459d7
f63e273
# Expensive optimizations (mainly, profile-guided optimizations)
a7a170b
%ifarch %{ix86} x86_64
a7a170b
%bcond_without optimizations
a7a170b
%else
f63e273
# On some architectures, the optimized build takes tens of hours, possibly
f63e273
# longer than Koji's 24-hour timeout. Disable optimizations here.
a7a170b
%bcond_with optimizations
a7a170b
%endif
a7a170b
f63e273
# Run the test suite in %%check
043c574
%bcond_without tests
f63e273
f63e273
# Ability to reuse RPM-installed pip using rewheel
63459d7
%if %{with flatpackage}
63459d7
%bcond_with rewheel
63459d7
%else
043c574
%bcond_without rewheel
63459d7
%endif
f63e273
f63e273
# Extra build for debugging the interpreter or C-API extensions
f63e273
# (the -debug subpackages)
63459d7
%if %{with flatpackage}
63459d7
%bcond_with debug_build
63459d7
%else
043c574
%bcond_without debug_build
63459d7
%endif
f63e273
f63e273
# Support for the GDB debugger
043c574
%bcond_without gdb_hooks
f63e273
f63e273
# Support for systemtap instrumentation
043c574
%bcond_with systemtap
f63e273
f63e273
# The dbm.gnu module (key-value database)
043c574
%bcond_without gdbm
f63e273
f63e273
# Main interpreter loop optimization
043c574
%bcond_without computed_gotos
043c574
f63e273
# Support for the Valgrind debugger/profiler
043c574
%ifnarch s390 %{mips} riscv64
043c574
%bcond_without valgrind
043c574
%else
f63e273
# Some arches don't have valgrind, disable support for it there.
043c574
%bcond_with valgrind
043c574
%endif
043c574
043c574
043c574
# ==================================
043c574
# Notes from bootstraping Python 3.6
043c574
# ==================================
Matej Stuchlik 95668bd
#
59c11e6
# New Python major version (3.X) break ABI and bytecode compatibility,
59c11e6
# so all packages depending on it need to be rebuilt.
59c11e6
#
afb0016
# Due to a dependency cycle between Python, gdb, rpm, pip, setuptools, wheel,
59c11e6
# and other packages, this isn't straightforward.
59c11e6
# Build in the following order:
Matej Stuchlik 95668bd
#
bb9ca6b
# 1. At the same time:
59c11e6
#     - gdb without python support (add %%global _without_python 1 on top of
59c11e6
#       gdb's SPEC file)
bb9ca6b
#     - python-rpm-generators with bootstrapping_python set to 1
bb9ca6b
#       (this can be done also during step 2., but should be done before 3.)
59c11e6
# 2. python3 without rewheel (use %%bcond_with rewheel instead of
59c11e6
#     %%bcond_without)
bb9ca6b
# 3. At the same time:
59c11e6
#     - gdb with python support (remove %%global _without_python 1 on top of
59c11e6
#       gdb's SPEC file)
bb9ca6b
#     - python-rpm-generators with bootstrapping_python set to 0
bb9ca6b
#       (this can be done at any later step without negative effects)
afb0016
# 4. rpm
afb0016
# 5. python-setuptools with bootstrap set to 1
afb0016
# 6. python-pip with build_wheel set to 0
afb0016
# 7. python-wheel with %%bcond_without bootstrap
afb0016
# 8. python-setuptools with bootstrap set to 0 and also with_check set to 0
afb0016
# 9. python-pip with build_wheel set to 1
afb0016
# 10. pyparsing
59c11e6
# 11. python3 with rewheel
afb0016
#
59c11e6
# Then the most important packages have to be built, in dependency order.
59c11e6
# These were:
afb0016
#   python-sphinx, pytest, python-requests, cloud-init, dnf, anaconda, abrt
59c11e6
#
59c11e6
# After these have been built, a targeted rebuild should be done for the rest.
Matej Stuchlik 95668bd
Matej Stuchlik 11fb599
043c574
# =====================
043c574
# General global macros
043c574
# =====================
5080ffc
a3483f9
%global pylibdir %{_libdir}/python%{pybasever}
4aab458
%global dynload_dir %{pylibdir}/lib-dynload
a3483f9
0c74e11
# ABIFLAGS, LDVERSION and SOABI are in the upstream configure.ac
0c74e11
# See PEP 3149 for some background: http://www.python.org/dev/peps/pep-3149/
1c94c1a
%global ABIFLAGS_optimized m
1c94c1a
%global ABIFLAGS_debug     dm
5080ffc
5080ffc
%global LDVERSION_optimized %{pybasever}%{ABIFLAGS_optimized}
5080ffc
%global LDVERSION_debug     %{pybasever}%{ABIFLAGS_debug}
5080ffc
Robert Kuska 08f3736
%global SOABI_optimized cpython-%{pyshortver}%{ABIFLAGS_optimized}-%{_arch}-linux%{_gnu}
Robert Kuska 08f3736
%global SOABI_debug     cpython-%{pyshortver}%{ABIFLAGS_debug}-%{_arch}-linux%{_gnu}
5080ffc
0c74e11
# All bytecode files are in a __pycache__ subdirectory, with a name
0c74e11
# reflecting the version of the bytecode.
0c74e11
# See PEP 3147: http://www.python.org/dev/peps/pep-3147/
7eb10c8
# For example,
7eb10c8
#   foo/bar.py
0c74e11
# has bytecode at:
043c574
#   foo/__pycache__/bar.cpython-%%{pyshortver}.pyc
043c574
#   foo/__pycache__/bar.cpython-%%{pyshortver}.opt-1.pyc
043c574
#	foo/__pycache__/bar.cpython-%%{pyshortver}.opt-2.pyc
043c574
%global bytecode_suffixes .cpython-%{pyshortver}*.pyc
7eb10c8
d5a5bf3
# Python's configure script defines SOVERSION, and this is used in the Makefile
d5a5bf3
# to determine INSTSONAME, the name of the libpython DSO:
d5a5bf3
#   LDLIBRARY='libpython$(VERSION).so'
d5a5bf3
#   INSTSONAME="$LDLIBRARY".$SOVERSION
d5a5bf3
# We mirror this here in order to make it easier to add the -gdb.py hooks.
d5a5bf3
# (if these get out of sync, the payload of the libs subpackage will fail
d5a5bf3
# and halt the build)
d5a5bf3
%global py_SOVERSION 1.0
5080ffc
%global py_INSTSONAME_optimized libpython%{LDVERSION_optimized}.so.%{py_SOVERSION}
5080ffc
%global py_INSTSONAME_debug     libpython%{LDVERSION_debug}.so.%{py_SOVERSION}
d5a5bf3
1824b3e
# Disable automatic bytecompilation. The python3 binary is not yet be
1824b3e
# available in /usr/bin when Python is built. Also, the bytecompilation fails
1824b3e
# on files that test invalid syntax.
1824b3e
%undefine py_auto_byte_compile
7eb10c8
64593af
# For multilib support, files that are different between 32- and 64-bit arches
64593af
# need different filenames. Use "64" or "32" according to the word size.
4ced9a1
# Currently, the best way to determine an architecture's word size happens to
4ced9a1
# be checking %%{_lib}.
4ced9a1
%if "%{_lib}" == "lib64"
64593af
%global wordsize 64
64593af
%else
64593af
%global wordsize 32
64593af
%endif
64593af
64593af
c769a6b
# =======================
c769a6b
# Build-time requirements
c769a6b
# =======================
c769a6b
c769a6b
# (keep this list alphabetized)
c769a6b
c769a6b
BuildRequires: autoconf
81ac8c8
BuildRequires: bluez-libs-devel
c769a6b
BuildRequires: bzip2
c769a6b
BuildRequires: bzip2-devel
66c621f
BuildRequires: desktop-file-utils
33e1101
BuildRequires: expat-devel
5974f19
c769a6b
BuildRequires: findutils
c769a6b
BuildRequires: gcc-c++
043c574
%if %{with gdbm}
c769a6b
BuildRequires: gdbm-devel
5fe31d8
%endif
c769a6b
BuildRequires: glibc-devel
c769a6b
BuildRequires: gmp-devel
66c621f
BuildRequires: libappstream-glib
c769a6b
BuildRequires: libffi-devel
c9349a7
BuildRequires: libnsl2-devel
c9349a7
BuildRequires: libtirpc-devel
c769a6b
BuildRequires: libGL-devel
d668c1e
BuildRequires: libuuid-devel
c769a6b
BuildRequires: libX11-devel
c769a6b
BuildRequires: ncurses-devel
66c621f
c769a6b
BuildRequires: openssl-devel
c769a6b
BuildRequires: pkgconfig
c769a6b
BuildRequires: readline-devel
c769a6b
BuildRequires: sqlite-devel
47069ff
BuildRequires: gdb
c769a6b
51501f9
%if %{with systemtap}
af1b222
BuildRequires: systemtap-devel
51501f9
BuildRequires: systemtap-sdt-devel
c769a6b
%global tapsetdir      /usr/share/systemtap/tapset
51501f9
%endif
c769a6b
c769a6b
BuildRequires: tar
c769a6b
BuildRequires: tcl-devel
c769a6b
BuildRequires: tix-devel
c769a6b
BuildRequires: tk-devel
c769a6b
043c574
%if %{with valgrind}
c769a6b
BuildRequires: valgrind-devel
c769a6b
%endif
c769a6b
f2b86e2
BuildRequires: xz-devel
c769a6b
BuildRequires: zlib-devel
c769a6b
51501f9
BuildRequires: /usr/bin/dtrace
51501f9
5f24f39
# workaround http://bugs.python.org/issue19804 (test_uuid requires ifconfig)
5f24f39
BuildRequires: /usr/sbin/ifconfig
5f24f39
043c574
%if %{with rewheel}
Matej Stuchlik 11fb599
BuildRequires: python3-setuptools
Matej Stuchlik 11fb599
BuildRequires: python3-pip
Matej Stuchlik 11fb599
%endif
Matej Stuchlik 11fb599
c769a6b
c769a6b
# =======================
c769a6b
# Source code and patches
c769a6b
# =======================
c769a6b
d668c1e
Source: https://www.python.org/ftp/python/%{version}/Python-%{version}%{prerel}.tar.xz
a3483f9
4aab458
# Supply an RPM macro "py_byte_compile" for the python3-devel subpackage
4aab458
# to enable specfiles to selectively byte-compile individual files and paths
4aab458
# with different Python runtimes as necessary:
Matej Stuchlik 318f360
Source3: macros.pybytecompile%{pybasever}
4aab458
c969609
# Systemtap tapset to make it easier to use the systemtap static probes
c969609
# (actually a template; LIBRARY_PATH will get fixed up during install)
c969609
# Written by dmalcolm; not yet sent upstream
c969609
Source5: libpython.stp
c969609
c969609
# Example systemtap script using the tapset
c969609
# Written by wcohen, mjw, dmalcolm; not yet sent upstream
c969609
Source6: systemtap-example.stp
c969609
71040c9
# Another example systemtap script that uses the tapset
71040c9
# Written by dmalcolm; not yet sent upstream
71040c9
Source7: pyfuntop.stp
71040c9
3dbbc14
# A simple script to check timestamps of bytecode files
3dbbc14
# Run in check section with Python that is currently being built
3dbbc14
# Written by bkabrda
3dbbc14
Source8: check-pyc-and-pyo-timestamps.py
71040c9
11efc8e
# Backward compatible no-op macro for system-python
11efc8e
# Remove in Fedora 29
60aba0a
Source9: macros.systempython
60aba0a
860f392
# Desktop menu entry for idle3
860f392
Source10: idle3.desktop
860f392
860f392
# AppData file for idle3
860f392
Source11: idle3.appdata.xml
860f392
d27ccf6
# 00001 #
a3483f9
# Fixup distutils/unixccompiler.py to remove standard library path from rpath:
a3483f9
# Was Patch0 in ivazquez' python3000 specfile:
d27ccf6
Patch1:         00001-rpath.patch
a3483f9
6b34963
# 00055 #
c969609
# Systemtap support: add statically-defined probe points
1c94c1a
# Patch sent upstream as http://bugs.python.org/issue14776
62d7207
# with some subsequent reworking to cope with LANG=C in an rpmbuild
62d7207
# (where sys.getfilesystemencoding() == 'ascii')
c923b51
Patch55: 00055-systemtap.patch
c969609
2c6abcc
# 00102 #
2c6abcc
# Change the various install paths to use /usr/lib64/ instead or /usr/lib
c923b51
# Only used when "%{_lib}" == "lib64"
2c6abcc
# Not yet sent upstream.
2c6abcc
Patch102: 00102-lib64.patch
c923b51
6b34963
# 00111 #
c923b51
# Patch the Makefile.pre.in so that the generated Makefile doesn't try to build
c4a5733
# a libpythonMAJOR.MINOR.a
c4a5733
# See https://bugzilla.redhat.com/show_bug.cgi?id=556092
bbb5084
# Downstream only: not appropriate for upstream
c923b51
Patch111: 00111-no-static-lib.patch
c923b51
6b34963
# 00132 #
0c8875f
# Add non-standard hooks to unittest for use in the "check" phase below, when
0c8875f
# running selftests within the build:
0c8875f
#   @unittest._skipInRpmBuild(reason)
0c8875f
# for tests that hang or fail intermittently within the build environment, and:
0c8875f
#   @unittest._expectedFailureInRpmBuild
0c8875f
# for tests that always fail within the build environment
0c8875f
#
0c8875f
# The hooks only take effect if WITHIN_PYTHON_RPM_BUILD is set in the
0c8875f
# environment, which we set manually in the appropriate portion of the "check"
0c8875f
# phase below (and which potentially other python-* rpms could set, to reuse
0c8875f
# these unittest hooks in their own "check" phases)
0c8875f
Patch132: 00132-add-rpmbuild-hooks-to-unittest.patch
0c8875f
6b34963
# 00155 #
8a28107
# Avoid allocating thunks in ctypes unless absolutely necessary, to avoid
8a28107
# generating SELinux denials on "import ctypes" and "import uuid" when
c4a5733
# embedding Python within httpd
c4a5733
# See https://bugzilla.redhat.com/show_bug.cgi?id=814391
8a28107
Patch155: 00155-avoid-ctypes-thunks.patch
8a28107
823581e
# 00160 #
3b4dd24
# Python 3.3 added os.SEEK_DATA and os.SEEK_HOLE, which may be present in the
3b4dd24
# header files in the build chroot, but may not be supported in the running
3b4dd24
# kernel, hence we disable this test in an rpm build.
3b4dd24
# Adding these was upstream issue http://bugs.python.org/issue10142
3b4dd24
# Not yet sent upstream
823581e
Patch160: 00160-disable-test_fs_holes-in-rpm-build.patch
3b4dd24
48d2048
# 00163 #
48d2048
# Some tests within test_socket fail intermittently when run inside Koji;
48d2048
# disable them using unittest._skipInRpmBuild
48d2048
# Not yet sent upstream
48d2048
Patch163: 00163-disable-parts-of-test_socket-in-rpm-build.patch
48d2048
Robert Kuska a0e3ab8
# 00170 #
Robert Kuska a0e3ab8
# In debug builds, try to print repr() when a C-level assert fails in the
Robert Kuska a0e3ab8
# garbage collector (typically indicating a reference-counting error
Robert Kuska a0e3ab8
# somewhere else e.g in an extension module)
720c2ad
# The new macros/functions within gcmodule.c are hidden to avoid exposing
Robert Kuska a0e3ab8
# them within the extension API.
720c2ad
# Sent upstream: http://bugs.python.org/issue9263
720c2ad
# See https://bugzilla.redhat.com/show_bug.cgi?id=614680
Robert Kuska 86a9a20
Patch170: 00170-gc-assertions.patch
260ceea
5023236
# 00178 #
5023236
# Don't duplicate various FLAGS in sysconfig values
5023236
# http://bugs.python.org/issue17679
5023236
# Does not affect python2 AFAICS (different sysconfig values initialization)
5023236
Patch178: 00178-dont-duplicate-flags-in-sysconfig.patch
e721470
Matej Stuchlik 11fb599
# 00189 #
Matej Stuchlik 11fb599
# Add the rewheel module, allowing to recreate wheels from already installed
Matej Stuchlik 11fb599
# ones
Matej Stuchlik 11fb599
# https://github.com/bkabrda/rewheel
Matej Stuchlik 11fb599
Patch189: 00189-add-rewheel-module.patch
486eb43
3702d0d
# 00205 #
Robert Kuska a52deaa
# LIBPL variable in makefile takes LIBPL from configure.ac
Robert Kuska a52deaa
# but the LIBPL variable defined there doesn't respect libdir macro
Robert Kuska a52deaa
Patch205: 00205-make-libpl-respect-lib64.patch
Robert Kuska a52deaa
332b947
# 00251
332b947
# Set values of prefix and exec_prefix in distutils install command
332b947
# to /usr/local if executable is /usr/bin/python* and RPM build
332b947
# is not detected to make pip and distutils install into separate location
46034c8
# Fedora Change: https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe
332b947
Patch251: 00251-change-user-install-location.patch
332b947
27c558e
# 00264 #
27c558e
# test_pass_by_value was added in Python 3.6.1 and on aarch64
27c558e
# it is catching an error that was there, but wasn't tested before.
27c558e
# Therefore skipping the test on aarch64 until fixed upstream.
27c558e
# Reported upstream: http://bugs.python.org/issue29804
27c558e
Patch264: 00264-skip-test-failing-on-aarch64.patch
27c558e
74f6a3d
# 00273 #
74f6a3d
# Skip test_float_with_comma, which fails in Koji with UnicodeDecodeError
c4a5733
# See https://bugzilla.redhat.com/show_bug.cgi?id=1484497
74f6a3d
Patch273: 00273-skip-float-test.patch
74f6a3d
9423d36
# 00274 #
9423d36
# Upstream uses Debian-style architecture naming. Change to match Fedora.
9423d36
Patch274: 00274-fix-arch-names.patch
9423d36
c9349a7
# 00289 #
c9349a7
# Fix the compilation of the nis module, as glibc removed the
c9349a7
# interfaces related to Sun RPC and they are now provided
c9349a7
# by libtirpc and libnsl2.
c9349a7
# See: https://fedoraproject.org/wiki/Changes/SunRPCRemoval
c9349a7
# and https://fedoraproject.org/wiki/Changes/NISIPv6
c9349a7
# Fixed upstream: https://bugs.python.org/issue32521
c9349a7
Patch289: 00289-fix-nis-compilation.patch
22b8f2b
99ac2fc
# (New patches go here ^^^)
99ac2fc
#
77a5f91
# When adding new patches to "python" and "python3" in Fedora, EL, etc.,
77a5f91
# please try to keep the patch numbers in-sync between all specfiles.
99ac2fc
#
77a5f91
# More information, and a patch number catalog, is at:
99ac2fc
#
77a5f91
#     https://fedoraproject.org/wiki/SIGs/Python/PythonPatches
77a5f91
c969609
094ccc0
# ==========================================
094ccc0
# Descriptions, and metadata for subpackages
094ccc0
# ==========================================
a3483f9
63459d7
%if %{without flatpackage}
63459d7
094ccc0
# Packages with Python modules in standard locations automatically
094ccc0
# depend on python(abi). Provide that here.
a3483f9
Provides: python(abi) = %{pybasever}
a3483f9
11efc8e
# For backward compatibility only, remove in F29:
11efc8e
Provides: system-python(abi) = %{pybasever}
11efc8e
Provides: system-python = %{version}-%{release}
11efc8e
Provides: system-python%{?_isa} = %{version}-%{release}
11efc8e
Obsoletes: system-python < %{version}-%{release}
11efc8e
26c1be5
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
26c1be5
f50a7d3
# In order to support multiple Python interpreters for development purposes,
63459d7
# packages with with the naming scheme flatpackage (e.g. python35) exist for
f50a7d3
# non-default versions of Python 3.
f50a7d3
# For consistency, and to keep the upgrade path clean, we Provide/Obsolete
f50a7d3
# these names here.
1768987
Provides: python%{pyshortver} = %{version}-%{release}
f50a7d3
# Note that using Obsoletes without package version is not standard practice.
f50a7d3
# Here we assert that *any* version of the system's default interpreter is
f50a7d3
# preferable to an "extra" interpreter. For example, python3-3.6.1 will
f50a7d3
# replace python36-3.6.2.
f50a7d3
Obsoletes: python%{pyshortver}
1768987
e522c84
# Shall be removed in Fedora 31
1f528da
# The release is bumped to 20, so we can do f27 platform-python updates
1f528da
# If the release in f27 ever goes >= 20, raise it here
1f528da
# If platform-python is ever reintroduced, make it higher version than this:
1f528da
%global platpyver 3.6.2-20
e522c84
Obsoletes: platform-python < %{platpyver}
e522c84
043c574
%if %{with rewheel}
f30edc5
Requires: python3-setuptools
f30edc5
Requires: python3-pip
Matej Stuchlik f498010
%endif
Matej Stuchlik f498010
15a5ab1
# The description used both for the SRPM and the main `python3` subpackage:
a3483f9
%description
c2f8719
Python is an accessible, high-level, dynamically typed, interpreted programming
c2f8719
language, designed with an emphasis on code readibility.
c2f8719
It includes an extensive standard library, and has a vast ecosystem of
c2f8719
third-party libraries.
6245861
15a5ab1
The ${name} package provides the "python3" executable: the reference
15a5ab1
interpreter for the Python language, version 3.
c2f8719
The majority of its standard library is provided in the %{name}-libs package,
c2f8719
which should be installed automatically along with %{name}.
c2f8719
The remaining parts of the Python standard library are broken out into the
c2f8719
%{name}-tkinter and %{name}-test packages, which may need to be installed
c2f8719
separately.
6245861
c2f8719
Documentation for Python is provided in the %{name}-docs package.
c2f8719
c2f8719
Packages containing additional libraries for Python are generally named with
c2f8719
the "%{name}-" prefix.
6245861
a3483f9
a3483f9
%package libs
6245861
Summary:        Python runtime libraries
a3483f9
094ccc0
# The "enum" module is included in the standard library.
094ccc0
# Provide an upgrade path from the external library.
Robert Kuska 82c3cee
Provides: python3-enum34 = 1.0.4-5%{?dist}
Robert Kuska 82c3cee
Obsoletes: python3-enum34 < 1.0.4-5%{?dist}
5974f19
094ccc0
# Python 3 built with glibc >= 2.24.90-26 needs to require it
094ccc0
# See https://bugzilla.redhat.com/show_bug.cgi?id=1410644
11efc8e
Requires: glibc%{?_isa} >= 2.24.90-26
11efc8e
11efc8e
# For backward compatibility only, remove in F29:
11efc8e
Provides: system-python-libs = %{version}-%{release}
11efc8e
Provides: system-python-libs%{?_isa} = %{version}-%{release}
11efc8e
Obsoletes: system-python-libs < %{version}-%{release}
11efc8e
e522c84
# Shall be removed in Fedora 31
e522c84
Obsoletes: platform-python-libs < %{platpyver}
e522c84
Obsoletes: platform-python-libs-devel < %{platpyver}
e522c84
a3483f9
%description libs
6245861
This package contains runtime libraries for use by Python:
c2f8719
- the majority of the Python standard library
c2f8719
- a dynamically linked library for use by applications that embed Python as
c2f8719
  a scripting language, and by the main "python3" executable
c2f8719
a3483f9
a3483f9
%package devel
6245861
Summary: Libraries and header files needed for Python development
c75d3be
Requires: %{name} = %{version}-%{release}
c75d3be
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Orion Poplawski 1eeebcf
BuildRequires: python-rpm-macros
Orion Poplawski 1eeebcf
Requires: python-rpm-macros
Orion Poplawski 1eeebcf
Requires: python3-rpm-macros
bb9ca6b
Requires: python3-rpm-generators
71718b6
71718b6
# https://bugzilla.redhat.com/show_bug.cgi?id=1217376
71718b6
# https://bugzilla.redhat.com/show_bug.cgi?id=1496757
71718b6
# https://bugzilla.redhat.com/show_bug.cgi?id=1218294
71718b6
# TODO change to a specific subpackage once available (#1218294)
71718b6
Requires: redhat-rpm-config
71718b6
a3483f9
Conflicts: %{name} < %{version}-%{release}
a3483f9
e522c84
# Shall be removed in Fedora 31
e522c84
Obsoletes: platform-python-devel < %{platpyver}
e522c84
a3483f9
%description devel
c2f8719
This package contains the header files and configuration needed to compile
c2f8719
Python extension modules (typically written in C or C++), to embed Python
c2f8719
into other programs, and to make binary distributions for Python libraries.
c2f8719
c2f8719
It also contains the necessary macros to build RPM packages with Python modules.
6245861
a3483f9
a3483f9
%package tools
b0aea52
Summary: A collection of tools included with Python including 2to3 and idle
a3483f9
Requires: %{name} = %{version}-%{release}
a3483f9
Requires: %{name}-tkinter = %{version}-%{release}
a3483f9
b0aea52
Provides: %{name}-2to3 = %{version}-%{release}
b0aea52
Provides: %{name}-idle = %{version}-%{release}
b0aea52
Provides: 2to3 = %{version}-%{release}
b0aea52
Provides: idle3 = %{version}-%{release}
b0aea52
357f40b
# https://bugzilla.redhat.com/show_bug.cgi?id=1111275
357f40b
# /usr/bin/2to3 was moved from here
357f40b
# TODO Remove in Fedora 29
357f40b
Conflicts: python2-tools < 2.7.13-17
357f40b
Conflicts: python-tools < 2.7.13-17
357f40b
e522c84
# Shall be removed in Fedora 31
e522c84
Obsoletes: platform-python-tools < %{platpyver}
e522c84
a3483f9
%description tools
c2f8719
This package contains several tools included with Python, including:
c2f8719
- 2to3, an automatic source converter from Python 2.X
c2f8719
- idle, a basic graphical development environment
c2f8719
a3483f9
a3483f9
%package tkinter
6245861
Summary: A GUI toolkit for Python
a3483f9
Requires: %{name} = %{version}-%{release}
a3483f9
e522c84
# Shall be removed in Fedora 31
e522c84
Obsoletes: platform-python-tkinter < %{platpyver}
e522c84
a3483f9
%description tkinter
c2f8719
The Tkinter (Tk interface) library is a graphical user interface toolkit for
c2f8719
the Python programming language.
c2f8719
a3483f9
a3483f9
%package test
c2f8719
Summary: The self-test suite for the main python3 package
a3483f9
Requires: %{name} = %{version}-%{release}
a3483f9
Requires: %{name}-tools = %{version}-%{release}
a3483f9
e522c84
# Shall be removed in Fedora 31
e522c84
Obsoletes: platform-python-test < %{platpyver}
c2f8719
a3483f9
%description test
c2f8719
The self-test suite for the Python interpreter.
c2f8719
c2f8719
This is only useful to test Python itself. For testing general Python code,
c2f8719
you should use the unittest module from %{name}-libs, or a library such as
c2f8719
${name}-pytest or ${name}-nose.
a3483f9
a3483f9
043c574
%if %{with debug_build}
55cf580
%package debug
6245861
Summary: Debug version of the Python runtime
55cf580
55cf580
# The debug build is an all-in-one package version of the regular build, and
55cf580
# shares the same .py/.pyc files and directories as the regular build.  Hence
55cf580
# we depend on all of the subpackages of the regular build:
55cf580
Requires: %{name}%{?_isa} = %{version}-%{release}
55cf580
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
55cf580
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
55cf580
Requires: %{name}-test%{?_isa} = %{version}-%{release}
55cf580
Requires: %{name}-tkinter%{?_isa} = %{version}-%{release}
55cf580
Requires: %{name}-tools%{?_isa} = %{version}-%{release}
55cf580
55cf580
%description debug
6245861
python3-debug provides a version of the Python runtime with numerous debugging
c2f8719
features enabled, aimed at advanced Python users such as developers of Python
55cf580
extension modules.
55cf580
6245861
This version uses more memory and will be slower than the regular Python build,
c2f8719
but is useful for tracking down reference-counting issues and other bugs.
55cf580
c2f8719
The bytecode format is unchanged, so that .pyc files are compatible between
c2f8719
this and the standard version of Python, but the debugging features mean that
c2f8719
C/C++ extension modules are ABI-incompatible and must be built for each version
c2f8719
separately.
55cf580
c2f8719
The debug build shares installation directories with the standard Python
c2f8719
runtime, so that .py and .pyc files can be shared.
c2f8719
Compiled extension modules use a special ABI flag ("d") in the filename,
c2f8719
so extensions for both verisons can co-exist in the same directory.
043c574
%endif # with debug_build
55cf580
63459d7
%else  # with flatpackage
63459d7
63459d7
Requires: redhat-rpm-config
63459d7
63459d7
# We'll not provide this, on purpose
63459d7
# No package in Fedora shall ever depend on flatpackage via this
63459d7
%global __requires_exclude ^python\\(abi\\) = 3\\..$
63459d7
%global __provides_exclude ^python\\(abi\\) = 3\\..$
63459d7
63459d7
# We keep those inside on purpose
63459d7
Provides: bundled(python3-pip) = 9.0.1
63459d7
Provides: bundled(python3-setuptools) = 28.8.0
63459d7
63459d7
# The descripton for the flat flatpackage package
63459d7
%description
63459d7
This package exists to allow developers to test their code against an newer
63459d7
version of Python. This is not a full Python stack and if you wish to run
63459d7
your applications with Python %{pybasever}, update your Fedora to a newer
63459d7
version once Python %{pybasever} is stable.
63459d7
63459d7
%endif # with flatpackage
c2f8719
c769a6b
# ======================================================
c769a6b
# The prep phase of the build:
c769a6b
# ======================================================
c769a6b
a3483f9
%prep
f5250ec
%setup -q -n Python-%{version}%{?prerel}
6859f23
043c574
%if %{with systemtap}
c969609
# Provide an example of usage of the tapset:
c969609
cp -a %{SOURCE6} .
71040c9
cp -a %{SOURCE7} .
043c574
%endif # with systemtap
c969609
3a884e4
# Remove bundled libraries to ensure that we're using the system copy.
3a884e4
rm -r Modules/expat
1ae4dd3
043c574
%if %{with rewheel}
ddb16c6
%global pip_version 9.0.1
Matej Stuchlik 8f7e215
sed -r -i s/'_PIP_VERSION = "[0-9.]+"'/'_PIP_VERSION = "%{pip_version}"'/ Lib/ensurepip/__init__.py
Matej Stuchlik 8f7e215
%endif
Matej Stuchlik 8f7e215
1ae4dd3
#
1ae4dd3
# Apply patches:
1ae4dd3
#
7eb10c8
%patch1 -p1
7eb10c8
043c574
%if %{with systemtap}
c923b51
%patch55 -p1 -b .systemtap
c969609
%endif
a3483f9
a3483f9
%if "%{_lib}" == "lib64"
7eb10c8
%patch102 -p1
a3483f9
%endif
Robert Kuska 7035fe2
%patch111 -p1
0c8875f
%patch132 -p1
8a28107
%patch155 -p1
823581e
%patch160 -p1
48d2048
%patch163 -p1
0424a4f
%patch170 -p1
5023236
%patch178 -p1
0c8875f
043c574
%if %{with rewheel}
Matej Stuchlik 11fb599
%patch189 -p1
Matej Stuchlik 11fb599
%endif
Matej Stuchlik 11fb599
Robert Kuska a52deaa
%patch205 -p1
332b947
%patch251 -p1
0c8875f
Iryna Shcherbina aba719b
%ifarch aarch64
Iryna Shcherbina aba719b
%patch264 -p1
Iryna Shcherbina aba719b
%endif
Iryna Shcherbina aba719b
74f6a3d
%patch273 -p1
9423d36
%patch274 -p1
c9349a7
%patch289 -p1
27c558e
0efd3d3
96a7bd5
# Remove files that should be generated by the build
96a7bd5
# (This is after patching, so that we can use patches directly from upstream)
96a7bd5
rm configure pyconfig.h.in
96a7bd5
96a7bd5
c769a6b
# ======================================================
c769a6b
# Configuring and building the code:
c769a6b
# ======================================================
c769a6b
a3483f9
%build
96a7bd5
96a7bd5
# Regenerate the configure script and pyconfig.h.in
96a7bd5
autoconf
96a7bd5
autoheader
96a7bd5
db2797c
# Remember the current directory (which has sources and the configure script),
db2797c
# so we can refer to it after we "cd" elsewhere.
55cf580
topdir=$(pwd)
db2797c
db2797c
# Get proper option names from bconds
db2797c
%if %{with computed_gotos}
db2797c
%global computed_gotos_flag yes
db2797c
%else
db2797c
%global computed_gotos_flag no
db2797c
%endif
db2797c
db2797c
%if %{with optimizations}
db2797c
%global optimizations_flag "--enable-optimizations"
db2797c
%else
db2797c
%global optimizations_flag "--disable-optimizations"
db2797c
%endif
db2797c
db2797c
# Set common compiler/linker flags
5c9590b
export CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC -fwrapv"
5c9590b
export CXXFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC -fwrapv"
db2797c
export CPPFLAGS="$(pkg-config --cflags-only-I libffi)"
5c9590b
export OPT="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC -fwrapv"
a3483f9
export LINKCC="gcc"
db2797c
export CFLAGS="$CFLAGS $(pkg-config --cflags openssl)"
Iryna Shcherbina 87e35ed
export LDFLAGS="$RPM_LD_FLAGS -g $(pkg-config --libs-only-L openssl)"
a3483f9
db2797c
# We can build several different configurations of Python: regular and debug.
db2797c
# Define a common function that does one build:
55cf580
BuildPython() {
Robert Kuska a0e3ab8
  ConfName=$1
db2797c
  ExtraConfigArgs=$2
db2797c
  MoreCFlags=$3
55cf580
db2797c
  # Each build is done in its own directory
55cf580
  ConfDir=build/$ConfName
db2797c
  echo STARTING: BUILD OF PYTHON FOR CONFIGURATION: $ConfName
55cf580
  mkdir -p $ConfDir
55cf580
  pushd $ConfDir
55cf580
db2797c
  # Normally, %%configure looks for the "configure" script in the current
db2797c
  # directory.
db2797c
  # Since we changed directories, we need to tell %%configure where to look.
55cf580
  %global _configure $topdir/configure
55cf580
c969609
%configure \
c969609
  --enable-ipv6 \
c969609
  --enable-shared \
043c574
  --with-computed-gotos=%{computed_gotos_flag} \
ecc5705
  --with-dbmliborder=gdbm:ndbm:bdb \
ecc5705
  --with-system-expat \
ecc5705
  --with-system-ffi \
b8daf73
  --enable-loadable-sqlite-extensions \
af1b222
  --with-dtrace \
3f69bcd
  --with-lto \
043c574
%if %{with systemtap}
1c94c1a
  --with-systemtap \
c969609
%endif
043c574
%if %{with valgrind}
31a06df
  --with-valgrind \
31a06df
%endif
55cf580
  $ExtraConfigArgs \
55cf580
  %{nil}
c969609
db2797c
  # Invoke the build
Matej Stuchlik 318f360
  make EXTRA_CFLAGS="$CFLAGS $MoreCFlags" %{?_smp_mflags}
a3483f9
55cf580
  popd
db2797c
  echo FINISHED: BUILD OF PYTHON FOR CONFIGURATION: $ConfName
55cf580
}
55cf580
db2797c
# Call the above to build each configuration.
55cf580
043c574
%if %{with debug_build}
55cf580
BuildPython debug \
db2797c
  "--without-ensurepip --with-pydebug" \
db2797c
  "-O0"
043c574
%endif # with debug_build
55cf580
55cf580
BuildPython optimized \
db2797c
  "--without-ensurepip %{optimizations_flag}" \
db2797c
  ""
55cf580
c769a6b
# ======================================================
c769a6b
# Installing the built code:
c769a6b
# ======================================================
a3483f9
a3483f9
%install
208332b
208332b
# As in %%build, remember the current directory
55cf580
topdir=$(pwd)
a3483f9
208332b
# We install a collection of hooks for gdb that make it easier to debug
208332b
# executables linked against libpython3* (such as /usr/bin/python3 itself)
208332b
#
208332b
# These hooks are implemented in Python itself (though they are for the version
208332b
# of python that gdb is linked with)
208332b
#
208332b
# gdb-archer looks for them in the same path as the ELF file or its .debug
208332b
# file, with a -gdb.py suffix.
208332b
# We put them next to the debug file, because ldconfig would complain if
208332b
# it found non-library files directly in /usr/lib/
208332b
# (see https://bugzilla.redhat.com/show_bug.cgi?id=562980)
208332b
#
208332b
# We'll put these files in the debuginfo package by installing them to e.g.:
208332b
#  /usr/lib/debug/usr/lib/libpython3.2.so.1.0.debug-gdb.py
208332b
# (note that the debug path is /usr/lib/debug for both 32/64 bit)
208332b
#
208332b
# See https://fedoraproject.org/wiki/Features/EasierPythonDebugging for more
208332b
# information
208332b
208332b
%if %{with gdb_hooks}
208332b
DirHoldingGdbPy=%{_prefix}/lib/debug/%{_libdir}
208332b
mkdir -p %{buildroot}$DirHoldingGdbPy
208332b
%endif # with gdb_hooks
208332b
6c51695
# Multilib support for pyconfig.h
6c51695
# 32- and 64-bit versions of pyconfig.h are different. For multilib support
6c51695
# (making it possible to install 32- and 64-bit versions simultaneously),
6c51695
# we need to install them under different filenames, and to make the common
6c51695
# "pyconfig.h" include the right file based on architecture.
6c51695
# See https://bugzilla.redhat.com/show_bug.cgi?id=192747
6c51695
# Filanames are defined here:
6c51695
%global _pyconfig32_h pyconfig-32.h
6c51695
%global _pyconfig64_h pyconfig-64.h
64593af
%global _pyconfig_h pyconfig-%{wordsize}.h
6c51695
208332b
# Use a common function to do an install for all our configurations:
55cf580
InstallPython() {
55cf580
Robert Kuska a0e3ab8
  ConfName=$1
55cf580
  PyInstSoName=$2
Matej Stuchlik 318f360
  MoreCFlags=$3
474cc9f
  LDVersion=$4
64593af
  Postfix=$5
55cf580
208332b
  # Switch to the directory with this configuration's built files
55cf580
  ConfDir=build/$ConfName
55cf580
  echo STARTING: INSTALL OF PYTHON FOR CONFIGURATION: $ConfName
55cf580
  mkdir -p $ConfDir
55cf580
  pushd $ConfDir
55cf580
208332b
  make \
208332b
    DESTDIR=%{buildroot} \
208332b
    INSTALL="install -p" \
208332b
    EXTRA_CFLAGS="$MoreCFlags" \
208332b
    install
a3483f9
cfd3e15
  popd
55cf580
043c574
%if %{with gdb_hooks}
208332b
  # See comment on $DirHoldingGdbPy above
e49a729
  PathOfGdbPy=$DirHoldingGdbPy/$PyInstSoName-%{version}-%{release}.%{_arch}.debug-gdb.py
cfd3e15
  cp Tools/gdb/libpython.py %{buildroot}$PathOfGdbPy
043c574
%endif # with gdb_hooks
55cf580
474cc9f
  # Rename the -devel script that differs on different arches to arch specific name
474cc9f
  mv %{buildroot}%{_bindir}/python${LDVersion}-{,`uname -m`-}config
474cc9f
  echo -e '#!/bin/sh\nexec `dirname $0`/python'${LDVersion}'-`uname -m`-config "$@"' > \
474cc9f
    %{buildroot}%{_bindir}/python${LDVersion}-config
474cc9f
  echo '[ $? -eq 127 ] && echo "Could not find python'${LDVersion}'-`uname -m`-config. Look around to see available arches." >&2' >> \
474cc9f
    %{buildroot}%{_bindir}/python${LDVersion}-config
474cc9f
    chmod +x %{buildroot}%{_bindir}/python${LDVersion}-config
474cc9f
6c51695
  # Make python3-devel multilib-ready
6c51695
  mv %{buildroot}%{_includedir}/python${LDVersion}/pyconfig.h \
6c51695
     %{buildroot}%{_includedir}/python${LDVersion}/%{_pyconfig_h}
6c51695
  cat > %{buildroot}%{_includedir}/python${LDVersion}/pyconfig.h << EOF
6c51695
#include <bits/wordsize.h>
6c51695
6c51695
#if __WORDSIZE == 32
6c51695
#include "%{_pyconfig32_h}"
6c51695
#elif __WORDSIZE == 64
6c51695
#include "%{_pyconfig64_h}"
6c51695
#else
6c51695
#error "Unknown word size"
6c51695
#endif
6c51695
EOF
6c51695
64593af
  # Systemtap hooks
64593af
%if %{with systemtap}
64593af
  mkdir -p %{buildroot}%{tapsetdir}
64593af
  sed \
64593af
     -e "s|LIBRARY_PATH|%{_libdir}/${PyInstSoName}|" \
64593af
     -e 's|"python3"|"python3${Postfix}"|' \
64593af
     %{_sourcedir}/libpython.stp \
64593af
     > %{buildroot}%{tapsetdir}/libpython%{pybasever}${Postfix}-%{wordsize}.stp
64593af
%endif # with systemtap
64593af
55cf580
  echo FINISHED: INSTALL OF PYTHON FOR CONFIGURATION: $ConfName
55cf580
}
55cf580
7c72174
# Install the "debug" build first; any common files will be overridden with
208332b
# later builds
043c574
%if %{with debug_build}
55cf580
InstallPython debug \
Matej Stuchlik 318f360
  %{py_INSTSONAME_debug} \
474cc9f
  -O0 \
64593af
  %{LDVERSION_debug} \
64593af
  -debug
043c574
%endif # with debug_build
55cf580
55cf580
# Now the optimized build:
55cf580
InstallPython optimized \
208332b
  %{py_INSTSONAME_optimized} \
474cc9f
  "" \
64593af
  %{LDVERSION_optimized} \
64593af
  ""
55cf580
f86b3d1
# Install directories for additional packages
b3fc51b
install -d -m 0755 %{buildroot}%{pylibdir}/site-packages/__pycache__
f86b3d1
%if "%{_lib}" == "lib64"
f86b3d1
# The 64-bit version needs to create "site-packages" in /usr/lib/ (for
f86b3d1
# pure-Python modules) as well as in /usr/lib64/ (for packages with extension
f86b3d1
# modules).
f86b3d1
# Note that rpmlint will complain about hardcoded library path;
f86b3d1
# this is intentional.
f86b3d1
install -d -m 0755 %{buildroot}%{_prefix}/lib/python%{pybasever}/site-packages/__pycache__
f86b3d1
%endif
a3483f9
63459d7
%if %{without flatpackage}
860f392
# add idle3 to menu
b3fc51b
install -D -m 0644 Lib/idlelib/Icons/idle_16.png %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/idle3.png
b3fc51b
install -D -m 0644 Lib/idlelib/Icons/idle_32.png %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/idle3.png
b3fc51b
install -D -m 0644 Lib/idlelib/Icons/idle_48.png %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/idle3.png
b3fc51b
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE10}
860f392
860f392
# Install and validate appdata file
b3fc51b
mkdir -p %{buildroot}%{_datadir}/appdata
b3fc51b
cp -a %{SOURCE11} %{buildroot}%{_datadir}/appdata
b3fc51b
appstream-util validate-relax --nonet %{buildroot}%{_datadir}/appdata/idle3.appdata.xml
63459d7
%endif
860f392
a3483f9
# Development tools
b3fc51b
install -m755 -d %{buildroot}%{pylibdir}/Tools
b3fc51b
install Tools/README %{buildroot}%{pylibdir}/Tools/
b3fc51b
cp -ar Tools/freeze %{buildroot}%{pylibdir}/Tools/
b3fc51b
cp -ar Tools/i18n %{buildroot}%{pylibdir}/Tools/
b3fc51b
cp -ar Tools/pynche %{buildroot}%{pylibdir}/Tools/
b3fc51b
cp -ar Tools/scripts %{buildroot}%{pylibdir}/Tools/
a3483f9
a3483f9
# Documentation tools
71040c9
install -m755 -d %{buildroot}%{pylibdir}/Doc
71040c9
cp -ar Doc/tools %{buildroot}%{pylibdir}/Doc/
a3483f9
a3483f9
# Demo scripts
34c15c7
cp -ar Tools/demo %{buildroot}%{pylibdir}/Tools/
a3483f9
6c51695
# Make sure distutils looks at the right pyconfig.h file
6c51695
# See https://bugzilla.redhat.com/show_bug.cgi?id=201434
824c34b
# Similar for sysconfig: sysconfig.get_config_h_filename tries to locate
824c34b
# pyconfig.h so it can be parsed, and needs to do this at runtime in site.py
6c51695
# when python starts up (see https://bugzilla.redhat.com/show_bug.cgi?id=653058)
824c34b
#
824c34b
# Split this out so it goes directly to the pyconfig-32.h/pyconfig-64.h
824c34b
# variants:
824c34b
sed -i -e "s/'pyconfig.h'/'%{_pyconfig_h}'/" \
824c34b
  %{buildroot}%{pylibdir}/distutils/sysconfig.py \
824c34b
  %{buildroot}%{pylibdir}/sysconfig.py
a3483f9
a3483f9
# Switch all shebangs to refer to the specific Python version.
Iryna Shcherbina 685fb7b
# This currently only covers files matching ^[a-zA-Z0-9_]+\.py$,
Iryna Shcherbina 685fb7b
# so handle files named using other naming scheme separately.
55cf580
LD_LIBRARY_PATH=./build/optimized ./build/optimized/python \
55cf580
  Tools/scripts/pathfix.py \
55cf580
  -i "%{_bindir}/python%{pybasever}" \
Iryna Shcherbina 685fb7b
  %{buildroot} %{buildroot}%{pylibdir}/Tools/scripts/*-*.py \
Iryna Shcherbina 685fb7b
  %{buildroot}%{pylibdir}/Tools/pynche/{pynche,pynche.pyw}
1acd7df
# not covered, also redundant and useless:
Iryna Shcherbina 685fb7b
rm %{buildroot}%{pylibdir}/Tools/scripts/{2to3,idle3,pydoc3,pyvenv}
1acd7df
a3483f9
0652b06
# Move pathfix.py to bindir
0652b06
# See https://github.com/fedora-python/python-rpm-porting/issues/24
0652b06
mv %{buildroot}%{pylibdir}/Tools/scripts/pathfix.py %{buildroot}%{_bindir}/
0652b06
0652b06
a3483f9
# Remove shebang lines from .py files that aren't executable, and
a3483f9
# remove executability from .py files that don't have a shebang line:
71040c9
find %{buildroot} -name \*.py \
a3483f9
  \( \( \! -perm /u+x,g+x,o+x -exec sed -e '/^#!/Q 0' -e 'Q 1' {} \; \
a3483f9
  -print -exec sed -i '1d' {} \; \) -o \( \
a3483f9
  -perm /u+x,g+x,o+x ! -exec grep -m 1 -q '^#!' {} \; \
a3483f9
  -exec chmod a-x {} \; \) \)
a3483f9
a3483f9
# Remove executable flag from files that shouldn't have it:
a3483f9
chmod a-x \
34c15c7
  %{buildroot}%{pylibdir}/Tools/README
a3483f9
a3483f9
# Get rid of DOS batch files:
71040c9
find %{buildroot} -name \*.bat -exec rm {} \;
a3483f9
a3483f9
# Get rid of backup files:
71040c9
find %{buildroot}/ -name "*~" -exec rm -f {} \;
a3483f9
find . -name "*~" -exec rm -f {} \;
a3483f9
d54a775
# Get rid of a stray copy of the license:
d54a775
rm %{buildroot}%{pylibdir}/LICENSE.txt
a3483f9
Thomas Spura 1c26b68
# Do bytecompilation with the newly installed interpreter.
Thomas Spura e6314e6
# This is similar to the script in macros.pybytecompile
Thomas Spura ae2fc1c
# compile *.pyc
Thomas Spura ae2fc1c
find %{buildroot} -type f -a -name "*.py" -print0 | \
Thomas Spura ae2fc1c
    LD_LIBRARY_PATH="%{buildroot}%{dynload_dir}/:%{buildroot}%{_libdir}" \
3dbbc14
    PYTHONPATH="%{buildroot}%{_libdir}/python%{pybasever} %{buildroot}%{_libdir}/python%{pybasever}/site-packages" \
b2fa007
    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:]]' || :
a3483f9
0652b06
# Since we have pathfix.py in bindir, this is created, but we don't want it
0652b06
rm -rf %{buildroot}%{_bindir}/__pycache__
0652b06
a3483f9
# Fixup permissions for shared libraries from non-standard 555 to standard 755:
d54a775
find %{buildroot} -perm 555 -exec chmod 755 {} \;
a3483f9
bd4f5e9
# Install macros for rpm:
a39396d
mkdir -p %{buildroot}/%{_rpmconfigdir}/macros.d/
a39396d
install -m 644 %{SOURCE3} %{buildroot}/%{_rpmconfigdir}/macros.d/
63459d7
%if %{without flatpackage}
60aba0a
install -m 644 %{SOURCE9} %{buildroot}/%{_rpmconfigdir}/macros.d/
63459d7
%endif
a3483f9
9640a7e
# Create "/usr/bin/python3-debug", a symlink to the python3 debug binary, to
c4a5733
# avoid the user having to know the precise version and ABI flags.
c4a5733
# See e.g. https://bugzilla.redhat.com/show_bug.cgi?id=676748
63459d7
%if %{with debug_build} && %{without flatpackage}
9640a7e
ln -s \
9640a7e
  %{_bindir}/python%{LDVERSION_debug} \
9640a7e
  %{buildroot}%{_bindir}/python3-debug
00fd884
%endif
9640a7e
11efc8e
# System Python: Link the executable to libexec
11efc8e
# This is for backwards compatibility only and should be removed in Fedora 29
63459d7
%if %{without flatpackage}
60aba0a
mkdir -p %{buildroot}%{_libexecdir}
11efc8e
ln -s %{_bindir}/python%{pybasever} %{buildroot}%{_libexecdir}/system-python
63459d7
%endif
60aba0a
6a6d4a0
# There's no point of having this, as decided in
6a6d4a0
# https://bugzilla.redhat.com/show_bug.cgi?id=1111275
6a6d4a0
rm %{buildroot}%{_bindir}/2to3-%{pybasever}
6a6d4a0
6a6d4a0
%if %{with flatpackage}
6a6d4a0
# Remove stuff that would conflict with python3 package
6a6d4a0
rm %{buildroot}%{_bindir}/python3
6a6d4a0
rm %{buildroot}%{_bindir}/pydoc3
6a6d4a0
rm %{buildroot}%{_bindir}/pathfix.py
6a6d4a0
rm %{buildroot}%{_bindir}/idle3
6a6d4a0
rm %{buildroot}%{_bindir}/python3-*
6a6d4a0
rm %{buildroot}%{_bindir}/pyvenv
6a6d4a0
rm %{buildroot}%{_bindir}/2to3
6a6d4a0
rm %{buildroot}%{_libdir}/libpython3.so
6a6d4a0
rm %{buildroot}%{_mandir}/man1/python3.1*
6a6d4a0
rm %{buildroot}%{_libdir}/pkgconfig/python3.pc
6a6d4a0
%endif
6a6d4a0
7e7918a
c769a6b
# ======================================================
ec8375c
# Checks for packaging issues
c769a6b
# ======================================================
c769a6b
a3483f9
%check
3dbbc14
3dbbc14
# first of all, check timestamps of bytecode files
3dbbc14
find %{buildroot} -type f -a -name "*.py" -print0 | \
3dbbc14
    LD_LIBRARY_PATH="%{buildroot}%{dynload_dir}/:%{buildroot}%{_libdir}" \
3dbbc14
    PYTHONPATH="%{buildroot}%{_libdir}/python%{pybasever} %{buildroot}%{_libdir}/python%{pybasever}/site-packages" \
3dbbc14
    xargs -0 %{buildroot}%{_bindir}/python%{pybasever} %{SOURCE8}
3dbbc14
ec8375c
# Ensure that the curses module was linked against libncursesw.so, rather than
ec8375c
# libncurses.so
ec8375c
# See https://bugzilla.redhat.com/show_bug.cgi?id=539917
ec8375c
ldd %{buildroot}/%{dynload_dir}/_curses*.so \
ec8375c
    | grep curses \
ec8375c
    | grep libncurses.so && (echo "_curses.so linked against libncurses.so" ; exit 1)
ec8375c
ec8375c
# Ensure that the debug modules are linked against the debug libpython, and
ec8375c
# likewise for the optimized modules and libpython:
ec8375c
for Module in %{buildroot}/%{dynload_dir}/*.so ; do
ec8375c
    case $Module in
ec8375c
    *.%{SOABI_debug})
ec8375c
        ldd $Module | grep %{py_INSTSONAME_optimized} &&
ec8375c
            (echo Debug module $Module linked against optimized %{py_INSTSONAME_optimized} ; exit 1)
ec8375c
ec8375c
        ;;
ec8375c
    *.%{SOABI_optimized})
ec8375c
        ldd $Module | grep %{py_INSTSONAME_debug} &&
ec8375c
            (echo Optimized module $Module linked against debug %{py_INSTSONAME_debug} ; exit 1)
ec8375c
        ;;
ec8375c
    esac
ec8375c
done
ec8375c
63459d7
ec8375c
# ======================================================
ec8375c
# Running the upstream test suite
ec8375c
# ======================================================
ec8375c
c4a5733
# For ppc64 we need a larger stack than default
c4a5733
# See https://bugzilla.redhat.com/show_bug.cgi?id=1292462
e3c54b7
%ifarch %{power64}
e3c54b7
  ulimit -a
e3c54b7
  ulimit -s 16384
e3c54b7
%endif
3dbbc14
ec8375c
55cf580
topdir=$(pwd)
55cf580
CheckPython() {
Robert Kuska a0e3ab8
  ConfName=$1
5080ffc
  ConfDir=$(pwd)/build/$ConfName
55cf580
55cf580
  echo STARTING: CHECKING OF PYTHON FOR CONFIGURATION: $ConfName
55cf580
5a48967
  # Note that we're running the tests using the version of the code in the
5a48967
  # builddir, not in the buildroot.
5db81fb
0c8875f
  # Run the upstream test suite, setting "WITHIN_PYTHON_RPM_BUILD" so that the
0c8875f
  # our non-standard decorators take effect on the relevant tests:
0c8875f
  #   @unittest._skipInRpmBuild(reason)
0c8875f
  #   @unittest._expectedFailureInRpmBuild
29b9689
  # test_faulthandler.test_register_chain currently fails on ppc64le and
29b9689
  #   aarch64, see upstream bug http://bugs.python.org/issue21131
0c8875f
  WITHIN_PYTHON_RPM_BUILD= \
9a778ac
  LD_LIBRARY_PATH=$ConfDir $ConfDir/python -m test.regrtest \
5b6a3e0
    -wW --slowest --findleaks \
Matej Stuchlik 318f360
    -x test_distutils \
bbf2225
    -x test_bdist_rpm \
29b9689
    %ifarch ppc64le aarch64
1b09295
    -x test_faulthandler \
8d54999
    %endif
4bc70e0
    %ifarch %{mips64}
1b09295
    -x test_ctypes \
4bc70e0
    %endif
4bc70e0
    %ifarch %{power64} s390 s390x armv7hl aarch64 %{mips}
1b09295
    -x test_gdb
Matej Stuchlik 1746188
    %endif
a3483f9
5db81fb
  echo FINISHED: CHECKING OF PYTHON FOR CONFIGURATION: $ConfName
55cf580
55cf580
}
55cf580
043c574
%if %{with tests}
a5cef79
55cf580
# Check each of the configurations:
043c574
%if %{with debug_build}
55cf580
CheckPython debug
043c574
%endif # with debug_build
55cf580
CheckPython optimized
55cf580
043c574
%endif # with tests
a5cef79
55cf580
c769a6b
# ======================================================
c769a6b
# Scriptlets
c769a6b
# ======================================================
c769a6b
63459d7
%if %{without flatpackage}
63459d7
a3483f9
%post libs -p /sbin/ldconfig
a3483f9
a3483f9
%postun libs -p /sbin/ldconfig
a3483f9
63459d7
%posttrans
63459d7
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
63459d7
63459d7
%endif
63459d7
63459d7
860f392
%post
63459d7
%if %{with flatpackage}
63459d7
/sbin/ldconfig
63459d7
%else
860f392
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
63459d7
%endif
860f392
860f392
%postun
63459d7
%if %{with flatpackage}
63459d7
/sbin/ldconfig
63459d7
%else
860f392
if [ $1 -eq 0 ] ; then
860f392
    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
860f392
    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
860f392
fi
63459d7
%endif
c769a6b
4aab458
%files
a3483f9
%defattr(-, root, root)
ea14453
%license LICENSE
Iryna Shcherbina aba719b
%doc README.rst
63459d7
63459d7
%if %{without flatpackage}
a3483f9
%{_bindir}/pydoc*
a3483f9
%{_bindir}/python3
63459d7
%{_bindir}/pyvenv
63459d7
# Remove in Fedora 29:
63459d7
%{_libexecdir}/system-python
63459d7
%else
63459d7
%{_bindir}/pydoc%{pybasever}
63459d7
%endif
63459d7
a3483f9
%{_bindir}/python%{pybasever}
1c94c1a
%{_bindir}/python%{pybasever}m
f2d9a81
%{_bindir}/pyvenv-%{pybasever}
a3483f9
%{_mandir}/*/*
26c1be5
63459d7
63459d7
%if %{without flatpackage}
26c1be5
%files libs
26c1be5
%defattr(-,root,root,-)
ea14453
%license LICENSE
Iryna Shcherbina aba719b
%doc README.rst
63459d7
%endif
60aba0a
11efc8e
%dir %{pylibdir}
11efc8e
%dir %{dynload_dir}
11efc8e
60aba0a
%{pylibdir}/lib2to3
63459d7
%if %{without flatpackage}
60aba0a
%exclude %{pylibdir}/lib2to3/tests
63459d7
%endif
60aba0a
60aba0a
%dir %{pylibdir}/unittest/
60aba0a
%dir %{pylibdir}/unittest/__pycache__/
60aba0a
%{pylibdir}/unittest/*.py
60aba0a
%{pylibdir}/unittest/__pycache__/*%{bytecode_suffixes}
60aba0a
60aba0a
%dir %{pylibdir}/asyncio/
60aba0a
%dir %{pylibdir}/asyncio/__pycache__/
60aba0a
%{pylibdir}/asyncio/*.py
60aba0a
%{pylibdir}/asyncio/__pycache__/*%{bytecode_suffixes}
60aba0a
60aba0a
%dir %{pylibdir}/venv/
60aba0a
%dir %{pylibdir}/venv/__pycache__/
60aba0a
%{pylibdir}/venv/*.py
60aba0a
%{pylibdir}/venv/__pycache__/*%{bytecode_suffixes}
60aba0a
%{pylibdir}/venv/scripts
60aba0a
60aba0a
%{pylibdir}/wsgiref
60aba0a
%{pylibdir}/xmlrpc
60aba0a
60aba0a
%dir %{pylibdir}/ensurepip/
60aba0a
%dir %{pylibdir}/ensurepip/__pycache__/
60aba0a
%{pylibdir}/ensurepip/*.py
60aba0a
%{pylibdir}/ensurepip/__pycache__/*%{bytecode_suffixes}
63459d7
63459d7
%if %{without flatpackage}
60aba0a
%exclude %{pylibdir}/ensurepip/_bundled
63459d7
%else
63459d7
%dir %{pylibdir}/ensurepip/_bundled
63459d7
%{pylibdir}/ensurepip/_bundled/*.whl
63459d7
%endif
60aba0a
043c574
%if %{with rewheel}
60aba0a
%dir %{pylibdir}/ensurepip/rewheel/
60aba0a
%dir %{pylibdir}/ensurepip/rewheel/__pycache__/
60aba0a
%{pylibdir}/ensurepip/rewheel/*.py
60aba0a
%{pylibdir}/ensurepip/rewheel/__pycache__/*%{bytecode_suffixes}
60aba0a
%endif
60aba0a
60aba0a
%{pylibdir}/idlelib
60aba0a
60aba0a
%dir %{pylibdir}/test/
60aba0a
%dir %{pylibdir}/test/__pycache__/
60aba0a
%dir %{pylibdir}/test/support/
60aba0a
%dir %{pylibdir}/test/support/__pycache__/
60aba0a
%{pylibdir}/test/__init__.py
60aba0a
%{pylibdir}/test/__pycache__/__init__%{bytecode_suffixes}
60aba0a
%{pylibdir}/test/support/__init__.py
60aba0a
%{pylibdir}/test/support/__pycache__/__init__%{bytecode_suffixes}
60aba0a
60aba0a
%dir %{pylibdir}/concurrent/
60aba0a
%dir %{pylibdir}/concurrent/__pycache__/
60aba0a
%{pylibdir}/concurrent/*.py
60aba0a
%{pylibdir}/concurrent/__pycache__/*%{bytecode_suffixes}
60aba0a
60aba0a
%dir %{pylibdir}/concurrent/futures/
60aba0a
%dir %{pylibdir}/concurrent/futures/__pycache__/
60aba0a
%{pylibdir}/concurrent/futures/*.py
60aba0a
%{pylibdir}/concurrent/futures/__pycache__/*%{bytecode_suffixes}
60aba0a
60aba0a
%{pylibdir}/pydoc_data
60aba0a
1c8e9a6
%{dynload_dir}/_blake2.%{SOABI_optimized}.so
f7bd058
%{dynload_dir}/_md5.%{SOABI_optimized}.so
1c8e9a6
%{dynload_dir}/_sha1.%{SOABI_optimized}.so
f7bd058
%{dynload_dir}/_sha256.%{SOABI_optimized}.so
1c8e9a6
%{dynload_dir}/_sha3.%{SOABI_optimized}.so
f7bd058
%{dynload_dir}/_sha512.%{SOABI_optimized}.so
1c8e9a6
1b09295
%{dynload_dir}/_asyncio.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_bisect.%{SOABI_optimized}.so
1c94c1a
%{dynload_dir}/_bz2.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_codecs_cn.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_codecs_hk.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_codecs_iso2022.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_codecs_jp.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_codecs_kr.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_codecs_tw.%{SOABI_optimized}.so
1c94c1a
%{dynload_dir}/_crypt.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_csv.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_ctypes.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_curses.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_curses_panel.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_dbm.%{SOABI_optimized}.so
1c94c1a
%{dynload_dir}/_decimal.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_elementtree.%{SOABI_optimized}.so
043c574
%if %{with gdbm}
5080ffc
%{dynload_dir}/_gdbm.%{SOABI_optimized}.so
5fe31d8
%endif
5080ffc
%{dynload_dir}/_hashlib.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_heapq.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_json.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_lsprof.%{SOABI_optimized}.so
1c94c1a
%{dynload_dir}/_lzma.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_multibytecodec.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_multiprocessing.%{SOABI_optimized}.so
3aee76e
%{dynload_dir}/_opcode.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_pickle.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_posixsubprocess.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_random.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_socket.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_sqlite3.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_ssl.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_struct.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/array.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/audioop.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/binascii.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/cmath.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_datetime.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/fcntl.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/grp.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/math.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/mmap.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/nis.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/ossaudiodev.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/parser.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/pyexpat.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/readline.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/resource.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/select.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/spwd.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/syslog.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/termios.%{SOABI_optimized}.so
Matej Stuchlik abb2ff8
#%{dynload_dir}/time.%{SOABI_optimized}.so
Matej Stuchlik abb2ff8
%{dynload_dir}/_testmultiphase.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/unicodedata.%{SOABI_optimized}.so
d668c1e
%{dynload_dir}/_uuid.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/xxlimited.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/zlib.%{SOABI_optimized}.so
4aab458
13c4a4f
%dir %{pylibdir}/site-packages/
13c4a4f
%dir %{pylibdir}/site-packages/__pycache__/
1c8e9a6
%{pylibdir}/site-packages/README.txt
7eb10c8
%{pylibdir}/*.py
e1c7be0
%dir %{pylibdir}/__pycache__/
7eb10c8
%{pylibdir}/__pycache__/*%{bytecode_suffixes}
1c94c1a
1c94c1a
%dir %{pylibdir}/collections/
1c94c1a
%dir %{pylibdir}/collections/__pycache__/
1c94c1a
%{pylibdir}/collections/*.py
1c94c1a
%{pylibdir}/collections/__pycache__/*%{bytecode_suffixes}
5080ffc
5080ffc
%dir %{pylibdir}/ctypes/
e1c7be0
%dir %{pylibdir}/ctypes/__pycache__/
7eb10c8
%{pylibdir}/ctypes/*.py
7eb10c8
%{pylibdir}/ctypes/__pycache__/*%{bytecode_suffixes}
a3483f9
%{pylibdir}/ctypes/macholib
5080ffc
a3483f9
%{pylibdir}/curses
5080ffc
5080ffc
%dir %{pylibdir}/dbm/
e1c7be0
%dir %{pylibdir}/dbm/__pycache__/
7eb10c8
%{pylibdir}/dbm/*.py
7eb10c8
%{pylibdir}/dbm/__pycache__/*%{bytecode_suffixes}
5080ffc
a6cf423
%dir %{pylibdir}/distutils/
a6cf423
%dir %{pylibdir}/distutils/__pycache__/
a6cf423
%{pylibdir}/distutils/*.py
a6cf423
%{pylibdir}/distutils/__pycache__/*%{bytecode_suffixes}
a6cf423
%{pylibdir}/distutils/README
a6cf423
%{pylibdir}/distutils/command
bbbc440
%exclude %{pylibdir}/distutils/command/wininst-*.exe
a6cf423
5080ffc
%dir %{pylibdir}/email/
e1c7be0
%dir %{pylibdir}/email/__pycache__/
7eb10c8
%{pylibdir}/email/*.py
7eb10c8
%{pylibdir}/email/__pycache__/*%{bytecode_suffixes}
a3483f9
%{pylibdir}/email/mime
1c94c1a
%doc %{pylibdir}/email/architecture.rst
5080ffc
a3483f9
%{pylibdir}/encodings
cb97d29
a3483f9
%{pylibdir}/html
a3483f9
%{pylibdir}/http
5080ffc
5080ffc
%dir %{pylibdir}/importlib/
e1c7be0
%dir %{pylibdir}/importlib/__pycache__/
7eb10c8
%{pylibdir}/importlib/*.py
7eb10c8
%{pylibdir}/importlib/__pycache__/*%{bytecode_suffixes}
5080ffc
5080ffc
%dir %{pylibdir}/json/
e1c7be0
%dir %{pylibdir}/json/__pycache__/
7eb10c8
%{pylibdir}/json/*.py
7eb10c8
%{pylibdir}/json/__pycache__/*%{bytecode_suffixes}
5080ffc
a3483f9
%{pylibdir}/logging
a3483f9
%{pylibdir}/multiprocessing
5080ffc
5080ffc
%dir %{pylibdir}/sqlite3/
e1c7be0
%dir %{pylibdir}/sqlite3/__pycache__/
7eb10c8
%{pylibdir}/sqlite3/*.py
7eb10c8
%{pylibdir}/sqlite3/__pycache__/*%{bytecode_suffixes}
5080ffc
63459d7
%if %{without flatpackage}
5080ffc
%exclude %{pylibdir}/turtle.py
5080ffc
%exclude %{pylibdir}/__pycache__/turtle*%{bytecode_suffixes}
63459d7
%endif
5080ffc
a3483f9
%{pylibdir}/urllib
347356c
%{pylibdir}/xml
1c94c1a
a3483f9
%if "%{_lib}" == "lib64"
37de674
%attr(0755,root,root) %dir %{_prefix}/lib/python%{pybasever}
37de674
%attr(0755,root,root) %dir %{_prefix}/lib/python%{pybasever}/site-packages
13c4a4f
%attr(0755,root,root) %dir %{_prefix}/lib/python%{pybasever}/site-packages/__pycache__/
a3483f9
%endif
a3483f9
a3483f9
# "Makefile" and the config-32/64.h file are needed by
a3483f9
# distutils/sysconfig.py:_init_posix(), so we include them in the core
a3483f9
# package, along with their parent directories (bug 531901):
bea97d9
%dir %{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/
bea97d9
%{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/Makefile
5080ffc
%dir %{_includedir}/python%{LDVERSION_optimized}/
5080ffc
%{_includedir}/python%{LDVERSION_optimized}/%{_pyconfig_h}
a3483f9
Robert Kuska 0837458
%{_libdir}/%{py_INSTSONAME_optimized}
63459d7
%if %{without flatpackage}
34c15c7
%{_libdir}/libpython3.so
63459d7
%endif
043c574
%if %{with systemtap}
11842a3
%dir %(dirname %{tapsetdir})
11842a3
%dir %{tapsetdir}
55cf580
%{tapsetdir}/%{libpython_stp_optimized}
71040c9
%doc systemtap-example.stp pyfuntop.stp
c969609
%endif
a3483f9
63459d7
63459d7
%if %{without flatpackage}
a3483f9
%files devel
a3483f9
%defattr(-,root,root)
63459d7
%endif
63459d7
bea97d9
%{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/*
63459d7
%if %{without flatpackage}
bea97d9
%exclude %{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/Makefile
63459d7
%exclude %{_includedir}/python%{LDVERSION_optimized}/%{_pyconfig_h}
63459d7
%endif
bbbc440
%{pylibdir}/distutils/command/wininst-*.exe
5080ffc
%{_includedir}/python%{LDVERSION_optimized}/*.h
a3483f9
%doc Misc/README.valgrind Misc/valgrind-python.supp Misc/gdbinit
63459d7
63459d7
%if %{without flatpackage}
a3483f9
%{_bindir}/python3-config
63459d7
%{_libdir}/pkgconfig/python3.pc
63459d7
%{_rpmconfigdir}/macros.d/macros.systempython
63459d7
%{_bindir}/pathfix.py
63459d7
%endif
63459d7
a3483f9
%{_bindir}/python%{pybasever}-config
5080ffc
%{_bindir}/python%{LDVERSION_optimized}-config
f188880
%{_bindir}/python%{LDVERSION_optimized}-*-config
5080ffc
%{_libdir}/libpython%{LDVERSION_optimized}.so
5080ffc
%{_libdir}/pkgconfig/python-%{LDVERSION_optimized}.pc
55cf580
%{_libdir}/pkgconfig/python-%{pybasever}.pc
Matej Stuchlik 318f360
%{_rpmconfigdir}/macros.d/macros.pybytecompile%{pybasever}
a3483f9
63459d7
63459d7
%if %{without flatpackage}
a3483f9
%files tools
a3483f9
%defattr(-,root,root,755)
63459d7
b0aea52
%{_bindir}/2to3
63459d7
%{_bindir}/idle*
63459d7
%else
63459d7
%{_bindir}/idle%{pybasever}
63459d7
%endif
63459d7
a3483f9
%{pylibdir}/Tools
a3483f9
%doc %{pylibdir}/Doc
63459d7
%if %{without flatpackage}
860f392
%{_datadir}/appdata/idle3.appdata.xml
860f392
%{_datadir}/applications/idle3.desktop
860f392
%{_datadir}/icons/hicolor/*/apps/idle3.*
63459d7
%endif
a3483f9
63459d7
%if %{without flatpackage}
a3483f9
%files tkinter
a3483f9
%defattr(-,root,root,755)
63459d7
%endif
63459d7
a3483f9
%{pylibdir}/tkinter
63459d7
%if %{without flatpackage}
a3483f9
%exclude %{pylibdir}/tkinter/test
63459d7
%endif
5080ffc
%{dynload_dir}/_tkinter.%{SOABI_optimized}.so
5080ffc
%{pylibdir}/turtle.py
5080ffc
%{pylibdir}/__pycache__/turtle*%{bytecode_suffixes}
5080ffc
%dir %{pylibdir}/turtledemo
5080ffc
%{pylibdir}/turtledemo/*.py
5080ffc
%{pylibdir}/turtledemo/*.cfg
5080ffc
%dir %{pylibdir}/turtledemo/__pycache__/
5080ffc
%{pylibdir}/turtledemo/__pycache__/*%{bytecode_suffixes}
a3483f9
63459d7
63459d7
%if %{without flatpackage}
a3483f9
%files test
a3483f9
%defattr(-, root, root)
63459d7
%endif
63459d7
a3483f9
%{pylibdir}/ctypes/test
a3483f9
%{pylibdir}/distutils/tests
a3483f9
%{pylibdir}/sqlite3/test
a3483f9
%{pylibdir}/test
5080ffc
%{dynload_dir}/_ctypes_test.%{SOABI_optimized}.so
1c94c1a
%{dynload_dir}/_testbuffer.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/_testcapi.%{SOABI_optimized}.so
b282179
%{dynload_dir}/_testimportmultiple.%{SOABI_optimized}.so
d668c1e
%{dynload_dir}/_xxtestfuzz.%{SOABI_optimized}.so
a3483f9
%{pylibdir}/lib2to3/tests
a3483f9
%{pylibdir}/tkinter/test
e1c7be0
%{pylibdir}/unittest/test
a3483f9
55cf580
55cf580
# We don't bother splitting the debug build out into further subpackages:
55cf580
# if you need it, you're probably a developer.
55cf580
55cf580
# Hence the manifest is the combination of analogous files in the manifests of
55cf580
# all of the other subpackages
55cf580
043c574
%if %{with debug_build}
63459d7
%if %{without flatpackage}
55cf580
%files debug
55cf580
%defattr(-,root,root,-)
63459d7
%{_bindir}/python3-debug
63459d7
%endif
55cf580
55cf580
# Analog of the core subpackage's files:
5080ffc
%{_bindir}/python%{LDVERSION_debug}
55cf580
26c1be5
# Analog of the -libs subpackage's files:
55cf580
# ...with debug builds of the built-in "extension" modules:
f7bd058
1c8e9a6
%{dynload_dir}/_blake2.%{SOABI_debug}.so
f7bd058
%{dynload_dir}/_md5.%{SOABI_debug}.so
1c8e9a6
%{dynload_dir}/_sha1.%{SOABI_debug}.so
f7bd058
%{dynload_dir}/_sha256.%{SOABI_debug}.so
1c8e9a6
%{dynload_dir}/_sha3.%{SOABI_debug}.so
f7bd058
%{dynload_dir}/_sha512.%{SOABI_debug}.so
1c8e9a6
1b09295
%{dynload_dir}/_asyncio.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_bisect.%{SOABI_debug}.so
1c94c1a
%{dynload_dir}/_bz2.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_codecs_cn.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_codecs_hk.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_codecs_iso2022.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_codecs_jp.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_codecs_kr.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_codecs_tw.%{SOABI_debug}.so
1c94c1a
%{dynload_dir}/_crypt.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_csv.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_ctypes.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_curses.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_curses_panel.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_dbm.%{SOABI_debug}.so
1c94c1a
%{dynload_dir}/_decimal.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_elementtree.%{SOABI_debug}.so
043c574
%if %{with gdbm}
5080ffc
%{dynload_dir}/_gdbm.%{SOABI_debug}.so
5fe31d8
%endif
5080ffc
%{dynload_dir}/_hashlib.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_heapq.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_json.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_lsprof.%{SOABI_debug}.so
1c94c1a
%{dynload_dir}/_lzma.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_multibytecodec.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_multiprocessing.%{SOABI_debug}.so
3aee76e
%{dynload_dir}/_opcode.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_pickle.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_posixsubprocess.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_random.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_socket.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_sqlite3.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_ssl.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_struct.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/array.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/audioop.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/binascii.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/cmath.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_datetime.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/fcntl.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/grp.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/math.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/mmap.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/nis.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/ossaudiodev.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/parser.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/pyexpat.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/readline.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/resource.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/select.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/spwd.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/syslog.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/termios.%{SOABI_debug}.so
Matej Stuchlik abb2ff8
#%{dynload_dir}/time.%{SOABI_debug}.so
Matej Stuchlik abb2ff8
%{dynload_dir}/_testmultiphase.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/unicodedata.%{SOABI_debug}.so
d668c1e
%{dynload_dir}/_uuid.%{SOABI_debug}.so
d668c1e
%{dynload_dir}/_xxtestfuzz.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/zlib.%{SOABI_debug}.so
55cf580
55cf580
# No need to split things out the "Makefile" and the config-32/64.h file as we
55cf580
# do for the regular build above (bug 531901), since they're all in one package
55cf580
# now; they're listed below, under "-devel":
55cf580
Robert Kuska 0837458
%{_libdir}/%{py_INSTSONAME_debug}
043c574
%if %{with systemtap}
11842a3
%dir %(dirname %{tapsetdir})
11842a3
%dir %{tapsetdir}
55cf580
%{tapsetdir}/%{libpython_stp_debug}
55cf580
%endif
55cf580
55cf580
# Analog of the -devel subpackage's files:
bea97d9
%{pylibdir}/config-%{LDVERSION_debug}-%{_arch}-linux%{_gnu}
5080ffc
%{_includedir}/python%{LDVERSION_debug}
5080ffc
%{_bindir}/python%{LDVERSION_debug}-config
3a35e0b
%{_bindir}/python%{LDVERSION_debug}-*-config
5080ffc
%{_libdir}/libpython%{LDVERSION_debug}.so
Matej Stuchlik abb2ff8
%{_libdir}/libpython%{LDVERSION_debug}.so.1.0
5080ffc
%{_libdir}/pkgconfig/python-%{LDVERSION_debug}.pc
55cf580
55cf580
# Analog of the -tools subpackage's files:
55cf580
#  None for now; we could build precanned versions that have the appropriate
55cf580
# shebang if needed
55cf580
55cf580
# Analog  of the tkinter subpackage's files:
5080ffc
%{dynload_dir}/_tkinter.%{SOABI_debug}.so
55cf580
55cf580
# Analog  of the -test subpackage's files:
5080ffc
%{dynload_dir}/_ctypes_test.%{SOABI_debug}.so
1c94c1a
%{dynload_dir}/_testbuffer.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/_testcapi.%{SOABI_debug}.so
b282179
%{dynload_dir}/_testimportmultiple.%{SOABI_debug}.so
55cf580
043c574
%endif # with debug_build
815994f
c4a5733
# We put the debug-gdb.py file inside /usr/lib/debug to avoid noise from ldconfig
c4a5733
# See https://bugzilla.redhat.com/show_bug.cgi?id=562980
Robert Kuska a0e3ab8
#
d5a5bf3
# The /usr/lib/rpm/redhat/macros defines %__debug_package to use
d5a5bf3
# debugfiles.list, and it appears that everything below /usr/lib/debug and
d5a5bf3
# (/usr/src/debug) gets added to this file (via LISTFILES) in
d5a5bf3
# /usr/lib/rpm/find-debuginfo.sh
Robert Kuska a0e3ab8
#
d5a5bf3
# Hence by installing it below /usr/lib/debug we ensure it is added to the
d5a5bf3
# -debuginfo subpackage
Robert Kuska a0e3ab8
# (if it doesn't, then the rpmbuild ought to fail since the debug-gdb.py
d5a5bf3
# payload file would be unpackaged)
d5a5bf3
c4a5733
# Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1476593
c6fe5c6
%undefine _debuginfo_subpackages
d5a5bf3
c769a6b
# ======================================================
c769a6b
# Finally, the changelog:
c769a6b
# ======================================================
c769a6b
a3483f9
%changelog
7f3ae64
* Thu Jan 18 2018 Miro Hrončok <mhroncok@redhat.com> - 3.7.0-0.3.a4
7f3ae64
- Remove /usr/bin/python37 (#1526129)
6a6d4a0
- Move install stuff from %%check to %%install, where it belongs (oops)
7f3ae64
c9349a7
* Tue Jan 09 2018 Miro Hrončok <mhroncok@redhat.com> - 3.7.0-0.2.a4
c9349a7
- Update to 3.7.0 alpha 4
c9349a7
- Fix the compilation of the nis module
c9349a7
d668c1e
* Tue Nov 28 2017 Miro Hrončok <mhroncok@redhat.com> - 3.7.0-0.1.a2
d668c1e
- Update to 3.7.0 alpha 2
d668c1e
- Removed merged patches 262, 277, 279