Blame SPECS/python39.spec

93a1c0
# ==================
93a1c0
# Top-level metadata
93a1c0
# ==================
93a1c0
93a1c0
%global pybasever 3.9
93a1c0
93a1c0
# pybasever without the dot:
93a1c0
%global pyshortver 39
93a1c0
93a1c0
Name: python%{pyshortver}
93a1c0
Summary: Version %{pybasever} of the Python interpreter
93a1c0
URL: https://www.python.org/
93a1c0
93a1c0
#  WARNING  When rebasing to a new Python version,
93a1c0
#           remember to update the python3-docs package as well
d32976
%global general_version %{pybasever}.6
93a1c0
#global prerel ...
93a1c0
%global upstream_version %{general_version}%{?prerel}
93a1c0
Version: %{general_version}%{?prerel:~%{prerel}}
d32976
Release: 1%{?dist}
93a1c0
License: Python
93a1c0
93a1c0
# Exclude i686 arch. Due to a modularity issue it's being added to the
93a1c0
# x86_64 compose of CRB, but we don't want to ship it at all.
93a1c0
# See: https://projects.engineering.redhat.com/browse/RCM-72605
93a1c0
ExcludeArch: i686
93a1c0
93a1c0
# ==================================
93a1c0
# Conditionals controlling the build
93a1c0
# ==================================
93a1c0
93a1c0
# Note that the bcond macros are named for the CLI option they create.
93a1c0
# "%%bcond_without" means "ENABLE by default and create a --without option"
93a1c0
93a1c0
# Main Python, i.e. whether this is the main Python version in the distribution
93a1c0
# that owns /usr/bin/python3 and other unique paths
93a1c0
# This also means the built subpackages are called python3 rather than python3X
93a1c0
# WARNING: This also influences the flatpackage bcond below.
93a1c0
# By default, this is determined by the %%__default_python3_pkgversion value
93a1c0
# RHEL: Disabled by default
93a1c0
%bcond_with main_python
93a1c0
93a1c0
# Flat package, i.e. no separate subpackages
93a1c0
# Default (in Fedora): if this is a main Python, it is not a flatpackage
93a1c0
# Not supported: Combination of flatpackage enabled and main_python enabled
93a1c0
# RHEL: Disabled by default
93a1c0
%bcond_with flatpackage
93a1c0
93a1c0
# When bootstrapping python3, we need to build setuptools.
93a1c0
# but setuptools BR python3-devel and that brings in python3-rpm-generators;
93a1c0
# python3-rpm-generators needs python3-setuptools, so we cannot have it yet.
93a1c0
#
93a1c0
# We also use the previous build of Python in "make regen-all"
93a1c0
# and in "distutils.tests.test_bdist_rpm".
93a1c0
#
93a1c0
# Procedure: https://fedoraproject.org/wiki/SIGs/Python/UpgradingPython
93a1c0
#
93a1c0
#   IMPORTANT: When bootstrapping, it's very likely the wheels for pip and
93a1c0
#   setuptools are not available. Turn off the rpmwheels bcond until
93a1c0
#   the two packages are built with wheels to get around the issue.
93a1c0
%bcond_with bootstrap
93a1c0
93a1c0
# Whether to use RPM build wheels from the python-{pip,setuptools}-wheel package
93a1c0
# Uses upstream bundled prebuilt wheels otherwise
93a1c0
%bcond_without rpmwheels
93a1c0
93a1c0
# Expensive optimizations (mainly, profile-guided optimizations)
93a1c0
%bcond_without optimizations
93a1c0
93a1c0
# https://fedoraproject.org/wiki/Changes/PythonNoSemanticInterpositionSpeedup
93a1c0
%bcond_without no_semantic_interposition
93a1c0
93a1c0
# Run the test suite in %%check
93a1c0
%bcond_without tests
93a1c0
93a1c0
# Extra build for debugging the interpreter or C-API extensions
93a1c0
# (the -debug subpackages)
93a1c0
%if %{with flatpackage}
93a1c0
%bcond_with debug_build
93a1c0
%else
93a1c0
%bcond_without debug_build
93a1c0
%endif
93a1c0
93a1c0
# Support for the GDB debugger
93a1c0
%bcond_without gdb_hooks
93a1c0
93a1c0
# The dbm.gnu module (key-value database)
93a1c0
%bcond_without gdbm
93a1c0
93a1c0
# Main interpreter loop optimization
93a1c0
%bcond_without computed_gotos
93a1c0
93a1c0
# Support for the Valgrind debugger/profiler
93a1c0
%ifarch %{valgrind_arches}
93a1c0
%bcond_without valgrind
93a1c0
%else
93a1c0
%bcond_with valgrind
93a1c0
%endif
93a1c0
93a1c0
# https://fedoraproject.org/wiki/Changes/Python_Upstream_Architecture_Names
93a1c0
# For a very long time we have converted "upstream architecture names" to "Fedora names".
93a1c0
# This made sense at the time, see https://github.com/pypa/manylinux/issues/687#issuecomment-666362947
93a1c0
# However, with manylinux wheels popularity growth, this is now a problem.
93a1c0
# Wheels built on a Linux that doesn't do this were not compatible with ours and vice versa.
93a1c0
# We now have a compatibility layer to workaround a problem,
93a1c0
# but we also no longer use the legacy arch names in Fedora 34+.
93a1c0
# This bcond controls the behavior. The defaults should be good for anybody.
93a1c0
# RHEL: Disabled by default
93a1c0
%bcond_with legacy_archnames
93a1c0
93a1c0
# In RHEL 9+, we obsolete/provide Platform Python from regular Python
93a1c0
# This is only appropriate for the main Python build
93a1c0
# RHEL: Disabled for python39 module
93a1c0
%bcond_with rhel8_compat_shims
93a1c0
93a1c0
93a1c0
# =====================
93a1c0
# General global macros
93a1c0
# =====================
93a1c0
93a1c0
%if %{with main_python}
93a1c0
%global pkgname python3
93a1c0
%global exename python3
93a1c0
%else
93a1c0
%global pkgname python%{pyshortver}
93a1c0
%global exename python%{pybasever}
93a1c0
%endif
93a1c0
93a1c0
%global pylibdir %{_libdir}/python%{pybasever}
93a1c0
%global dynload_dir %{pylibdir}/lib-dynload
93a1c0
93a1c0
# ABIFLAGS, LDVERSION and SOABI are in the upstream configure.ac
93a1c0
# See PEP 3149 for some background: http://www.python.org/dev/peps/pep-3149/
93a1c0
%global ABIFLAGS_optimized %{nil}
93a1c0
%global ABIFLAGS_debug     d
93a1c0
93a1c0
%global LDVERSION_optimized %{pybasever}%{ABIFLAGS_optimized}
93a1c0
%global LDVERSION_debug     %{pybasever}%{ABIFLAGS_debug}
93a1c0
93a1c0
# When we use the upstream arch triplets, we convert them from the legacy ones
93a1c0
# This is reversed in prep when %%with legacy_archnames, so we keep both macros
93a1c0
%global platform_triplet_legacy %{_arch}-linux%{_gnu}
93a1c0
%global platform_triplet_upstream %{expand:%(echo %{platform_triplet_legacy} | sed -E \\
93a1c0
    -e 's/^arm(eb)?-linux-gnueabi$/arm\\1-linux-gnueabihf/' \\
93a1c0
    -e 's/^mips64(el)?-linux-gnu$/mips64\\1-linux-gnuabi64/' \\
93a1c0
    -e 's/^ppc(64)?(le)?-linux-gnu$/powerpc\\1\\2-linux-gnu/')}
93a1c0
%if %{with legacy_archnames}
93a1c0
%global platform_triplet %{platform_triplet_legacy}
93a1c0
%else
93a1c0
%global platform_triplet %{platform_triplet_upstream}
93a1c0
%endif
93a1c0
93a1c0
%global SOABI_optimized cpython-%{pyshortver}%{ABIFLAGS_optimized}-%{platform_triplet}
93a1c0
%global SOABI_debug     cpython-%{pyshortver}%{ABIFLAGS_debug}-%{platform_triplet}
93a1c0
93a1c0
# All bytecode files are in a __pycache__ subdirectory, with a name
93a1c0
# reflecting the version of the bytecode.
93a1c0
# See PEP 3147: http://www.python.org/dev/peps/pep-3147/
93a1c0
# For example,
93a1c0
#   foo/bar.py
93a1c0
# has bytecode at:
93a1c0
#   foo/__pycache__/bar.cpython-%%{pyshortver}.pyc
93a1c0
#   foo/__pycache__/bar.cpython-%%{pyshortver}.opt-1.pyc
93a1c0
#   foo/__pycache__/bar.cpython-%%{pyshortver}.opt-2.pyc
93a1c0
%global bytecode_suffixes .cpython-%{pyshortver}*.pyc
93a1c0
d32976
# libmpdec (mpdecimal package in Fedora) is tightly coupled with the
d32976
# decimal module. We keep it bundled as to avoid incompatibilities
d32976
# with the packaged version.
d32976
# The version information can be found at Modules/_decimal/libmpdec/mpdecimal.h
d32976
# defined as MPD_VERSION.
d32976
%global libmpdec_version 2.5.0
d32976
93a1c0
# Python's configure script defines SOVERSION, and this is used in the Makefile
93a1c0
# to determine INSTSONAME, the name of the libpython DSO:
93a1c0
#   LDLIBRARY='libpython$(VERSION).so'
93a1c0
#   INSTSONAME="$LDLIBRARY".$SOVERSION
93a1c0
# We mirror this here in order to make it easier to add the -gdb.py hooks.
93a1c0
# (if these get out of sync, the payload of the libs subpackage will fail
93a1c0
# and halt the build)
93a1c0
%global py_SOVERSION 1.0
93a1c0
%global py_INSTSONAME_optimized libpython%{LDVERSION_optimized}.so.%{py_SOVERSION}
93a1c0
%global py_INSTSONAME_debug     libpython%{LDVERSION_debug}.so.%{py_SOVERSION}
93a1c0
93a1c0
# Disable automatic bytecompilation. The python3 binary is not yet be
93a1c0
# available in /usr/bin when Python is built. Also, the bytecompilation fails
93a1c0
# on files that test invalid syntax.
93a1c0
%undefine py_auto_byte_compile
93a1c0
93a1c0
# When a main_python build is attempted despite the %%__default_python3_pkgversion value
93a1c0
# We undefine magic macros so the python3-... package does not provide wrong python3X-...
93a1c0
# RHEL: DISABLED, __default_python3_pkgversion is not implemented
93a1c0
# %%if %%{with main_python} && ("%%{?__default_python3_pkgversion}" != "%%{pybasever}")
93a1c0
# %%undefine __pythonname_provides
93a1c0
# %%{warn:Doing a main_python build with wrong %%%%__default_python3_pkgversion (0%%{?__default_python3_pkgversion}, but this is %%pyshortver)}
93a1c0
# %%endif
93a1c0
93a1c0
# RHEL: An example egg file is included among the python39-test files and due
93a1c0
# to a bug in python3-rpm-generator, mistaken Provides are generated. So we
93a1c0
# exclude them until the issue is properly addressed.
93a1c0
# See BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1916172
93a1c0
%global __provides_exclude_from ^%{pylibdir}/test/test_importlib/data/example-.*\.egg$
93a1c0
93a1c0
# =======================
93a1c0
# Build-time requirements
93a1c0
# =======================
93a1c0
93a1c0
# (keep this list alphabetized)
93a1c0
93a1c0
BuildRequires: autoconf
93a1c0
BuildRequires: bluez-libs-devel
93a1c0
BuildRequires: bzip2
93a1c0
BuildRequires: bzip2-devel
93a1c0
BuildRequires: desktop-file-utils
93a1c0
BuildRequires: expat-devel
93a1c0
93a1c0
BuildRequires: findutils
93a1c0
BuildRequires: gcc-c++
93a1c0
%if %{with gdbm}
93a1c0
BuildRequires: gdbm-devel
93a1c0
%endif
93a1c0
BuildRequires: git-core
93a1c0
BuildRequires: glibc-all-langpacks
93a1c0
BuildRequires: glibc-devel
93a1c0
BuildRequires: gmp-devel
93a1c0
BuildRequires: gnupg2
93a1c0
BuildRequires: libappstream-glib
93a1c0
BuildRequires: libffi-devel
93a1c0
BuildRequires: libnsl2-devel
93a1c0
BuildRequires: libtirpc-devel
93a1c0
BuildRequires: libGL-devel
93a1c0
BuildRequires: libuuid-devel
93a1c0
BuildRequires: libX11-devel
93a1c0
BuildRequires: make
93a1c0
BuildRequires: ncurses-devel
93a1c0
93a1c0
BuildRequires: openssl-devel
93a1c0
BuildRequires: pkgconfig
93a1c0
BuildRequires: readline-devel
93a1c0
BuildRequires: redhat-rpm-config
93a1c0
BuildRequires: sqlite-devel
93a1c0
BuildRequires: gdb
93a1c0
93a1c0
BuildRequires: tar
93a1c0
BuildRequires: tcl-devel
93a1c0
BuildRequires: tix-devel
93a1c0
BuildRequires: tk-devel
93a1c0
BuildRequires: tzdata
93a1c0
93a1c0
%if %{with valgrind}
93a1c0
BuildRequires: valgrind-devel
93a1c0
%endif
93a1c0
93a1c0
BuildRequires: xz-devel
93a1c0
BuildRequires: zlib-devel
93a1c0
93a1c0
BuildRequires: /usr/bin/dtrace
93a1c0
93a1c0
# workaround http://bugs.python.org/issue19804 (test_uuid requires ifconfig)
93a1c0
BuildRequires: /usr/sbin/ifconfig
93a1c0
93a1c0
%if %{with rpmwheels}
93a1c0
BuildRequires: python%{python3_pkgversion}-setuptools-wheel
93a1c0
BuildRequires: python%{python3_pkgversion}-pip-wheel
93a1c0
%endif
93a1c0
93a1c0
%if %{without bootstrap}
93a1c0
# for make regen-all and distutils.tests.test_bdist_rpm
93a1c0
BuildRequires: python%{pyshortver}
93a1c0
%endif
93a1c0
93a1c0
# Generators run on Python 3.6 so we can take this dependency out of the bootstrap loop
93a1c0
BuildRequires: python3-rpm-generators
93a1c0
93a1c0
# =======================
93a1c0
# Source code and patches
93a1c0
# =======================
93a1c0
93a1c0
Source0: %{url}ftp/python/%{general_version}/Python-%{upstream_version}.tar.xz
93a1c0
Source1: %{url}ftp/python/%{general_version}/Python-%{upstream_version}.tar.xz.asc
93a1c0
Source2: %{url}static/files/pubkeys.txt
93a1c0
Source3: macros.python39
93a1c0
93a1c0
# A simple script to check timestamps of bytecode files
93a1c0
# Run in check section with Python that is currently being built
93a1c0
# Originally written by bkabrda
93a1c0
Source8: check-pyc-timestamps.py
93a1c0
93a1c0
# Desktop menu entry for idle3
93a1c0
Source10: idle3.desktop
93a1c0
93a1c0
# AppData file for idle3
93a1c0
Source11: idle3.appdata.xml
93a1c0
93a1c0
# (Patches taken from github.com/fedora-python/cpython)
93a1c0
93a1c0
# 00001 # d06a8853cf4bae9e115f45e1d531d2dc152c5cc8
93a1c0
# Fixup distutils/unixccompiler.py to remove standard library path from rpath
93a1c0
# Was Patch0 in ivazquez' python3000 specfile
93a1c0
Patch1: 00001-rpath.patch
93a1c0
93a1c0
# 00111 # 93b40d73360053ca68b0aeec33b6a8ca167e33e2
93a1c0
# Don't try to build a libpythonMAJOR.MINOR.a
93a1c0
#
93a1c0
# Downstream only: not appropriate for upstream.
93a1c0
#
93a1c0
# See https://bugzilla.redhat.com/show_bug.cgi?id=556092
93a1c0
Patch111: 00111-no-static-lib.patch
93a1c0
d32976
# 00189 # 4242864a6a12f1f4cf9fd63a6699a73f35261aa3
93a1c0
# Instead of bundled wheels, use our RPM packaged wheels
93a1c0
#
93a1c0
# We keep them in /usr/share/python-wheels
93a1c0
#
93a1c0
# Downstream only: upstream bundles
93a1c0
# We might eventually pursuit upstream support, but it's low prio
93a1c0
Patch189: 00189-use-rpm-wheels.patch
93a1c0
# The following versions of setuptools/pip are bundled when this patch is not applied.
93a1c0
# The versions are written in Lib/ensurepip/__init__.py, this patch removes them.
93a1c0
# When the bundled setuptools/pip wheel is updated, the patch no longer applies cleanly.
93a1c0
# In such cases, the patch needs to be amended and the versions updated here:
d32976
%global pip_version 21.1.3
d32976
%global setuptools_version 56.0.0
93a1c0
93a1c0
# 00251 # 2eabd04356402d488060bc8fe316ad13fc8a3356
93a1c0
# Change user install location
93a1c0
#
93a1c0
# Set values of prefix and exec_prefix in distutils install command
93a1c0
# to /usr/local if executable is /usr/bin/python* and RPM build
93a1c0
# is not detected to make pip and distutils install into separate location.
93a1c0
#
93a1c0
# Fedora Change: https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe
93a1c0
# Downstream only: Awaiting resources to work on upstream PEP
93a1c0
Patch251: 00251-change-user-install-location.patch
93a1c0
93a1c0
# 00328 # 367fdcb5a075f083aea83ac174999272a8faf75c
93a1c0
# Restore pyc to TIMESTAMP invalidation mode as default in rpmbuild
93a1c0
#
93a1c0
# Since Fedora 31, the $SOURCE_DATE_EPOCH is set in rpmbuild to the latest
93a1c0
# %%changelog date. This makes Python default to the CHECKED_HASH pyc
93a1c0
# invalidation mode, bringing more reproducible builds traded for an import
93a1c0
# performance decrease. To avoid that, we don't default to CHECKED_HASH
93a1c0
# when $RPM_BUILD_ROOT is set (i.e. when we are building RPM packages).
93a1c0
#
93a1c0
# See https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/57#comment-27426
93a1c0
# Downstream only: only used when building RPM packages
93a1c0
# Ideally, we should talk to upstream and explain why we don't want this
93a1c0
Patch328: 00328-pyc-timestamp-invalidation-mode.patch
93a1c0
c5b9d7
# 00329 #
c5b9d7
# Support OpenSSL FIPS mode
c5b9d7
# - In FIPS mode, OpenSSL wrappers are always used in hashlib
c5b9d7
# - The "usedforsecurity" keyword argument can be used to the various digest
c5b9d7
#   algorithms in hashlib so that you can whitelist a callsite with
c5b9d7
#   "usedforsecurity=False"
c5b9d7
# - OpenSSL wrappers for the hashes blake2{b512,s256},
c5b9d7
# - In FIPS mode, the blake2 hashes use OpenSSL wrappers
c5b9d7
#   and do not offer extended functionality (keys, tree hashing, custom digest size)
c5b9d7
# - In FIPS mode, hmac.HMAC can only be instantiated with an OpenSSL wrapper
c5b9d7
#   or an string with OpenSSL hash name as the "digestmod" argument.
c5b9d7
#   The argument must be specified (instead of defaulting to ‘md5’).
c5b9d7
#
c5b9d7
# - Also while in FIPS mode, we utilize OpenSSL's DRBG and disable the
c5b9d7
#   os.getrandom() function.
c5b9d7
#
c5b9d7
Patch329: 00329-fips.patch
c5b9d7
93a1c0
# 00353 # ab4cc97b643cfe99f567e3a03e5617b507183771
93a1c0
# Original names for architectures with different names downstream
93a1c0
#
93a1c0
# https://fedoraproject.org/wiki/Changes/Python_Upstream_Architecture_Names
93a1c0
#
93a1c0
# Pythons in RHEL/Fedora used different names for some architectures
93a1c0
# than upstream and other distros (for example ppc64 vs. powerpc64).
93a1c0
# This was patched in patch 274, now it is sedded if %%with legacy_archnames.
93a1c0
#
93a1c0
# That meant that an extension built with the default upstream settings
93a1c0
# (on other distro or as an manylinux wheel) could not been found by Python
93a1c0
# on RHEL/Fedora because it had a different suffix.
93a1c0
# This patch adds the legacy names to importlib so Python is able
93a1c0
# to import extensions with a legacy architecture name in its
93a1c0
# file name.
93a1c0
# It work both ways, so it support both %%with and %%without legacy_archnames.
93a1c0
#
93a1c0
# WARNING: This patch has no effect on Python built with bootstrap
93a1c0
# enabled because Python/importlib_external.h is not regenerated
93a1c0
# and therefore Python during bootstrap contains importlib from
93a1c0
# upstream without this feature. It's possible to include
93a1c0
# Python/importlib_external.h to this patch but it'd make rebasing
93a1c0
# a nightmare because it's basically a binary file.
93a1c0
Patch353: 00353-architecture-names-upstream-downstream.patch
93a1c0
93a1c0
# (New patches go here ^^^)
93a1c0
#
93a1c0
# When adding new patches to "python" and "python3" in Fedora, EL, etc.,
93a1c0
# please try to keep the patch numbers in-sync between all specfiles.
93a1c0
#
93a1c0
# More information, and a patch number catalog, is at:
93a1c0
#
93a1c0
#     https://fedoraproject.org/wiki/SIGs/Python/PythonPatches
93a1c0
#
93a1c0
# The patches are stored and rebased at:
93a1c0
#
93a1c0
#     https://github.com/fedora-python/cpython
93a1c0
93a1c0
93a1c0
# ==========================================
93a1c0
# Descriptions, and metadata for subpackages
93a1c0
# ==========================================
93a1c0
93a1c0
# Runtime require alternatives
93a1c0
Requires:         %{_sbindir}/alternatives
93a1c0
Requires(post):   %{_sbindir}/alternatives
93a1c0
Requires(postun): %{_sbindir}/alternatives
93a1c0
93a1c0
# When the user tries to `yum install python`, yum will list this package among
93a1c0
# the possible alternatives
93a1c0
Provides: alternative-for(python)
93a1c0
93a1c0
# this if branch is ~300 lines long and contains subpackages' definitions
93a1c0
%if %{without flatpackage}
93a1c0
%if %{with main_python}
93a1c0
# Description for the python3X SRPM only:
93a1c0
%description
93a1c0
Python %{pybasever} is an accessible, high-level, dynamically typed, interpreted
93a1c0
programming language, designed with an emphasis on code readability.
93a1c0
It includes an extensive standard library, and has a vast ecosystem of
93a1c0
third-party libraries.
93a1c0
93a1c0
%package -n %{pkgname}
93a1c0
Summary: Python %{pybasever} interpreter
93a1c0
93a1c0
# In order to support multiple Python interpreters for development purposes,
93a1c0
# packages with the naming scheme flatpackage (e.g. python3.5) exist for
93a1c0
# non-default versions of Python 3.
93a1c0
# For consistency, we provide python3.X from python3 as well.
93a1c0
Provides: python%{pybasever} = %{version}-%{release}
93a1c0
Provides: python%{pybasever}%{?_isa} = %{version}-%{release}
93a1c0
# To keep the upgrade path clean, we Obsolete python3.X.
93a1c0
# Note that using Obsoletes without package version is not standard practice.
93a1c0
# Here we assert that *any* version of the system's default interpreter is
93a1c0
# preferable to an "extra" interpreter. For example, python3-3.6.1 will
93a1c0
# replace python3.6-3.6.2.
93a1c0
Obsoletes: python%{pybasever}
93a1c0
93a1c0
# https://fedoraproject.org/wiki/Changes/Move_usr_bin_python_into_separate_package
93a1c0
# https://fedoraproject.org/wiki/Changes/Python_means_Python3
93a1c0
# We recommend /usr/bin/python so users get it by default
93a1c0
# Versioned recommends are problematic, and we know that the package requires
93a1c0
# python3 back with fixed version, so we just use the path here:
93a1c0
Recommends: %{_bindir}/python
93a1c0
%endif
93a1c0
93a1c0
%if %{with rhel8_compat_shims}
93a1c0
Provides:  platform-python = %{version}-%{release}
93a1c0
Provides:  platform-python%{?_isa} = %{version}-%{release}
93a1c0
Obsoletes: platform-python < %{pybasever}
93a1c0
%endif
93a1c0
93a1c0
# Python interpreter packages used to be named (or provide) name pythonXY (e.g.
93a1c0
# python39). However, to align it with the executable names and to prepare for
93a1c0
# Python 3.10, they were renamed to pythonX.Y (e.g. python3.9, python3.10). We
93a1c0
# provide and obsolete the previous names.
93a1c0
# - Here are the tags for the nonflat package, regardless if main_python (e.g.
93a1c0
#   python3) or not (e.g. python39). For the flat package, the provide is
93a1c0
#   repeated many lines later.
93a1c0
Provides: python%{pyshortver} = %{version}-%{release}
93a1c0
Obsoletes: python%{pyshortver} < %{version}-%{release}
93a1c0
# RHEL: The python39 rpm is named without the dot unlike in Fedora, so we need
93a1c0
# to also provide the name *with* the dot
93a1c0
Provides: python%{pybasever} = %{version}-%{release}
93a1c0
Provides: python%{pybasever}%{?_isa} = %{version}-%{release}
93a1c0
Obsoletes: python%{pybasever} < %{version}-%{release}
93a1c0
93a1c0
# Packages with Python modules in standard locations automatically
93a1c0
# depend on python(abi). Provide that here.
93a1c0
Provides: python(abi) = %{pybasever}
93a1c0
93a1c0
Requires: %{pkgname}-libs%{?_isa} = %{version}-%{release}
93a1c0
93a1c0
# Previously, this was required for our rewheel patch to work.
93a1c0
# This is technically no longer needed, but we keep it recommended
93a1c0
# for the developer experience.
93a1c0
Recommends: %{pkgname}-setuptools
93a1c0
Recommends: %{pkgname}-pip
93a1c0
93a1c0
# This prevents ALL subpackages built from this spec to require
93a1c0
# /usr/bin/python3* or python(abi). Granularity per subpackage is impossible.
93a1c0
# It's intended for the libs package not to drag in the interpreter, see
93a1c0
# https://bugzilla.redhat.com/show_bug.cgi?id=1547131
93a1c0
# https://bugzilla.redhat.com/show_bug.cgi?id=1862082
93a1c0
# All other packages require %%{pkgname} explicitly.
93a1c0
%global __requires_exclude ^(/usr/bin/python3|python\\(abi\\))
93a1c0
93a1c0
%description -n %{pkgname}
93a1c0
Python %{pybasever} is an accessible, high-level, dynamically typed, interpreted
93a1c0
programming language, designed with an emphasis on code readability.
93a1c0
It includes an extensive standard library, and has a vast ecosystem of
93a1c0
third-party libraries.
93a1c0
93a1c0
The %{pkgname} package provides the "%{exename}" executable: the reference
93a1c0
interpreter for the Python language, version 3.
93a1c0
The majority of its standard library is provided in the %{pkgname}-libs package,
93a1c0
which should be installed automatically along with %{pkgname}.
93a1c0
The remaining parts of the Python standard library are broken out into the
93a1c0
%{pkgname}-tkinter and %{pkgname}-test packages, which may need to be installed
93a1c0
separately.
93a1c0
93a1c0
Documentation for Python is provided in the %{pkgname}-docs package.
93a1c0
93a1c0
Packages containing additional libraries for Python are generally named with
93a1c0
the "%{pkgname}-" prefix.
93a1c0
93a1c0
For the unversioned "python" executable, see manual page "unversioned-python".
93a1c0
93a1c0
93a1c0
%if %{with main_python}
93a1c0
# https://fedoraproject.org/wiki/Changes/Move_usr_bin_python_into_separate_package
93a1c0
# https://fedoraproject.org/wiki/Changes/Python_means_Python3
93a1c0
%package -n python-unversioned-command
93a1c0
Summary: The "python" command that runs Python 3
93a1c0
BuildArch: noarch
93a1c0
93a1c0
# In theory this could require any python3 version
93a1c0
Requires: python3 == %{version}-%{release}
93a1c0
# But since we want to provide versioned python, we require exact version
93a1c0
Provides: python = %{version}-%{release}
93a1c0
# This also save us an explicit conflict for older python3 builds
93a1c0
d32976
# Also provide the name of the Ubuntu package with the same function,
d32976
# to be nice to people who temporarily forgot which distro they're on.
d32976
# C.f. https://packages.ubuntu.com/hirsute/all/python-is-python3/filelist
d32976
Provides: python-is-python3 = %{version}-%{release}
d32976
93a1c0
%description -n python-unversioned-command
93a1c0
This package contains /usr/bin/python - the "python" command that runs Python 3.
93a1c0
93a1c0
%endif # with main_python
93a1c0
93a1c0
93a1c0
%package -n %{pkgname}-libs
93a1c0
Summary:        Python runtime libraries
93a1c0
93a1c0
%if %{with rpmwheels}
93a1c0
Requires: python%{python3_pkgversion}-setuptools-wheel
93a1c0
Requires: python%{python3_pkgversion}-pip-wheel
93a1c0
%else
93a1c0
Provides: bundled(python3dist(pip)) = %{pip_version}
93a1c0
Provides: bundled(python3dist(setuptools)) = %{setuptools_version}
93a1c0
%endif
93a1c0
d32976
# Provides for the bundled libmpdec
d32976
Provides: bundled(mpdecimal) = %{libmpdec_version}
d32976
Provides: bundled(libmpdec) = %{libmpdec_version}
d32976
93a1c0
# There are files in the standard library that have python shebang.
93a1c0
# We've filtered the automatic requirement out so libs are installable without
93a1c0
# the main package. This however makes it pulled in by default.
93a1c0
# See https://bugzilla.redhat.com/show_bug.cgi?id=1547131
93a1c0
Recommends: %{pkgname}%{?_isa} = %{version}-%{release}
93a1c0
93a1c0
# tkinter is part of the standard library,
93a1c0
# but it is torn out to save an unwanted dependency on tk and X11.
93a1c0
# we recommend it when tk is already installed (for better UX)
93a1c0
Recommends: (%{pkgname}-tkinter%{?_isa} = %{version}-%{release} if tk%{?_isa})
93a1c0
93a1c0
# The zoneinfo module needs tzdata
93a1c0
Requires: tzdata
93a1c0
93a1c0
93a1c0
%description -n %{pkgname}-libs
93a1c0
This package contains runtime libraries for use by Python:
93a1c0
- the majority of the Python standard library
93a1c0
- a dynamically linked library for use by applications that embed Python as
93a1c0
  a scripting language, and by the main "%{exename}" executable
93a1c0
93a1c0
93a1c0
%package -n %{pkgname}-devel
93a1c0
Summary: Libraries and header files needed for Python development
93a1c0
Requires: %{pkgname} = %{version}-%{release}
93a1c0
Requires: %{pkgname}-libs%{?_isa} = %{version}-%{release}
93a1c0
# The RPM related dependencies bring nothing to a non-RPM Python developer
93a1c0
# But we want them when packages BuildRequire python3-devel
93a1c0
Requires: (python-rpm-macros if rpm-build)
93a1c0
Requires: (python3-rpm-macros if rpm-build)
93a1c0
93a1c0
# python39 installs the alternatives master symlink to which we attach a slave
93a1c0
Requires(post): %{pkgname}
93a1c0
Requires(postun): %{pkgname}
93a1c0
93a1c0
%if %{without bootstrap}
93a1c0
# This is not "API" (packages that need setuptools should still BuildRequire it)
93a1c0
# However some packages apparently can build both with and without setuptools
93a1c0
# producing egg-info as file or directory (depending on setuptools presence).
93a1c0
# Directory-to-file updates are problematic in RPM, so we ensure setuptools is
93a1c0
# installed when -devel is required.
93a1c0
# See https://bugzilla.redhat.com/show_bug.cgi?id=1623914
93a1c0
# See https://fedoraproject.org/wiki/Packaging:Directory_Replacement
93a1c0
Requires: (%{pkgname}-setuptools if rpm-build)
93a1c0
%endif
93a1c0
93a1c0
# Generators run on Python 3.6 so we can take this dependency out of the bootstrap loop
93a1c0
Requires: (python3-rpm-generators if rpm-build)
93a1c0
93a1c0
Provides: %{pkgname}-2to3 = %{version}-%{release}
93a1c0
93a1c0
Conflicts: %{pkgname} < %{version}-%{release}
93a1c0
93a1c0
%if %{with rhel8_compat_shims}
93a1c0
Provides:  platform-python-devel = %{version}-%{release}
93a1c0
Provides:  platform-python-devel%{?_isa} = %{version}-%{release}
93a1c0
Obsoletes: platform-python-devel < %{pybasever}
93a1c0
%endif
93a1c0
93a1c0
%description -n %{pkgname}-devel
93a1c0
This package contains the header files and configuration needed to compile
93a1c0
Python extension modules (typically written in C or C++), to embed Python
93a1c0
into other programs, and to make binary distributions for Python libraries.
93a1c0
93a1c0
It also contains the necessary macros to build RPM packages with Python modules
93a1c0
and 2to3 tool, an automatic source converter from Python 2.X.
93a1c0
93a1c0
If you want to build an RPM against the python39 module, you also need to
93a1c0
install the python39-rpm-macros package.
93a1c0
93a1c0
%package -n %{pkgname}-idle
93a1c0
Summary: A basic graphical development environment for Python
93a1c0
Requires: %{pkgname} = %{version}-%{release}
93a1c0
Requires: %{pkgname}-tkinter = %{version}-%{release}
93a1c0
93a1c0
Provides: %{pkgname}-tools = %{version}-%{release}
93a1c0
Provides: %{pkgname}-tools%{?_isa} = %{version}-%{release}
93a1c0
Obsoletes: %{pkgname}-tools < %{version}-%{release}
93a1c0
93a1c0
# python39 installs the alternatives master symlink to which we attach a slave
93a1c0
Requires(post): %{pkgname}
93a1c0
Requires(postun): %{pkgname}
93a1c0
93a1c0
%description -n %{pkgname}-idle
93a1c0
IDLE is Python’s Integrated Development and Learning Environment.
93a1c0
93a1c0
IDLE has the following features: Python shell window (interactive
93a1c0
interpreter) with colorizing of code input, output, and error messages;
93a1c0
multi-window text editor with multiple undo, Python colorizing,
93a1c0
smart indent, call tips, auto completion, and other features;
93a1c0
search within any window, replace within editor windows, and
93a1c0
search through multiple files (grep); debugger with persistent
93a1c0
breakpoints, stepping, and viewing of global and local namespaces;
93a1c0
configuration, browsers, and other dialogs.
93a1c0
93a1c0
93a1c0
%package -n %{pkgname}-tkinter
93a1c0
Summary: A GUI toolkit for Python
93a1c0
Requires: %{pkgname} = %{version}-%{release}
93a1c0
93a1c0
%description -n %{pkgname}-tkinter
93a1c0
The Tkinter (Tk interface) library is a graphical user interface toolkit for
93a1c0
the Python programming language.
93a1c0
93a1c0
93a1c0
%package -n %{pkgname}-test
93a1c0
Summary: The self-test suite for the main python3 package
93a1c0
Requires: %{pkgname} = %{version}-%{release}
93a1c0
Requires: %{pkgname}-libs%{?_isa} = %{version}-%{release}
93a1c0
93a1c0
%description -n %{pkgname}-test
93a1c0
The self-test suite for the Python interpreter.
93a1c0
93a1c0
This is only useful to test Python itself. For testing general Python code,
93a1c0
you should use the unittest module from %{pkgname}-libs, or a library such as
93a1c0
%{pkgname}-pytest.
93a1c0
93a1c0
93a1c0
%if %{with debug_build}
93a1c0
%package -n %{pkgname}-debug
93a1c0
Summary: Debug version of the Python runtime
93a1c0
93a1c0
# The debug build is an all-in-one package version of the regular build, and
93a1c0
# shares the same .py/.pyc files and directories as the regular build. Hence
93a1c0
# we depend on all of the subpackages of the regular build:
93a1c0
Requires: %{pkgname}%{?_isa} = %{version}-%{release}
93a1c0
Requires: %{pkgname}-libs%{?_isa} = %{version}-%{release}
93a1c0
Requires: %{pkgname}-devel%{?_isa} = %{version}-%{release}
93a1c0
Requires: %{pkgname}-test%{?_isa} = %{version}-%{release}
93a1c0
Requires: %{pkgname}-tkinter%{?_isa} = %{version}-%{release}
93a1c0
Requires: %{pkgname}-idle%{?_isa} = %{version}-%{release}
93a1c0
93a1c0
%if %{with rhel8_compat_shims}
93a1c0
Provides:  platform-python-debug = %{version}-%{release}
93a1c0
Provides:  platform-python-debug%{?_isa} = %{version}-%{release}
93a1c0
Obsoletes: platform-python-debug < %{pybasever}
93a1c0
%endif
93a1c0
93a1c0
# python39 installs the alternatives master symlink to which we attach a slave
93a1c0
Requires(post): %{pkgname}
93a1c0
Requires(postun): %{pkgname}
93a1c0
93a1c0
%description -n %{pkgname}-debug
93a1c0
python3-debug provides a version of the Python runtime with numerous debugging
93a1c0
features enabled, aimed at advanced Python users such as developers of Python
93a1c0
extension modules.
93a1c0
93a1c0
This version uses more memory and will be slower than the regular Python build,
93a1c0
but is useful for tracking down reference-counting issues and other bugs.
93a1c0
93a1c0
The debug build shares installation directories with the standard Python
93a1c0
runtime. Python modules -- source (.py), bytecode (.pyc), and C-API extensions
93a1c0
(.cpython*.so) -- are compatible between this and the standard version
93a1c0
of Python.
93a1c0
93a1c0
The debug runtime additionally supports debug builds of C-API extensions
93a1c0
(with the "d" ABI flag) for debugging issues in those extensions.
93a1c0
%endif # with debug_build
93a1c0
93a1c0
%else  # with flatpackage
93a1c0
93a1c0
# We'll not provide this, on purpose
93a1c0
# No package in Fedora shall ever depend on flatpackage via this
93a1c0
%global __requires_exclude ^python\\(abi\\) = 3\\..$
93a1c0
%global __provides_exclude ^python\\(abi\\) = 3\\..$
93a1c0
93a1c0
# Python interpreter packages used to be named (or provide) name pythonXY (e.g.
93a1c0
# python39). However, to align it with the executable names and to prepare for
93a1c0
# Python 3.10, they were renamed to pythonX.Y (e.g. python3.9, python3.10). We
93a1c0
# provide and obsolete the previous names.
93a1c0
# - Here are the tags for the flat package. For the nonflat package, the
93a1c0
#   provide is repeated many lines above.
93a1c0
Provides: python%{pyshortver} = %{version}-%{release}
93a1c0
Obsoletes: python%{pyshortver} < %{version}-%{release}
93a1c0
93a1c0
%if %{with rpmwheels}
93a1c0
Requires: python%{python3_pkgversion}-setuptools-wheel
93a1c0
Requires: python%{python3_pkgversion}-pip-wheel
93a1c0
%else
93a1c0
Provides: bundled(python3dist(pip)) = %{pip_version}
93a1c0
Provides: bundled(python3dist(setuptools)) = %{setuptools_version}
93a1c0
%endif
93a1c0
d32976
# Provides for the bundled libmpdec
d32976
Provides: bundled(mpdecimal) = %{libmpdec_version}
d32976
Provides: bundled(libmpdec) = %{libmpdec_version}
d32976
93a1c0
# The zoneinfo module needs tzdata
93a1c0
Requires: tzdata
93a1c0
93a1c0
# The description for the flat package (SRPM and built)
93a1c0
%description
93a1c0
Python %{pybasever} package for developers.
93a1c0
93a1c0
This package exists to allow developers to test their code against a newer
93a1c0
version of Python. This is not a full Python stack and if you wish to run
93a1c0
your applications with Python %{pybasever}, update your Fedora to a newer
93a1c0
version once Python %{pybasever} is stable.
93a1c0
93a1c0
%endif # with flatpackage
93a1c0
93a1c0
93a1c0
%package -n %{pkgname}-rpm-macros
93a1c0
Summary:    RPM macros for building RPMs with Python %{pybasever}
93a1c0
License:    MIT
93a1c0
Provides:   %{pkgname}-modular-devel = %{version}-%{release}
93a1c0
Provides:   python-modular-rpm-macros == %{pybasever}
93a1c0
Conflicts:  python-modular-rpm-macros > %{pybasever}
93a1c0
Requires:   python3-rpm-macros
93a1c0
BuildArch:  noarch
93a1c0
93a1c0
%description -n %{pkgname}-rpm-macros
93a1c0
RPM macros for building RPMs with Python %{pybasever} from the python%{pyshortver} module.
93a1c0
If you want to build an RPM against the python%{pyshortver} module, you need to add:
93a1c0
93a1c0
    BuildRequire: %{pkgname}-rpm-macros.
93a1c0
93a1c0
# ======================================================
93a1c0
# The prep phase of the build:
93a1c0
# ======================================================
93a1c0
93a1c0
%prep
93a1c0
%autosetup -S git_am -N -n Python-%{upstream_version}
93a1c0
93a1c0
# Apply patches up to 188
93a1c0
%apply_patch -q %{PATCH1}
93a1c0
%apply_patch -q %{PATCH111}
93a1c0
93a1c0
%if %{with rpmwheels}
93a1c0
%apply_patch -q %{PATCH189}
93a1c0
rm Lib/ensurepip/_bundled/*.whl
93a1c0
%endif
93a1c0
93a1c0
# Apply the remaining patches
93a1c0
%apply_patch -q %{PATCH251}
93a1c0
%apply_patch -q %{PATCH328}
c5b9d7
%apply_patch -q %{PATCH329}
93a1c0
%apply_patch -q %{PATCH353}
93a1c0
93a1c0
# Remove all exe files to ensure we are not shipping prebuilt binaries
93a1c0
# note that those are only used to create Microsoft Windows installers
93a1c0
# and that functionality is broken on Linux anyway
93a1c0
find -name '*.exe' -print -delete
93a1c0
93a1c0
# Remove bundled libraries to ensure that we're using the system copy.
93a1c0
rm -r Modules/expat
93a1c0
93a1c0
# Remove files that should be generated by the build
93a1c0
# (This is after patching, so that we can use patches directly from upstream)
93a1c0
rm configure pyconfig.h.in
93a1c0
93a1c0
# When we use the legacy arch names, we need to change them in configure.ac
93a1c0
%if %{with legacy_archnames}
93a1c0
sed -i configure.ac \
93a1c0
    -e 's/\b%{platform_triplet_upstream}\b/%{platform_triplet_legacy}/'
93a1c0
%endif
93a1c0
93a1c0
93a1c0
# ======================================================
93a1c0
# Configuring and building the code:
93a1c0
# ======================================================
93a1c0
93a1c0
%build
93a1c0
93a1c0
# The build process embeds version info extracted from the Git repository
93a1c0
# into the Py_GetBuildInfo and sys.version strings.
93a1c0
# Our Git repository is artificial, so we don't want that.
93a1c0
# Tell configure to not use git.
93a1c0
export HAS_GIT=not-found
93a1c0
93a1c0
# Regenerate the configure script and pyconfig.h.in
93a1c0
autoconf
93a1c0
autoheader
93a1c0
93a1c0
# Remember the current directory (which has sources and the configure script),
93a1c0
# so we can refer to it after we "cd" elsewhere.
93a1c0
topdir=$(pwd)
93a1c0
93a1c0
# Get proper option names from bconds
93a1c0
%if %{with computed_gotos}
93a1c0
%global computed_gotos_flag yes
93a1c0
%else
93a1c0
%global computed_gotos_flag no
93a1c0
%endif
93a1c0
93a1c0
%if %{with optimizations}
93a1c0
%global optimizations_flag "--enable-optimizations"
93a1c0
%else
93a1c0
%global optimizations_flag "--disable-optimizations"
93a1c0
%endif
93a1c0
93a1c0
# Set common compiler/linker flags
93a1c0
# We utilize the %%extension_...flags macros here so users building C/C++
93a1c0
# extensions with our python won't get all the compiler/linker flags used
93a1c0
# in Fedora RPMs.
93a1c0
# Standard library built here will still use the %%build_...flags,
93a1c0
# Fedora packages utilizing %%py3_build will use them as well
93a1c0
# https://fedoraproject.org/wiki/Changes/Python_Extension_Flags
93a1c0
export CFLAGS="%{extension_cflags} -D_GNU_SOURCE -fPIC -fwrapv"
93a1c0
export CFLAGS_NODIST="%{build_cflags} -D_GNU_SOURCE -fPIC -fwrapv%{?with_no_semantic_interposition: -fno-semantic-interposition}"
93a1c0
export CXXFLAGS="%{extension_cxxflags} -D_GNU_SOURCE -fPIC -fwrapv"
93a1c0
export CPPFLAGS="$(pkg-config --cflags-only-I libffi)"
93a1c0
export OPT="%{extension_cflags} -D_GNU_SOURCE -fPIC -fwrapv"
93a1c0
export LINKCC="gcc"
93a1c0
export CFLAGS="$CFLAGS $(pkg-config --cflags openssl)"
93a1c0
export LDFLAGS="%{extension_ldflags} -g $(pkg-config --libs-only-L openssl)"
93a1c0
export LDFLAGS_NODIST="%{build_ldflags}%{?with_no_semantic_interposition: -fno-semantic-interposition} -g $(pkg-config --libs-only-L openssl)"
93a1c0
93a1c0
# We can build several different configurations of Python: regular and debug.
93a1c0
# Define a common function that does one build:
93a1c0
BuildPython() {
93a1c0
  ConfName=$1
93a1c0
  ExtraConfigArgs=$2
93a1c0
  MoreCFlags=$3
93a1c0
93a1c0
  # Each build is done in its own directory
93a1c0
  ConfDir=build/$ConfName
93a1c0
  echo STARTING: BUILD OF PYTHON FOR CONFIGURATION: $ConfName
93a1c0
  mkdir -p $ConfDir
93a1c0
  pushd $ConfDir
93a1c0
93a1c0
  # Normally, %%configure looks for the "configure" script in the current
93a1c0
  # directory.
93a1c0
  # Since we changed directories, we need to tell %%configure where to look.
93a1c0
  %global _configure $topdir/configure
93a1c0
93a1c0
  # A workaround for https://bugs.python.org/issue39761
93a1c0
  export DFLAGS=" "
93a1c0
93a1c0
%configure \
93a1c0
  --with-platlibdir=%{_lib} \
93a1c0
  --enable-ipv6 \
93a1c0
  --enable-shared \
93a1c0
  --with-computed-gotos=%{computed_gotos_flag} \
93a1c0
  --with-dbmliborder=gdbm:ndbm:bdb \
93a1c0
  --with-system-expat \
93a1c0
  --with-system-ffi \
93a1c0
  --enable-loadable-sqlite-extensions \
93a1c0
  --with-dtrace \
93a1c0
  --with-lto \
93a1c0
  --with-ssl-default-suites=openssl \
c5b9d7
  --with-builtin-hashlib-hashes=blake2 \
93a1c0
%if %{with valgrind}
93a1c0
  --with-valgrind \
93a1c0
%endif
93a1c0
  $ExtraConfigArgs \
93a1c0
  %{nil}
93a1c0
93a1c0
%global flags_override EXTRA_CFLAGS="$MoreCFlags" CFLAGS_NODIST="$CFLAGS_NODIST $MoreCFlags"
93a1c0
93a1c0
%if %{without bootstrap}
93a1c0
  # Regenerate generated files (needs python3)
93a1c0
  %make_build %{flags_override} regen-all PYTHON_FOR_REGEN="python%{pybasever}"
93a1c0
%endif
93a1c0
93a1c0
  # Invoke the build
93a1c0
  %make_build %{flags_override}
93a1c0
93a1c0
  popd
93a1c0
  echo FINISHED: BUILD OF PYTHON FOR CONFIGURATION: $ConfName
93a1c0
}
93a1c0
93a1c0
# Call the above to build each configuration.
93a1c0
93a1c0
%if %{with debug_build}
c5b9d7
# The debug build is compiled with the lowest level of optimizations as to not optimize
c5b9d7
# out frames. We also suppress the warnings as the default distro value of the FORTIFY_SOURCE
c5b9d7
# option produces too many warnings when compiling at the O0 optimization level.
c5b9d7
# See also: https://bugzilla.redhat.com/show_bug.cgi?id=1818857
93a1c0
BuildPython debug \
93a1c0
  "--without-ensurepip --with-pydebug" \
c5b9d7
  "-O0 -Wno-cpp"
93a1c0
%endif # with debug_build
93a1c0
93a1c0
BuildPython optimized \
93a1c0
  "--without-ensurepip %{optimizations_flag}" \
93a1c0
  ""
93a1c0
93a1c0
# ======================================================
93a1c0
# Installing the built code:
93a1c0
# ======================================================
93a1c0
93a1c0
%install
93a1c0
93a1c0
# As in %%build, remember the current directory
93a1c0
topdir=$(pwd)
93a1c0
93a1c0
# We install a collection of hooks for gdb that make it easier to debug
93a1c0
# executables linked against libpython3* (such as /usr/bin/python3 itself)
93a1c0
#
93a1c0
# These hooks are implemented in Python itself (though they are for the version
93a1c0
# of python that gdb is linked with)
93a1c0
#
93a1c0
# gdb-archer looks for them in the same path as the ELF file or its .debug
93a1c0
# file, with a -gdb.py suffix.
93a1c0
# We put them next to the debug file, because ldconfig would complain if
93a1c0
# it found non-library files directly in /usr/lib/
93a1c0
# (see https://bugzilla.redhat.com/show_bug.cgi?id=562980)
93a1c0
#
93a1c0
# We'll put these files in the debuginfo package by installing them to e.g.:
93a1c0
#  /usr/lib/debug/usr/lib/libpython3.2.so.1.0.debug-gdb.py
93a1c0
# (note that the debug path is /usr/lib/debug for both 32/64 bit)
93a1c0
#
93a1c0
# See https://fedoraproject.org/wiki/Features/EasierPythonDebugging for more
93a1c0
# information
93a1c0
93a1c0
%if %{with gdb_hooks}
93a1c0
DirHoldingGdbPy=%{_usr}/lib/debug/%{_libdir}
93a1c0
mkdir -p %{buildroot}$DirHoldingGdbPy
93a1c0
%endif # with gdb_hooks
93a1c0
93a1c0
# Multilib support for pyconfig.h
93a1c0
# 32- and 64-bit versions of pyconfig.h are different. For multilib support
93a1c0
# (making it possible to install 32- and 64-bit versions simultaneously),
93a1c0
# we need to install them under different filenames, and to make the common
93a1c0
# "pyconfig.h" include the right file based on architecture.
93a1c0
# See https://bugzilla.redhat.com/show_bug.cgi?id=192747
93a1c0
# Filanames are defined here:
93a1c0
%global _pyconfig32_h pyconfig-32.h
93a1c0
%global _pyconfig64_h pyconfig-64.h
93a1c0
%global _pyconfig_h pyconfig-%{__isa_bits}.h
93a1c0
93a1c0
# Use a common function to do an install for all our configurations:
93a1c0
InstallPython() {
93a1c0
93a1c0
  ConfName=$1
93a1c0
  PyInstSoName=$2
93a1c0
  MoreCFlags=$3
93a1c0
  LDVersion=$4
93a1c0
93a1c0
  # Switch to the directory with this configuration's built files
93a1c0
  ConfDir=build/$ConfName
93a1c0
  echo STARTING: INSTALL OF PYTHON FOR CONFIGURATION: $ConfName
93a1c0
  mkdir -p $ConfDir
93a1c0
  pushd $ConfDir
93a1c0
93a1c0
  %make_install EXTRA_CFLAGS="$MoreCFlags"
93a1c0
93a1c0
  popd
93a1c0
93a1c0
%if %{with gdb_hooks}
93a1c0
  # See comment on $DirHoldingGdbPy above
93a1c0
  PathOfGdbPy=$DirHoldingGdbPy/$PyInstSoName-%{version}-%{release}.%{_arch}.debug-gdb.py
93a1c0
  cp Tools/gdb/libpython.py %{buildroot}$PathOfGdbPy
93a1c0
%endif # with gdb_hooks
93a1c0
93a1c0
  # Rename the -devel script that differs on different arches to arch specific name
93a1c0
  mv %{buildroot}%{_bindir}/python${LDVersion}-{,`uname -m`-}config
93a1c0
  echo -e '#!/bin/sh\nexec %{_bindir}/python'${LDVersion}'-`uname -m`-config "$@"' > \
93a1c0
    %{buildroot}%{_bindir}/python${LDVersion}-config
93a1c0
    chmod +x %{buildroot}%{_bindir}/python${LDVersion}-config
93a1c0
93a1c0
  # Make python3-devel multilib-ready
93a1c0
  mv %{buildroot}%{_includedir}/python${LDVersion}/pyconfig.h \
93a1c0
     %{buildroot}%{_includedir}/python${LDVersion}/%{_pyconfig_h}
93a1c0
  cat > %{buildroot}%{_includedir}/python${LDVersion}/pyconfig.h << EOF
93a1c0
#include <bits/wordsize.h>
93a1c0
93a1c0
#if __WORDSIZE == 32
93a1c0
#include "%{_pyconfig32_h}"
93a1c0
#elif __WORDSIZE == 64
93a1c0
#include "%{_pyconfig64_h}"
93a1c0
#else
93a1c0
#error "Unknown word size"
93a1c0
#endif
93a1c0
EOF
93a1c0
93a1c0
  echo FINISHED: INSTALL OF PYTHON FOR CONFIGURATION: $ConfName
93a1c0
}
93a1c0
93a1c0
# Install the "debug" build first; any common files will be overridden with
93a1c0
# later builds
93a1c0
%if %{with debug_build}
93a1c0
InstallPython debug \
93a1c0
  %{py_INSTSONAME_debug} \
93a1c0
  -O0 \
93a1c0
  %{LDVERSION_debug}
93a1c0
%endif # with debug_build
93a1c0
93a1c0
# Now the optimized build:
93a1c0
InstallPython optimized \
93a1c0
  %{py_INSTSONAME_optimized} \
93a1c0
  "" \
93a1c0
  %{LDVERSION_optimized}
93a1c0
93a1c0
# Install directories for additional packages
93a1c0
install -d -m 0755 %{buildroot}%{pylibdir}/site-packages/__pycache__
93a1c0
%if "%{_lib}" == "lib64"
93a1c0
# The 64-bit version needs to create "site-packages" in /usr/lib/ (for
93a1c0
# pure-Python modules) as well as in /usr/lib64/ (for packages with extension
93a1c0
# modules).
93a1c0
# Note that rpmlint will complain about hardcoded library path;
93a1c0
# this is intentional.
93a1c0
install -d -m 0755 %{buildroot}%{_prefix}/lib/python%{pybasever}/site-packages/__pycache__
93a1c0
%endif
93a1c0
93a1c0
%if %{with main_python}
93a1c0
# add idle3 to menu
93a1c0
install -D -m 0644 Lib/idlelib/Icons/idle_16.png %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/idle3.png
93a1c0
install -D -m 0644 Lib/idlelib/Icons/idle_32.png %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/idle3.png
93a1c0
install -D -m 0644 Lib/idlelib/Icons/idle_48.png %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/idle3.png
93a1c0
install -D -m 0644 Lib/idlelib/Icons/idle_256.png %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/idle3.png
93a1c0
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE10}
93a1c0
93a1c0
# Install and validate appdata file
93a1c0
mkdir -p %{buildroot}%{_metainfodir}
93a1c0
cp -a %{SOURCE11} %{buildroot}%{_metainfodir}
93a1c0
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/idle3.appdata.xml
93a1c0
%endif
93a1c0
93a1c0
# Make sure distutils looks at the right pyconfig.h file
93a1c0
# See https://bugzilla.redhat.com/show_bug.cgi?id=201434
93a1c0
# Similar for sysconfig: sysconfig.get_config_h_filename tries to locate
93a1c0
# pyconfig.h so it can be parsed, and needs to do this at runtime in site.py
93a1c0
# when python starts up (see https://bugzilla.redhat.com/show_bug.cgi?id=653058)
93a1c0
#
93a1c0
# Split this out so it goes directly to the pyconfig-32.h/pyconfig-64.h
93a1c0
# variants:
93a1c0
sed -i -e "s/'pyconfig.h'/'%{_pyconfig_h}'/" \
93a1c0
  %{buildroot}%{pylibdir}/distutils/sysconfig.py \
93a1c0
  %{buildroot}%{pylibdir}/sysconfig.py
93a1c0
93a1c0
# Install pathfix.py to bindir
93a1c0
# See https://github.com/fedora-python/python-rpm-porting/issues/24
93a1c0
cp -p Tools/scripts/pathfix.py %{buildroot}%{_bindir}/pathfix%{pybasever}.py
93a1c0
93a1c0
# Install i18n tools to bindir
93a1c0
# They are also in python2, so we version them
93a1c0
# https://bugzilla.redhat.com/show_bug.cgi?id=1571474
93a1c0
for tool in pygettext msgfmt; do
93a1c0
  cp -p Tools/i18n/${tool}.py %{buildroot}%{_bindir}/${tool}%{pybasever}.py
93a1c0
  ln -s ${tool}%{pybasever}.py %{buildroot}%{_bindir}/${tool}3.py
93a1c0
done
93a1c0
93a1c0
# Switch all shebangs to refer to the specific Python version.
93a1c0
# This currently only covers files matching ^[a-zA-Z0-9_]+\.py$,
93a1c0
# so handle files named using other naming scheme separately.
93a1c0
LD_LIBRARY_PATH=./build/optimized ./build/optimized/python \
93a1c0
  Tools/scripts/pathfix.py \
93a1c0
  -i "%{_bindir}/python%{pybasever}" -pn \
93a1c0
  %{buildroot} \
93a1c0
  %{buildroot}%{_bindir}/*%{pybasever}.py \
93a1c0
  %{?with_gdb_hooks:%{buildroot}$DirHoldingGdbPy/*.py}
93a1c0
93a1c0
# Remove shebang lines from .py files that aren't executable, and
93a1c0
# remove executability from .py files that don't have a shebang line:
93a1c0
find %{buildroot} -name \*.py \
93a1c0
  \( \( \! -perm /u+x,g+x,o+x -exec sed -e '/^#!/Q 0' -e 'Q 1' {} \; \
93a1c0
  -print -exec sed -i '1d' {} \; \) -o \( \
93a1c0
  -perm /u+x,g+x,o+x ! -exec grep -m 1 -q '^#!' {} \; \
93a1c0
  -exec chmod a-x {} \; \) \)
93a1c0
93a1c0
# Get rid of DOS batch files:
93a1c0
find %{buildroot} -name \*.bat -exec rm {} \;
93a1c0
93a1c0
# Get rid of backup files:
93a1c0
find %{buildroot}/ -name "*~" -exec rm -f {} \;
93a1c0
find . -name "*~" -exec rm -f {} \;
93a1c0
93a1c0
# Do bytecompilation with the newly installed interpreter.
93a1c0
# This is similar to the script in macros.pybytecompile
93a1c0
# compile *.pyc
93a1c0
# Python CMD line options:
93a1c0
# -s - don't add user site directory to sys.path
93a1c0
# -B - don't write .pyc files on import
93a1c0
# compileall CMD line options:
93a1c0
# -f - force rebuild even if timestamps are up to date
93a1c0
# -o - optimization levels to run compilation with
93a1c0
# -s - part of path to left-strip from path to source file (buildroot)
93a1c0
# -p - path to add as prefix to path to source file (/ to make it absolute)
93a1c0
# --hardlink-dupes - hardlink different optimization level pycs together if identical (saves space)
93a1c0
LD_LIBRARY_PATH="%{buildroot}%{dynload_dir}/:%{buildroot}%{_libdir}" \
93a1c0
%{buildroot}%{_bindir}/python%{pybasever} -s -B -m compileall \
93a1c0
-f %{_smp_mflags} -o 0 -o 1 -o 2 -s %{buildroot} -p / %{buildroot} --hardlink-dupes || :
93a1c0
93a1c0
# Turn this BRP off, it is done by compileall2 --hardlink-dupes above
93a1c0
%global __brp_python_hardlink %{nil}
93a1c0
93a1c0
# Since we have pathfix.py in bindir, this is created, but we don't want it
93a1c0
rm -rf %{buildroot}%{_bindir}/__pycache__
93a1c0
93a1c0
# Fixup permissions for shared libraries from non-standard 555 to standard 755:
93a1c0
find %{buildroot} -perm 555 -exec chmod 755 {} \;
93a1c0
93a1c0
# Create "/usr/bin/python3-debug", a symlink to the python3 debug binary, to
93a1c0
# avoid the user having to know the precise version and ABI flags.
93a1c0
# See e.g. https://bugzilla.redhat.com/show_bug.cgi?id=676748
93a1c0
%if %{with debug_build} && %{with main_python}
93a1c0
ln -s \
93a1c0
  %{_bindir}/python%{LDVERSION_debug} \
93a1c0
  %{buildroot}%{_bindir}/python3-debug
93a1c0
%endif
93a1c0
93a1c0
# There's 2to3-X.X executable and 2to3 soft link to it.
93a1c0
# No reason to have both, so keep only 2to3 as an executable.
93a1c0
# See https://bugzilla.redhat.com/show_bug.cgi?id=1111275
93a1c0
# RHEL: We keep 2to3-X.X versioned not to conflict with other versions
93a1c0
93a1c0
%if %{without main_python}
93a1c0
# Remove stuff that would conflict with python3 package
93a1c0
rm %{buildroot}%{_bindir}/python3
93a1c0
rm %{buildroot}%{_bindir}/pydoc3
93a1c0
rm %{buildroot}%{_bindir}/pygettext3.py
93a1c0
rm %{buildroot}%{_bindir}/msgfmt3.py
93a1c0
rm %{buildroot}%{_bindir}/idle3
93a1c0
rm %{buildroot}%{_bindir}/python3-*
93a1c0
rm %{buildroot}%{_bindir}/2to3
93a1c0
rm %{buildroot}%{_libdir}/libpython3.so
93a1c0
rm %{buildroot}%{_mandir}/man1/python3.1*
93a1c0
rm %{buildroot}%{_libdir}/pkgconfig/python3.pc
93a1c0
rm %{buildroot}%{_libdir}/pkgconfig/python3-embed.pc
93a1c0
%else
93a1c0
# Link the unversioned stuff
93a1c0
# https://fedoraproject.org/wiki/Changes/Python_means_Python3
93a1c0
ln -s ./python3 %{buildroot}%{_bindir}/python
93a1c0
ln -s ./pydoc3 %{buildroot}%{_bindir}/pydoc
93a1c0
ln -s ./pygettext3.py %{buildroot}%{_bindir}/pygettext.py
93a1c0
ln -s ./msgfmt3.py %{buildroot}%{_bindir}/msgfmt.py
93a1c0
ln -s ./idle3 %{buildroot}%{_bindir}/idle
93a1c0
ln -s ./python3-config %{buildroot}%{_bindir}/python-config
93a1c0
ln -s ./python3.1 %{buildroot}%{_mandir}/man1/python.1
93a1c0
ln -s ./python3.pc %{buildroot}%{_libdir}/pkgconfig/python.pc
93a1c0
ln -s ./pathfix%{pybasever}.py %{buildroot}%{_bindir}/pathfix.py
93a1c0
%if %{with debug_build}
93a1c0
ln -s ./python3-debug %{buildroot}%{_bindir}/python-debug
93a1c0
%endif
93a1c0
%endif
93a1c0
93a1c0
%if %{with rhel8_compat_shims}
93a1c0
# Provide RHEL8 backwards compatible symbolic links in %%_libexecdir
93a1c0
mkdir -p %{buildroot}%{_libexecdir}
93a1c0
ln -s %{_bindir}/python%{pybasever} %{buildroot}%{_libexecdir}/platform-python
93a1c0
ln -s %{_bindir}/python%{pybasever} %{buildroot}%{_libexecdir}/platform-python%{pybasever}
93a1c0
ln -s %{_bindir}/python%{pybasever}-config %{buildroot}%{_libexecdir}/platform-python-config
93a1c0
ln -s %{_bindir}/python%{pybasever}-config %{buildroot}%{_libexecdir}/platform-python%{pybasever}-config
93a1c0
ln -s %{_bindir}/python%{pybasever}-`uname -m`-config %{buildroot}%{_libexecdir}/platform-python%{pybasever}-`uname -m`-config
93a1c0
# There were also executables with %%{LDVERSION_optimized} in RHEL 8,
93a1c0
# but since Python 3.8 %%{LDVERSION_optimized} == %%{pybasever}.
93a1c0
# We list both in the %%files section to assert this.
93a1c0
%if %{with debug_build}
93a1c0
ln -s %{_bindir}/python%{LDVERSION_debug} %{buildroot}%{_libexecdir}/platform-python-debug
93a1c0
ln -s %{_bindir}/python%{LDVERSION_debug} %{buildroot}%{_libexecdir}/platform-python%{LDVERSION_debug}
93a1c0
ln -s %{_bindir}/python%{LDVERSION_debug}-config %{buildroot}%{_libexecdir}/platform-python%{LDVERSION_debug}-config
93a1c0
ln -s %{_bindir}/python%{LDVERSION_debug}-`uname -m`-config %{buildroot}%{_libexecdir}/platform-python%{LDVERSION_debug}-`uname -m`-config
93a1c0
%endif
93a1c0
%endif
93a1c0
93a1c0
# Remove large, autogenerated sources and keep only the non-optimized pycache
93a1c0
for file in %{buildroot}%{pylibdir}/pydoc_data/topics.py $(grep --include='*.py' -lr %{buildroot}%{pylibdir}/encodings -e 'Python Character Mapping Codec .* from .* with gencodec.py'); do
93a1c0
    directory=$(dirname ${file})
93a1c0
    module=$(basename ${file%%.py})
93a1c0
    mv ${directory}/{__pycache__/${module}.cpython-%{pyshortver}.pyc,${module}.pyc}
93a1c0
    rm ${directory}/{__pycache__/${module}.cpython-%{pyshortver}.opt-?.pyc,${module}.py}
93a1c0
done
93a1c0
93a1c0
# Python RPM macros
93a1c0
mkdir -p %{buildroot}%{rpmmacrodir}/
93a1c0
install -m 644 %{SOURCE3} \
93a1c0
    %{buildroot}/%{rpmmacrodir}/
93a1c0
93a1c0
# All ghost files controlled by alternatives need to exist for the files
93a1c0
# section check to succeed
93a1c0
# - Don't list /usr/bin/python as a ghost file so `yum install /usr/bin/python`
93a1c0
#   doesn't install this package
93a1c0
touch %{buildroot}%{_bindir}/unversioned-python
93a1c0
touch %{buildroot}%{_mandir}/man1/python.1.gz
93a1c0
touch %{buildroot}%{_bindir}/python3
93a1c0
touch %{buildroot}%{_mandir}/man1/python3.1.gz
93a1c0
touch %{buildroot}%{_bindir}/pydoc3
93a1c0
touch %{buildroot}%{_bindir}/pydoc-3
93a1c0
touch %{buildroot}%{_bindir}/idle3
93a1c0
touch %{buildroot}%{_bindir}/python3-config
93a1c0
touch %{buildroot}%{_bindir}/python3-debug
93a1c0
touch %{buildroot}%{_bindir}/python3-debug-config
93a1c0
93a1c0
93a1c0
# ======================================================
93a1c0
# Checks for packaging issues
93a1c0
# ======================================================
93a1c0
93a1c0
%check
93a1c0
93a1c0
# first of all, check timestamps of bytecode files
93a1c0
find %{buildroot} -type f -a -name "*.py" -print0 | \
93a1c0
    LD_LIBRARY_PATH="%{buildroot}%{dynload_dir}/:%{buildroot}%{_libdir}" \
93a1c0
    PYTHONPATH="%{buildroot}%{_libdir}/python%{pybasever} %{buildroot}%{_libdir}/python%{pybasever}/site-packages" \
93a1c0
    xargs -0 %{buildroot}%{_bindir}/python%{pybasever} %{SOURCE8}
93a1c0
93a1c0
# Ensure that the curses module was linked against libncursesw.so, rather than
93a1c0
# libncurses.so
93a1c0
# See https://bugzilla.redhat.com/show_bug.cgi?id=539917
93a1c0
ldd %{buildroot}/%{dynload_dir}/_curses*.so \
93a1c0
    | grep curses \
93a1c0
    | grep libncurses.so && (echo "_curses.so linked against libncurses.so" ; exit 1)
93a1c0
93a1c0
# Ensure that the debug modules are linked against the debug libpython, and
93a1c0
# likewise for the optimized modules and libpython:
93a1c0
for Module in %{buildroot}/%{dynload_dir}/*.so ; do
93a1c0
    case $Module in
93a1c0
    *.%{SOABI_debug})
93a1c0
        ldd $Module | grep %{py_INSTSONAME_optimized} &&
93a1c0
            (echo Debug module $Module linked against optimized %{py_INSTSONAME_optimized} ; exit 1)
93a1c0
93a1c0
        ;;
93a1c0
    *.%{SOABI_optimized})
93a1c0
        ldd $Module | grep %{py_INSTSONAME_debug} &&
93a1c0
            (echo Optimized module $Module linked against debug %{py_INSTSONAME_debug} ; exit 1)
93a1c0
        ;;
93a1c0
    esac
93a1c0
done
93a1c0
d32976
# Verify that the bundled libmpdec version python was compiled with, is the same version we have virtual
d32976
# provides for in the SPEC.
d32976
test "$(LD_LIBRARY_PATH=$(pwd)/build/optimized $(pwd)/build/optimized/python -c 'import decimal; print(decimal.__libmpdec_version__)')" = \
d32976
     "%{libmpdec_version}"
d32976
93a1c0
93a1c0
# ======================================================
93a1c0
# Running the upstream test suite
93a1c0
# ======================================================
93a1c0
93a1c0
topdir=$(pwd)
93a1c0
CheckPython() {
93a1c0
  ConfName=$1
93a1c0
  ConfDir=$(pwd)/build/$ConfName
93a1c0
93a1c0
  echo STARTING: CHECKING OF PYTHON FOR CONFIGURATION: $ConfName
93a1c0
93a1c0
  # Note that we're running the tests using the version of the code in the
93a1c0
  # builddir, not in the buildroot.
93a1c0
93a1c0
  # Show some info, helpful for debugging test failures
93a1c0
  LD_LIBRARY_PATH=$ConfDir $ConfDir/python -m test.pythoninfo
93a1c0
93a1c0
  # Run the upstream test suite
93a1c0
  # --timeout=1800: kill test running for longer than 30 minutes
93a1c0
  # test_distutils
93a1c0
  #   distutils.tests.test_bdist_rpm tests fail when bootstraping the Python
93a1c0
  #   package: rpmbuild requires /usr/bin/pythonX.Y to be installed
93a1c0
  LD_LIBRARY_PATH=$ConfDir $ConfDir/python -m test.regrtest \
93a1c0
    -wW --slowest -j0 --timeout=1800 \
93a1c0
    %if %{with bootstrap}
93a1c0
    -x test_distutils \
93a1c0
    %endif
93a1c0
    %ifarch %{mips64}
93a1c0
    -x test_ctypes \
93a1c0
    %endif
93a1c0
93a1c0
  echo FINISHED: CHECKING OF PYTHON FOR CONFIGURATION: $ConfName
93a1c0
93a1c0
}
93a1c0
93a1c0
%if %{with tests}
93a1c0
93a1c0
# Check each of the configurations:
93a1c0
%if %{with debug_build}
93a1c0
CheckPython debug
93a1c0
%endif # with debug_build
93a1c0
CheckPython optimized
93a1c0
93a1c0
%endif # with tests
93a1c0
93a1c0
93a1c0
# ======================================================
93a1c0
# Scriptlets for alternatives
93a1c0
# ======================================================
93a1c0
93a1c0
%post
93a1c0
# Alternative for /usr/bin/python -> /usr/bin/python3 + man page
93a1c0
alternatives --install %{_bindir}/unversioned-python \
93a1c0
                       python \
93a1c0
                       %{_bindir}/python3 \
93a1c0
                       300 \
93a1c0
             --slave   %{_bindir}/python \
93a1c0
                       unversioned-python \
93a1c0
                       %{_bindir}/python3 \
93a1c0
             --slave   %{_mandir}/man1/python.1.gz \
93a1c0
                       unversioned-python-man \
93a1c0
                       %{_mandir}/man1/python3.1.gz
93a1c0
93a1c0
# Alternative for /usr/bin/python -> /usr/bin/python3.9 + man page
93a1c0
alternatives --install %{_bindir}/unversioned-python \
93a1c0
                       python \
93a1c0
                       %{_bindir}/python3.9 \
93a1c0
                       209 \
93a1c0
             --slave   %{_bindir}/python \
93a1c0
                       unversioned-python \
93a1c0
                       %{_bindir}/python3.9 \
93a1c0
             --slave   %{_mandir}/man1/python.1.gz \
93a1c0
                       unversioned-python-man \
93a1c0
                       %{_mandir}/man1/python3.9.1.gz
93a1c0
93a1c0
# Alternative for /usr/bin/python3 -> /usr/bin/python3.8 + related files
93a1c0
# Create only if it doesn't exist already
93a1c0
EXISTS=`alternatives --display python3 | \
93a1c0
        grep -c "^/usr/bin/python3.9 - priority [0-9]*"`
93a1c0
93a1c0
if [ $EXISTS -eq 0 ]; then
93a1c0
    alternatives --install %{_bindir}/python3 \
93a1c0
                           python3 \
93a1c0
                           %{_bindir}/python3.9 \
93a1c0
                           3900 \
93a1c0
                 --slave   %{_mandir}/man1/python3.1.gz \
93a1c0
                           python3-man \
93a1c0
                           %{_mandir}/man1/python3.9.1.gz \
93a1c0
                 --slave   %{_bindir}/pydoc3 \
93a1c0
                           pydoc3 \
93a1c0
                           %{_bindir}/pydoc3.9 \
93a1c0
                 --slave   %{_bindir}/pydoc-3 \
93a1c0
                           pydoc-3 \
93a1c0
                           %{_bindir}/pydoc3.9
93a1c0
fi
93a1c0
93a1c0
%postun
93a1c0
# Do this only during uninstall process (not during update)
93a1c0
if [ $1 -eq 0 ]; then
93a1c0
    alternatives --remove python \
93a1c0
                        %{_bindir}/python3.9
93a1c0
93a1c0
    alternatives --remove python3 \
93a1c0
                        %{_bindir}/python3.9
93a1c0
93a1c0
    # Remove link python → python3 if no other python3.* exists
93a1c0
    if ! alternatives --display python3 > /dev/null; then
93a1c0
        alternatives --remove python \
93a1c0
                            %{_bindir}/python3
93a1c0
    fi
93a1c0
fi
93a1c0
93a1c0
93a1c0
%post devel
93a1c0
alternatives --add-slave python3 %{_bindir}/python3.9 \
93a1c0
    %{_bindir}/python3-config \
93a1c0
    python3-config \
93a1c0
    %{_bindir}/python3.9-config
93a1c0
93a1c0
%postun devel
93a1c0
# Do this only during uninstall process (not during update)
93a1c0
if [ $1 -eq 0 ]; then
93a1c0
    alternatives --remove-slave python3 %{_bindir}/python3.9 \
93a1c0
        python3-config
93a1c0
fi
93a1c0
93a1c0
93a1c0
%post debug
93a1c0
alternatives --add-slave python3 %{_bindir}/python3.9 \
93a1c0
    %{_bindir}/python3-debug \
93a1c0
    python3-debug \
93a1c0
    %{_bindir}/python3.9d
93a1c0
alternatives --add-slave python3 %{_bindir}/python3.9 \
93a1c0
    %{_bindir}/python3-debug-config \
93a1c0
    python3-debug-config \
93a1c0
    %{_bindir}/python3.9d-config
93a1c0
93a1c0
%postun debug
93a1c0
# Do this only during uninstall process (not during update)
93a1c0
if [ $1 -eq 0 ]; then
93a1c0
    alternatives --remove-slave python3 %{_bindir}/python3.9 \
93a1c0
        python3-debug
93a1c0
    alternatives --remove-slave python3 %{_bindir}/python3.9 \
93a1c0
        python3-debug-config
93a1c0
fi
93a1c0
93a1c0
93a1c0
%post idle
93a1c0
alternatives --add-slave python3 %{_bindir}/python3.9 \
93a1c0
    %{_bindir}/idle3 \
93a1c0
    idle3 \
93a1c0
    %{_bindir}/idle3.9
93a1c0
93a1c0
%postun idle
93a1c0
# Do this only during uninstall process (not during update)
93a1c0
if [ $1 -eq 0 ]; then
93a1c0
    alternatives --remove-slave python3 %{_bindir}/python3.9 \
93a1c0
       idle3
93a1c0
fi
93a1c0
93a1c0
93a1c0
# ======================================================
93a1c0
# Files for each RPM (sub)package
93a1c0
# ======================================================
93a1c0
93a1c0
%files -n %{pkgname}-rpm-macros
93a1c0
%{rpmmacrodir}/macros.python%{pyshortver}
93a1c0
93a1c0
%files -n %{pkgname}
93a1c0
%doc README.rst
93a1c0
93a1c0
# Alternatives
93a1c0
%ghost %{_bindir}/unversioned-python
93a1c0
%ghost %{_mandir}/man1/python.1.gz
93a1c0
%ghost %{_bindir}/python3
93a1c0
%ghost %{_mandir}/man1/python3.1.gz
93a1c0
%ghost %{_bindir}/pydoc3
93a1c0
%ghost %{_bindir}/pydoc-3
93a1c0
93a1c0
%if %{with main_python}
93a1c0
%{_bindir}/pydoc*
93a1c0
%{_bindir}/python3
93a1c0
%else
93a1c0
%{_bindir}/pydoc%{pybasever}
93a1c0
%endif
93a1c0
93a1c0
%{_bindir}/python%{pybasever}
93a1c0
%{_bindir}/python%{LDVERSION_optimized}
93a1c0
%{_mandir}/*/*3*
93a1c0
93a1c0
%if %{with rhel8_compat_shims}
93a1c0
%{_libexecdir}/platform-python
93a1c0
%{_libexecdir}/platform-python%{pybasever}
93a1c0
%{_libexecdir}/platform-python%{LDVERSION_optimized}
93a1c0
%endif
93a1c0
93a1c0
%if %{with main_python}
93a1c0
%if %{without flatpackage}
93a1c0
%files -n python-unversioned-command
93a1c0
%endif
93a1c0
%{_bindir}/python
93a1c0
%{_mandir}/*/python.1*
93a1c0
%endif
93a1c0
93a1c0
%if %{without flatpackage}
93a1c0
%files -n %{pkgname}-libs
93a1c0
%doc README.rst
93a1c0
%endif
93a1c0
93a1c0
%dir %{pylibdir}
93a1c0
%dir %{dynload_dir}
93a1c0
93a1c0
%license %{pylibdir}/LICENSE.txt
93a1c0
93a1c0
%{pylibdir}/lib2to3
93a1c0
%if %{without flatpackage}
93a1c0
%exclude %{pylibdir}/lib2to3/tests
93a1c0
%endif
93a1c0
93a1c0
%dir %{pylibdir}/unittest/
93a1c0
%dir %{pylibdir}/unittest/__pycache__/
93a1c0
%{pylibdir}/unittest/*.py
93a1c0
%{pylibdir}/unittest/__pycache__/*%{bytecode_suffixes}
93a1c0
93a1c0
%dir %{pylibdir}/asyncio/
93a1c0
%dir %{pylibdir}/asyncio/__pycache__/
93a1c0
%{pylibdir}/asyncio/*.py
93a1c0
%{pylibdir}/asyncio/__pycache__/*%{bytecode_suffixes}
93a1c0
93a1c0
%dir %{pylibdir}/venv/
93a1c0
%dir %{pylibdir}/venv/__pycache__/
93a1c0
%{pylibdir}/venv/*.py
93a1c0
%{pylibdir}/venv/__pycache__/*%{bytecode_suffixes}
93a1c0
%{pylibdir}/venv/scripts
93a1c0
93a1c0
%{pylibdir}/wsgiref
93a1c0
%{pylibdir}/xmlrpc
93a1c0
93a1c0
%dir %{pylibdir}/ensurepip/
93a1c0
%dir %{pylibdir}/ensurepip/__pycache__/
93a1c0
%{pylibdir}/ensurepip/*.py
93a1c0
%{pylibdir}/ensurepip/__pycache__/*%{bytecode_suffixes}
93a1c0
93a1c0
%if %{with rpmwheels}
93a1c0
%exclude %{pylibdir}/ensurepip/_bundled
93a1c0
%else
93a1c0
%dir %{pylibdir}/ensurepip/_bundled
93a1c0
%{pylibdir}/ensurepip/_bundled/*.whl
93a1c0
%{pylibdir}/ensurepip/_bundled/__init__.py
93a1c0
%{pylibdir}/ensurepip/_bundled/__pycache__/*%{bytecode_suffixes}
93a1c0
%endif
93a1c0
93a1c0
%dir %{pylibdir}/concurrent/
93a1c0
%dir %{pylibdir}/concurrent/__pycache__/
93a1c0
%{pylibdir}/concurrent/*.py
93a1c0
%{pylibdir}/concurrent/__pycache__/*%{bytecode_suffixes}
93a1c0
93a1c0
%dir %{pylibdir}/concurrent/futures/
93a1c0
%dir %{pylibdir}/concurrent/futures/__pycache__/
93a1c0
%{pylibdir}/concurrent/futures/*.py
93a1c0
%{pylibdir}/concurrent/futures/__pycache__/*%{bytecode_suffixes}
93a1c0
93a1c0
%{pylibdir}/pydoc_data
93a1c0
93a1c0
%{dynload_dir}/_blake2.%{SOABI_optimized}.so
c5b9d7
%{dynload_dir}/_hmacopenssl.%{SOABI_optimized}.so
93a1c0
93a1c0
%{dynload_dir}/_asyncio.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_bisect.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_bz2.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_codecs_cn.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_codecs_hk.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_codecs_iso2022.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_codecs_jp.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_codecs_kr.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_codecs_tw.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_contextvars.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_crypt.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_csv.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_ctypes.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_curses.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_curses_panel.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_dbm.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_decimal.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_elementtree.%{SOABI_optimized}.so
93a1c0
%if %{with gdbm}
93a1c0
%{dynload_dir}/_gdbm.%{SOABI_optimized}.so
93a1c0
%endif
93a1c0
%{dynload_dir}/_hashlib.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_heapq.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_json.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_lsprof.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_lzma.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_multibytecodec.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_multiprocessing.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_opcode.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_pickle.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_posixsubprocess.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_queue.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_random.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_socket.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_sqlite3.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_ssl.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_statistics.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_struct.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/array.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/audioop.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/binascii.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/cmath.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_datetime.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/fcntl.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/grp.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/math.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/mmap.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/nis.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/ossaudiodev.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/parser.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_posixshmem.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/pyexpat.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/readline.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/resource.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/select.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/spwd.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/syslog.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/termios.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/unicodedata.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_uuid.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/xxlimited.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_xxsubinterpreters.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/zlib.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_zoneinfo.%{SOABI_optimized}.so
93a1c0
93a1c0
%dir %{pylibdir}/site-packages/
93a1c0
%dir %{pylibdir}/site-packages/__pycache__/
93a1c0
%{pylibdir}/site-packages/README.txt
93a1c0
%{pylibdir}/*.py
93a1c0
%dir %{pylibdir}/__pycache__/
93a1c0
%{pylibdir}/__pycache__/*%{bytecode_suffixes}
93a1c0
93a1c0
%dir %{pylibdir}/collections/
93a1c0
%dir %{pylibdir}/collections/__pycache__/
93a1c0
%{pylibdir}/collections/*.py
93a1c0
%{pylibdir}/collections/__pycache__/*%{bytecode_suffixes}
93a1c0
93a1c0
%dir %{pylibdir}/ctypes/
93a1c0
%dir %{pylibdir}/ctypes/__pycache__/
93a1c0
%{pylibdir}/ctypes/*.py
93a1c0
%{pylibdir}/ctypes/__pycache__/*%{bytecode_suffixes}
93a1c0
%{pylibdir}/ctypes/macholib
93a1c0
93a1c0
%{pylibdir}/curses
93a1c0
93a1c0
%dir %{pylibdir}/dbm/
93a1c0
%dir %{pylibdir}/dbm/__pycache__/
93a1c0
%{pylibdir}/dbm/*.py
93a1c0
%{pylibdir}/dbm/__pycache__/*%{bytecode_suffixes}
93a1c0
93a1c0
%dir %{pylibdir}/distutils/
93a1c0
%dir %{pylibdir}/distutils/__pycache__/
93a1c0
%{pylibdir}/distutils/*.py
93a1c0
%{pylibdir}/distutils/__pycache__/*%{bytecode_suffixes}
93a1c0
%{pylibdir}/distutils/README
93a1c0
%{pylibdir}/distutils/command
93a1c0
93a1c0
%dir %{pylibdir}/email/
93a1c0
%dir %{pylibdir}/email/__pycache__/
93a1c0
%{pylibdir}/email/*.py
93a1c0
%{pylibdir}/email/__pycache__/*%{bytecode_suffixes}
93a1c0
%{pylibdir}/email/mime
93a1c0
%doc %{pylibdir}/email/architecture.rst
93a1c0
93a1c0
%{pylibdir}/encodings
93a1c0
93a1c0
%{pylibdir}/html
93a1c0
%{pylibdir}/http
93a1c0
93a1c0
%dir %{pylibdir}/importlib/
93a1c0
%dir %{pylibdir}/importlib/__pycache__/
93a1c0
%{pylibdir}/importlib/*.py
93a1c0
%{pylibdir}/importlib/__pycache__/*%{bytecode_suffixes}
93a1c0
93a1c0
%dir %{pylibdir}/json/
93a1c0
%dir %{pylibdir}/json/__pycache__/
93a1c0
%{pylibdir}/json/*.py
93a1c0
%{pylibdir}/json/__pycache__/*%{bytecode_suffixes}
93a1c0
93a1c0
%{pylibdir}/logging
93a1c0
%{pylibdir}/multiprocessing
93a1c0
93a1c0
%dir %{pylibdir}/sqlite3/
93a1c0
%dir %{pylibdir}/sqlite3/__pycache__/
93a1c0
%{pylibdir}/sqlite3/*.py
93a1c0
%{pylibdir}/sqlite3/__pycache__/*%{bytecode_suffixes}
93a1c0
93a1c0
%if %{without flatpackage}
93a1c0
%exclude %{pylibdir}/turtle.py
93a1c0
%exclude %{pylibdir}/__pycache__/turtle*%{bytecode_suffixes}
93a1c0
%endif
93a1c0
93a1c0
%{pylibdir}/urllib
93a1c0
%{pylibdir}/xml
93a1c0
%{pylibdir}/zoneinfo
93a1c0
93a1c0
%if "%{_lib}" == "lib64"
93a1c0
%attr(0755,root,root) %dir %{_prefix}/lib/python%{pybasever}
93a1c0
%attr(0755,root,root) %dir %{_prefix}/lib/python%{pybasever}/site-packages
93a1c0
%attr(0755,root,root) %dir %{_prefix}/lib/python%{pybasever}/site-packages/__pycache__/
93a1c0
%endif
93a1c0
93a1c0
# "Makefile" and the config-32/64.h file are needed by
93a1c0
# distutils/sysconfig.py:_init_posix(), so we include them in the core
93a1c0
# package, along with their parent directories (bug 531901):
93a1c0
%dir %{pylibdir}/config-%{LDVERSION_optimized}-%{platform_triplet}/
93a1c0
%{pylibdir}/config-%{LDVERSION_optimized}-%{platform_triplet}/Makefile
93a1c0
%dir %{_includedir}/python%{LDVERSION_optimized}/
93a1c0
%{_includedir}/python%{LDVERSION_optimized}/%{_pyconfig_h}
93a1c0
93a1c0
%{_libdir}/%{py_INSTSONAME_optimized}
93a1c0
%if %{with main_python}
93a1c0
%{_libdir}/libpython3.so
93a1c0
%endif
93a1c0
93a1c0
93a1c0
%if %{without flatpackage}
93a1c0
%files -n %{pkgname}-devel
93a1c0
%endif
93a1c0
93a1c0
%{pylibdir}/config-%{LDVERSION_optimized}-%{platform_triplet}/*
93a1c0
%if %{without flatpackage}
93a1c0
%exclude %{pylibdir}/config-%{LDVERSION_optimized}-%{platform_triplet}/Makefile
93a1c0
%exclude %{_includedir}/python%{LDVERSION_optimized}/%{_pyconfig_h}
93a1c0
%endif
93a1c0
%{_includedir}/python%{LDVERSION_optimized}/*.h
93a1c0
%{_includedir}/python%{LDVERSION_optimized}/internal/
93a1c0
%{_includedir}/python%{LDVERSION_optimized}/cpython/
93a1c0
%doc Misc/README.valgrind Misc/valgrind-python.supp Misc/gdbinit
93a1c0
93a1c0
%if %{with main_python}
93a1c0
%{_bindir}/python3-config
93a1c0
%{_bindir}/python-config
93a1c0
%{_libdir}/pkgconfig/python3.pc
93a1c0
%{_libdir}/pkgconfig/python.pc
93a1c0
%{_libdir}/pkgconfig/python3-embed.pc
93a1c0
%{_bindir}/pathfix.py
93a1c0
%{_bindir}/pygettext3.py
93a1c0
%{_bindir}/pygettext.py
93a1c0
%{_bindir}/msgfmt3.py
93a1c0
%{_bindir}/msgfmt.py
93a1c0
%endif
93a1c0
93a1c0
%{_bindir}/2to3-%{pybasever}
93a1c0
%{_bindir}/pathfix%{pybasever}.py
93a1c0
%{_bindir}/pygettext%{pybasever}.py
93a1c0
%{_bindir}/msgfmt%{pybasever}.py
93a1c0
93a1c0
%{_bindir}/python%{pybasever}-config
93a1c0
%{_bindir}/python%{LDVERSION_optimized}-config
93a1c0
%{_bindir}/python%{LDVERSION_optimized}-*-config
93a1c0
# Alternatives
93a1c0
%ghost %{_bindir}/python3-config
93a1c0
93a1c0
%{_libdir}/libpython%{LDVERSION_optimized}.so
93a1c0
%{_libdir}/pkgconfig/python-%{LDVERSION_optimized}.pc
93a1c0
%{_libdir}/pkgconfig/python-%{LDVERSION_optimized}-embed.pc
93a1c0
%{_libdir}/pkgconfig/python-%{pybasever}.pc
93a1c0
%{_libdir}/pkgconfig/python-%{pybasever}-embed.pc
93a1c0
93a1c0
%if %{with rhel8_compat_shims}
93a1c0
%{_libexecdir}/platform-python-config
93a1c0
%{_libexecdir}/platform-python%{pybasever}-config
93a1c0
%{_libexecdir}/platform-python%{LDVERSION_optimized}-config
93a1c0
%{_libexecdir}/platform-python%{pybasever}-*-config
93a1c0
%{_libexecdir}/platform-python%{LDVERSION_optimized}-*-config
93a1c0
%endif
93a1c0
93a1c0
93a1c0
%if %{without flatpackage}
93a1c0
%files -n %{pkgname}-idle
93a1c0
%endif
93a1c0
93a1c0
%if %{with main_python}
93a1c0
%{_bindir}/idle*
93a1c0
%else
93a1c0
%{_bindir}/idle%{pybasever}
93a1c0
# Alternatives
93a1c0
%ghost %{_bindir}/idle3
93a1c0
%endif
93a1c0
93a1c0
%{pylibdir}/idlelib
93a1c0
93a1c0
%if %{with main_python}
93a1c0
%{_metainfodir}/idle3.appdata.xml
93a1c0
%{_datadir}/applications/idle3.desktop
93a1c0
%{_datadir}/icons/hicolor/*/apps/idle3.*
93a1c0
%endif
93a1c0
93a1c0
%if %{without flatpackage}
93a1c0
%files -n %{pkgname}-tkinter
93a1c0
%endif
93a1c0
93a1c0
%{pylibdir}/tkinter
93a1c0
%if %{without flatpackage}
93a1c0
%exclude %{pylibdir}/tkinter/test
93a1c0
%endif
93a1c0
%{dynload_dir}/_tkinter.%{SOABI_optimized}.so
93a1c0
%{pylibdir}/turtle.py
93a1c0
%{pylibdir}/__pycache__/turtle*%{bytecode_suffixes}
93a1c0
%dir %{pylibdir}/turtledemo
93a1c0
%{pylibdir}/turtledemo/*.py
93a1c0
%{pylibdir}/turtledemo/*.cfg
93a1c0
%dir %{pylibdir}/turtledemo/__pycache__/
93a1c0
%{pylibdir}/turtledemo/__pycache__/*%{bytecode_suffixes}
93a1c0
93a1c0
93a1c0
%if %{without flatpackage}
93a1c0
%files -n %{pkgname}-test
93a1c0
%endif
93a1c0
93a1c0
%{pylibdir}/ctypes/test
93a1c0
%{pylibdir}/distutils/tests
93a1c0
%{pylibdir}/sqlite3/test
93a1c0
%{pylibdir}/test
93a1c0
%{dynload_dir}/_ctypes_test.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_testbuffer.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_testcapi.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_testimportmultiple.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_testinternalcapi.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_testmultiphase.%{SOABI_optimized}.so
93a1c0
%{dynload_dir}/_xxtestfuzz.%{SOABI_optimized}.so
93a1c0
%{pylibdir}/lib2to3/tests
93a1c0
%{pylibdir}/tkinter/test
93a1c0
%{pylibdir}/unittest/test
93a1c0
93a1c0
# We don't bother splitting the debug build out into further subpackages:
93a1c0
# if you need it, you're probably a developer.
93a1c0
93a1c0
# Hence the manifest is the combination of analogous files in the manifests of
93a1c0
# all of the other subpackages
93a1c0
93a1c0
%if %{with debug_build}
93a1c0
%if %{without flatpackage}
93a1c0
%files -n %{pkgname}-debug
93a1c0
%endif
93a1c0
93a1c0
%if %{with main_python}
93a1c0
%{_bindir}/python3-debug
93a1c0
%{_bindir}/python-debug
93a1c0
%endif
93a1c0
93a1c0
# Analog of the core subpackage's files:
93a1c0
%{_bindir}/python%{LDVERSION_debug}
93a1c0
# Alternatives
93a1c0
%ghost %{_bindir}/python3-debug
93a1c0
93a1c0
# Analog of the -libs subpackage's files:
93a1c0
# ...with debug builds of the built-in "extension" modules:
93a1c0
93a1c0
%{dynload_dir}/_blake2.%{SOABI_debug}.so
c5b9d7
%{dynload_dir}/_hmacopenssl.%{SOABI_debug}.so
93a1c0
93a1c0
%{dynload_dir}/_asyncio.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_bisect.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_bz2.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_codecs_cn.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_codecs_hk.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_codecs_iso2022.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_codecs_jp.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_codecs_kr.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_codecs_tw.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_contextvars.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_crypt.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_csv.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_ctypes.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_curses.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_curses_panel.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_dbm.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_decimal.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_elementtree.%{SOABI_debug}.so
93a1c0
%if %{with gdbm}
93a1c0
%{dynload_dir}/_gdbm.%{SOABI_debug}.so
93a1c0
%endif
93a1c0
%{dynload_dir}/_hashlib.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_heapq.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_json.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_lsprof.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_lzma.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_multibytecodec.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_multiprocessing.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_opcode.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_pickle.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_posixsubprocess.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_queue.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_random.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_socket.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_sqlite3.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_ssl.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_statistics.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_struct.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/array.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/audioop.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/binascii.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/cmath.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_datetime.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/fcntl.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/grp.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/math.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/mmap.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/nis.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/ossaudiodev.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/parser.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_posixshmem.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/pyexpat.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/readline.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/resource.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/select.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/spwd.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/syslog.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/termios.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/unicodedata.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_uuid.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_xxsubinterpreters.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_xxtestfuzz.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/zlib.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_zoneinfo.%{SOABI_debug}.so
93a1c0
93a1c0
# No need to split things out the "Makefile" and the config-32/64.h file as we
93a1c0
# do for the regular build above (bug 531901), since they're all in one package
93a1c0
# now; they're listed below, under "-devel":
93a1c0
93a1c0
%{_libdir}/%{py_INSTSONAME_debug}
93a1c0
93a1c0
# Analog of the -devel subpackage's files:
93a1c0
%{pylibdir}/config-%{LDVERSION_debug}-%{platform_triplet}
93a1c0
%{_includedir}/python%{LDVERSION_debug}
93a1c0
%{_bindir}/python%{LDVERSION_debug}-config
93a1c0
%{_bindir}/python%{LDVERSION_debug}-*-config
93a1c0
# Alternatives
93a1c0
%ghost %{_bindir}/python3-debug-config
93a1c0
93a1c0
%{_libdir}/libpython%{LDVERSION_debug}.so
93a1c0
%{_libdir}/libpython%{LDVERSION_debug}.so.%{py_SOVERSION}
93a1c0
%{_libdir}/pkgconfig/python-%{LDVERSION_debug}.pc
93a1c0
%{_libdir}/pkgconfig/python-%{LDVERSION_debug}-embed.pc
93a1c0
93a1c0
%if %{with rhel8_compat_shims}
93a1c0
%{_libexecdir}/platform-python-debug
93a1c0
%{_libexecdir}/platform-python%{LDVERSION_debug}
93a1c0
%{_libexecdir}/platform-python%{LDVERSION_debug}-config
93a1c0
%{_libexecdir}/platform-python%{LDVERSION_debug}-*-config
93a1c0
%endif
93a1c0
93a1c0
# Analog of the -tools subpackage's files:
93a1c0
#  None for now; we could build precanned versions that have the appropriate
93a1c0
# shebang if needed
93a1c0
93a1c0
# Analog  of the tkinter subpackage's files:
93a1c0
%{dynload_dir}/_tkinter.%{SOABI_debug}.so
93a1c0
93a1c0
# Analog  of the -test subpackage's files:
93a1c0
%{dynload_dir}/_ctypes_test.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_testbuffer.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_testcapi.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_testimportmultiple.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_testinternalcapi.%{SOABI_debug}.so
93a1c0
%{dynload_dir}/_testmultiphase.%{SOABI_debug}.so
93a1c0
93a1c0
%endif # with debug_build
93a1c0
93a1c0
# We put the debug-gdb.py file inside /usr/lib/debug to avoid noise from ldconfig
93a1c0
# See https://bugzilla.redhat.com/show_bug.cgi?id=562980
93a1c0
#
93a1c0
# The /usr/lib/rpm/redhat/macros defines %%__debug_package to use
93a1c0
# debugfiles.list, and it appears that everything below /usr/lib/debug and
93a1c0
# (/usr/src/debug) gets added to this file (via LISTFILES) in
93a1c0
# /usr/lib/rpm/find-debuginfo.sh
93a1c0
#
93a1c0
# Hence by installing it below /usr/lib/debug we ensure it is added to the
93a1c0
# -debuginfo subpackage
93a1c0
# (if it doesn't, then the rpmbuild ought to fail since the debug-gdb.py
93a1c0
# payload file would be unpackaged)
93a1c0
93a1c0
# Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1476593
93a1c0
%undefine _debuginfo_subpackages
93a1c0
93a1c0
# ======================================================
93a1c0
# Finally, the changelog:
93a1c0
# ======================================================
93a1c0
93a1c0
%changelog
d32976
* Tue Jul 27 2021 Charalampos Stratakis <cstratak@redhat.com> - 3.9.6-1
d32976
- Update to 3.9.6
d32976
- Fix CVE-2021-29921: Improper input validation of octal strings in the ipaddress module
d32976
Resolves: rhbz#1957458
d32976
0abd5e
* Fri Apr 30 2021 Charalampos Stratakis <cstratak@redhat.com> - 3.9.2-2
0abd5e
- Security fix for CVE-2021-3426: information disclosure via pydoc
0abd5e
Resolves: rhbz#1935913
0abd5e
b983f7
* Wed Mar 03 2021 Lumír Balhar <lbalhar@redhat.com> - 3.9.2-1
b983f7
- Update to 3.9.2 to fix CVE-2021-23336
b983f7
Resolves: rhbz#1928904
b983f7
c5b9d7
* Wed Feb 10 2021 Charalampos Stratakis <cstratak@redhat.com> - 3.9.1-5
c5b9d7
- Compile the debug build with -O0 instead of -Og
c5b9d7
Resolves: rhbz#1926283
c5b9d7
c5b9d7
* Fri Feb 05 2021 Charalampos Stratakis <cstratak@redhat.com> - 3.9.1-4
c5b9d7
- Add support for FIPS mode
c5b9d7
Resolves: rhbz#1877430
c5b9d7
88b00c
* Wed Jan 27 2021 Tomas Orsava <torsava@redhat.com> - 3.9.1-3
88b00c
- Security fix for CVE-2021-3177
88b00c
- Resolves: rhbz#1918168, rhbz#1877430
88b00c
93a1c0
* Wed Jan 06 2021 Tomas Orsava <torsava@redhat.com> - 3.9.1-2
93a1c0
- Convert from Fedora to the python39 module in RHEL8
93a1c0
- Resolves: rhbz#1877430
93a1c0
93a1c0
* Tue Dec 08 2020 Tomas Hrnciar <thrnciar@redhat.com> - 3.9.1-1
93a1c0
- Update to 3.9.1
93a1c0
93a1c0
* Fri Nov 27 2020 Tomas Hrnciar <thrnciar@redhat.com> - 3.9.1~rc1-1
93a1c0
- Update to 3.9.1rc1
93a1c0
93a1c0
* Tue Oct 06 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0-1
93a1c0
- Update to 3.9.0 final
93a1c0
93a1c0
* Fri Sep 25 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~rc2-2
93a1c0
- Use upstream architecture names on Fedora 34+
93a1c0
- https://fedoraproject.org/wiki/Changes/Python_Upstream_Architecture_Names
93a1c0
93a1c0
* Thu Sep 17 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~rc2-1
93a1c0
- Update to 3.9.0rc2
93a1c0
93a1c0
* Wed Aug 12 2020 Petr Viktorin <pviktori@redhat.com> - 3.9.0~rc1-2
93a1c0
- In sys.version and initial REPL message, list the source commit as "default"
93a1c0
93a1c0
* Tue Aug 11 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~rc1-1
93a1c0
- Update to 3.9.0rc1
93a1c0
93a1c0
* Mon Aug 03 2020 Lumír Balhar <lbalhar@redhat.com> - 3.9.0~b5-5
93a1c0
- Add support for upstream architectures' names (patch 353)
93a1c0
93a1c0
* Thu Jul 30 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~b5-4
93a1c0
- Make python3-libs installable without python3
93a1c0
  Resolves: rhbz#1862082
93a1c0
93a1c0
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.9.0~b5-3
93a1c0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
93a1c0
93a1c0
* Fri Jul 24 2020 Lumír Balhar <lbalhar@redhat.com> - 3.9.0~b5-2
93a1c0
- Add versioned pathfix%%{pybasever}.py to main and non-main RPMs
93a1c0
93a1c0
* Mon Jul 20 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~b5-1
93a1c0
- Update to 3.9.0b5
93a1c0
93a1c0
* Thu Jul 16 2020 Marcel Plch <mplch@redhat.com> - 3.9.0~b4-2
93a1c0
- Remove large, autogenerated Python sources and redundant pycache levels to reduce filesystem footprint
93a1c0
93a1c0
* Sat Jul 04 2020 Tomas Hrnciar <thrnciar@redhat.com> - 3.9.0~b4-1
93a1c0
- Update to 3.9.0b4
93a1c0
93a1c0
* Wed Jun 10 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~b3-1
93a1c0
- Update to 3.9.0b3
93a1c0
93a1c0
* Tue Jun 09 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~b2-1
93a1c0
- Update to 3.9.0b2
93a1c0
93a1c0
* Fri May 29 2020 Petr Viktorin <pviktori@redhat.com> - 3.9.0~b1-4
93a1c0
- Add cherry-picks for bugs found in 3.9.0b1
93a1c0
93a1c0
* Thu May 21 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~b1-3
93a1c0
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python3.9
93a1c0
93a1c0
* Thu May 21 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~b1-2
93a1c0
- Bootstrap for https://fedoraproject.org/wiki/Changes/Python3.9
93a1c0
93a1c0
* Tue May 19 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~b1-1
93a1c0
- Update to Python 3.9.0b1
93a1c0
93a1c0
* Thu May 07 2020 Tomas Orsava <torsava@redhat.com> - 3.9.0~a6-2
93a1c0
- Rename from python39 to python3.9
93a1c0
93a1c0
* Tue Apr 28 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~a6-1
93a1c0
- Update to Python 3.9.0a6
93a1c0
93a1c0
* Tue Mar 24 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~a5-1
93a1c0
- Update to Python 3.9.0a5
93a1c0
93a1c0
* Thu Feb 27 2020 Marcel Plch <mplch@redhat.com> - 3.9.0~a4-1
93a1c0
- Update to Python 3.9.0a4
93a1c0
93a1c0
* Tue Feb 11 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~a3-2
93a1c0
- Update the ensurepip module to work with setuptools >= 45
93a1c0
93a1c0
* Mon Jan 27 2020 Victor Stinner <vstinner@python.org> - 3.9.0~a3-1
93a1c0
- Update to Python 3.9.0a3
93a1c0
93a1c0
* Thu Dec 19 2019 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~a2-1
93a1c0
- Rebased to Python 3.9.0a2
93a1c0
93a1c0
* Wed Dec 04 2019 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~a1-3
93a1c0
- Build Python with -fno-semantic-interposition for better performance
93a1c0
- https://fedoraproject.org/wiki/Changes/PythonNoSemanticInterpositionSpeedup
93a1c0
93a1c0
* Thu Nov 28 2019 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~a1-2
93a1c0
- Don't remove the test.test_tools module
93a1c0
93a1c0
* Wed Nov 20 2019 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~a1-1
93a1c0
- Rebased to Python 3.9.0a1
93a1c0
93a1c0
* Mon Oct 14 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0-1
93a1c0
- Update to Python 3.8.0 final
93a1c0
93a1c0
* Tue Oct 01 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~rc1-1
93a1c0
- Rebased to Python 3.8.0rc1
93a1c0
93a1c0
* Sat Aug 31 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~b4-1
93a1c0
- Rebased to Python 3.8.0b4
93a1c0
- Enable Profile-guided optimization for all arches, not just x86 (#1741015)
93a1c0
93a1c0
* Mon Jul 29 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~b3-1
93a1c0
- Update to 3.8.0b3
93a1c0
93a1c0
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.8.0~b2-2
93a1c0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
93a1c0
93a1c0
* Fri Jul 05 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~b2-1
93a1c0
- Update to 3.8.0b2
93a1c0
93a1c0
* Wed Jun 05 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~b1-1
93a1c0
- Update to 3.8.0b1
93a1c0
93a1c0
* Fri May 17 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~a4-2
93a1c0
- Remove a faulty patch that resulted in invalid value of
93a1c0
  distutils.sysconfig.get_config_var('LIBPL') (#1710767)
93a1c0
93a1c0
* Tue May 07 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~a4-1
93a1c0
- Update to 3.8.0a4
93a1c0
93a1c0
* Tue Mar 26 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~a3-1
93a1c0
- Update to 3.8.0a3
93a1c0
93a1c0
* Mon Feb 25 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~a2-1
93a1c0
- Update to 3.8.0a2
93a1c0
93a1c0
* Mon Feb 18 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~a1-3
93a1c0
- Reduced default build flags used to build extension modules
93a1c0
  https://fedoraproject.org/wiki/Changes/Python_Extension_Flags
93a1c0
93a1c0
* Sun Feb 17 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.8.0~a1-2
93a1c0
- Rebuild for readline 8.0
93a1c0
93a1c0
* Tue Feb 05 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~a1-1
93a1c0
- Update to 3.8.0a1