043c574
# ==================
043c574
# Top-level metadata
043c574
# ==================
043c574
b180b30
%global pybasever 3.9
c769a6b
043c574
# pybasever without the dot:
b180b30
%global pyshortver 39
043c574
97711d6
Name: python%{pybasever}
3dcd1e8
Summary: Version %{pybasever} of the Python interpreter
8c67baf
URL: https://www.python.org/
8c67baf
b7855d3
#  WARNING  When rebasing to a new Python version,
b7855d3
#           remember to update the python3-docs package as well
1fb3c04
%global general_version %{pybasever}.0
02c3d0c
%global prerel b5
1fb3c04
%global upstream_version %{general_version}%{?prerel}
1fb3c04
Version: %{general_version}%{?prerel:~%{prerel}}
02c3d0c
Release: 1%{?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
83f99db
# Main Python, i.e. whether this is the main Python version in the distribution
83f99db
# that owns /usr/bin/python3 and other unique paths
d799859
# This also means the built subpackages are called python3 rather than python3X
d799859
# WARNING: This also influences the flatpackage bcond below.
d799859
# By default, this is determined by the %%__default_python3_pkgversion value
97711d6
%if "%{?__default_python3_pkgversion}" == "%{pybasever}"
d799859
%bcond_without main_python
d799859
%else
83f99db
%bcond_with main_python
d799859
%endif
d799859
d799859
# Flat package, i.e. no separate subpackages
d799859
# Default (in Fedora): if this is a main Python, it is not a flatpackage
04353ec
# Not supported: Combination of flatpackage enabled and main_python enabled
d799859
%if %{with main_python}
d799859
%bcond_with flatpackage
83f99db
%else
d799859
%bcond_without flatpackage
83f99db
%endif
83f99db
ad7d856
# When bootstrapping python3, we need to build setuptools.
ad7d856
# but setuptools BR python3-devel and that brings in python3-rpm-generators;
ad7d856
# python3-rpm-generators needs python3-setuptools, so we cannot have it yet.
ad7d856
#
d74ac90
# We also use the previous build of Python in "make regen-all"
d74ac90
# and in "distutils.tests.test_bdist_rpm".
d74ac90
#
ad7d856
# Procedure: https://fedoraproject.org/wiki/SIGs/Python/UpgradingPython
ad7d856
#
ad7d856
#   IMPORTANT: When bootstrapping, it's very likely the wheels for pip and
ad7d856
#   setuptools are not available. Turn off the rpmwheels bcond until
ad7d856
#   the two packages are built with wheels to get around the issue.
6da7cc6
%bcond_with bootstrap
ad7d856
0b241ab
# Whether to use RPM build wheels from the python-{pip,setuptools}-wheel package
0b241ab
# Uses upstream bundled prebuilt wheels otherwise
0b241ab
%bcond_without rpmwheels
8c67baf
f63e273
# Expensive optimizations (mainly, profile-guided optimizations)
3ba1d1a
%bcond_without optimizations
a7a170b
33b3a95
# https://fedoraproject.org/wiki/Changes/PythonNoSemanticInterpositionSpeedup
33b3a95
%bcond_without no_semantic_interposition
33b3a95
f63e273
# Run the test suite in %%check
3ba1d1a
%bcond_without tests
f63e273
f63e273
# Extra build for debugging the interpreter or C-API extensions
f63e273
# (the -debug subpackages)
8c67baf
%if %{with flatpackage}
8c67baf
%bcond_with debug_build
8c67baf
%else
043c574
%bcond_without debug_build
8c67baf
%endif
f63e273
f63e273
# Support for the GDB debugger
043c574
%bcond_without gdb_hooks
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
a64e7f7
%ifarch %{valgrind_arches}
043c574
%bcond_without valgrind
043c574
%else
043c574
%bcond_with valgrind
043c574
%endif
043c574
043c574
043c574
# =====================
043c574
# General global macros
043c574
# =====================
d799859
%if %{with main_python}
d799859
%global pkgname python3
d799859
%global exename python3
d799859
%else
97711d6
%global pkgname python%{pybasever}
d799859
%global exename python%{pybasever}
d799859
%endif
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/
285f554
%global ABIFLAGS_optimized %{nil}
285f554
%global ABIFLAGS_debug     d
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
3bbc2a0
#   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
d799859
# When a main_python build is attempted despite the %%__default_python3_pkgversion value
78de369
# We undefine magic macros so the python3-... package does not provide wrong python3X-...
97711d6
%if %{with main_python} && ("%{?__default_python3_pkgversion}" != "%{pybasever}")
78de369
%undefine __pythonname_provides
d799859
%{warn:Doing a main_python build with wrong %%__default_python3_pkgversion (0%{?__default_python3_pkgversion}, but this is %pyshortver)}
d799859
%endif
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}
75005c2
BuildRequires: gdbm-devel
5fe31d8
%endif
0a760f0
BuildRequires: git-core
7be8eeb
BuildRequires: glibc-all-langpacks
c769a6b
BuildRequires: glibc-devel
c769a6b
BuildRequires: gmp-devel
853a0fc
BuildRequires: gnupg2
66c621f
BuildRequires: libappstream-glib
c769a6b
BuildRequires: libffi-devel
6ff303e
BuildRequires: libnsl2-devel
6ff303e
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
8449402
BuildRequires: redhat-rpm-config >= 127
c769a6b
BuildRequires: sqlite-devel
47069ff
BuildRequires: gdb
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
0b241ab
%if %{with rpmwheels}
0b241ab
BuildRequires: python-setuptools-wheel
0b241ab
BuildRequires: python-pip-wheel
Matej Stuchlik 11fb599
%endif
Matej Stuchlik 11fb599
7e0c125
%if %{without bootstrap}
17d3976
# for make regen-all and distutils.tests.test_bdist_rpm
97711d6
BuildRequires: python%{pybasever}
1e0644a
# for proper automatic provides
1e0644a
BuildRequires: python3-rpm-generators
7e0c125
%endif
c769a6b
c769a6b
# =======================
c769a6b
# Source code and patches
c769a6b
# =======================
c769a6b
853a0fc
Source0: %{url}ftp/python/%{general_version}/Python-%{upstream_version}.tar.xz
853a0fc
Source1: %{url}ftp/python/%{general_version}/Python-%{upstream_version}.tar.xz.asc
853a0fc
Source2: %{url}static/files/pubkeys.txt
4aab458
3dbbc14
# A simple script to check timestamps of bytecode files
3dbbc14
# Run in check section with Python that is currently being built
37056bc
# Originally written by bkabrda
37056bc
Source8: check-pyc-timestamps.py
71040c9
860f392
# Desktop menu entry for idle3
860f392
Source10: idle3.desktop
860f392
860f392
# AppData file for idle3
860f392
Source11: idle3.appdata.xml
860f392
acc1ca2
# (Patches taken from github.com/fedora-python/cpython)
acc1ca2
acc1ca2
# 00001 # d06a8853cf4bae9e115f45e1d531d2dc152c5cc8
acc1ca2
# Fixup distutils/unixccompiler.py to remove standard library path from rpath
acc1ca2
# Was Patch0 in ivazquez' python3000 specfile
acc1ca2
Patch1: 00001-rpath.patch
acc1ca2
acc1ca2
# 00111 # 03918d404a40a50c9f5f93dc748b52e613d70d31
acc1ca2
# Don't try to build a libpythonMAJOR.MINOR.a
acc1ca2
#
acc1ca2
# Downstream only: not appropriate for upstream.
acc1ca2
#
c4a5733
# See https://bugzilla.redhat.com/show_bug.cgi?id=556092
c923b51
Patch111: 00111-no-static-lib.patch
c923b51
acc1ca2
# 00189 # da1624564eb80bee8c289bc0dea347774a891a10
acc1ca2
# Instead of bundled wheels, use our RPM packaged wheels
acc1ca2
#
acc1ca2
# We keep them in /usr/share/python-wheels
acc1ca2
#
6b5182a
# Downstream only: upstream bundles
6b5182a
# We might eventually pursuit upstream support, but it's low prio
0b241ab
Patch189: 00189-use-rpm-wheels.patch
7367fec
# The following versions of setuptools/pip are bundled when this patch is not applied.
7367fec
# The versions are written in Lib/ensurepip/__init__.py, this patch removes them.
7367fec
# When the bundled setuptools/pip wheel is updated, the patch no longer applies cleanly.
7367fec
# In such cases, the patch needs to be amended and the versions updated here:
efdda00
%global pip_version 20.1.1
efdda00
%global setuptools_version 47.1.0
486eb43
acc1ca2
# 00251 # 2eabd04356402d488060bc8fe316ad13fc8a3356
acc1ca2
# Change user install location
acc1ca2
#
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
acc1ca2
# is not detected to make pip and distutils install into separate location.
acc1ca2
#
46034c8
# Fedora Change: https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe
6b5182a
# Downstream only: Awaiting resources to work on upstream PEP
332b947
Patch251: 00251-change-user-install-location.patch
332b947
acc1ca2
# 00274 # 1e9258f6e8f70e86d5130113d3eed22993cf3da9
acc1ca2
# Upstream uses Debian-style architecture naming, change to match Fedora
9423d36
Patch274: 00274-fix-arch-names.patch
9423d36
acc1ca2
# 00328 # 367fdcb5a075f083aea83ac174999272a8faf75c
acc1ca2
# Restore pyc to TIMESTAMP invalidation mode as default in rpmbuild
acc1ca2
#
acc1ca2
# Since Fedora 31, the $SOURCE_DATE_EPOCH is set in rpmbuild to the latest
acc1ca2
# %%changelog date. This makes Python default to the CHECKED_HASH pyc
acc1ca2
# invalidation mode, bringing more reproducible builds traded for an import
acc1ca2
# performance decrease. To avoid that, we don't default to CHECKED_HASH
acc1ca2
# when $RPM_BUILD_ROOT is set (i.e. when we are building RPM packages).
acc1ca2
#
9213c03
# See https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/57#comment-27426
6b5182a
# Downstream only: only used when building RPM packages
6b5182a
# Ideally, we should talk to upstream and explain why we don't want this
9213c03
Patch328: 00328-pyc-timestamp-invalidation-mode.patch
9213c03
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
285f554
#
285f554
# The patches are stored and rebased at:
285f554
#
285f554
#     https://github.com/fedora-python/cpython
77a5f91
c969609
094ccc0
# ==========================================
094ccc0
# Descriptions, and metadata for subpackages
094ccc0
# ==========================================
a3483f9
d799859
# this if branch is ~300 lines long and contains subpackages' definitions
d799859
%if %{without flatpackage}
d799859
%if %{with main_python}
d799859
# Description for the python3X SRPM only:
d799859
%description
d799859
Python %{pybasever} is an accessible, high-level, dynamically typed, interpreted
d799859
programming language, designed with an emphasis on code readability.
d799859
It includes an extensive standard library, and has a vast ecosystem of
d799859
third-party libraries.
d799859
d799859
%package -n %{pkgname}
d799859
Summary: Python %{pybasever} interpreter
d799859
f50a7d3
# In order to support multiple Python interpreters for development purposes,
97711d6
# packages with the naming scheme flatpackage (e.g. python3.5) exist for
f50a7d3
# non-default versions of Python 3.
97711d6
# For consistency, we provide python3.X from python3 as well.
97711d6
Provides: python%{pybasever} = %{version}-%{release}
97711d6
Provides: python%{pybasever}%{?_isa} = %{version}-%{release}
97711d6
# To keep the upgrade path clean, we Obsolete python3.X.
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
97711d6
# replace python3.6-3.6.2.
97711d6
Obsoletes: python%{pybasever}
1768987
988896a
# https://fedoraproject.org/wiki/Changes/Move_usr_bin_python_into_separate_package
988896a
# https://fedoraproject.org/wiki/Changes/Python_means_Python3
988896a
# We recommend /usr/bin/python so users get it by default
988896a
# Versioned recommends are problematic, and we know that the package requires
988896a
# python3 back with fixed version, so we just use the path here:
988896a
Recommends: %{_bindir}/python
83f99db
%endif
988896a
97711d6
# Python interpreter packages used to be named (or provide) name pythonXY (e.g.
97711d6
# python39). However, to align it with the executable names and to prepare for
97711d6
# Python 3.10, they were renamed to pythonX.Y (e.g. python3.9, python3.10). We
97711d6
# provide and obsolete the previous names.
97711d6
# - Here are the tags for the nonflat package, regardless if main_python (e.g.
97711d6
#   python3) or not (e.g. python39). For the flat package, the provide is
97711d6
#   repeated many lines later.
97711d6
Provides: python%{pyshortver} = %{version}-%{release}
97711d6
Obsoletes: python%{pyshortver} < %{version}-%{release}
04353ec
04353ec
# Packages with Python modules in standard locations automatically
04353ec
# depend on python(abi). Provide that here.
04353ec
Provides: python(abi) = %{pybasever}
04353ec
04353ec
Requires: %{pkgname}-libs%{?_isa} = %{version}-%{release}
04353ec
988896a
# In Fedora 31, /usr/bin/pydoc was moved here from Python 2.
988896a
# Ideally we'd have an explicit conflict with "/usr/bin/pydoc < 3",
988896a
# but file provides aren't versioned and the file moved across packages.
988896a
# Instead, we rely on the conflict in python3-libs.
988896a
b9e8a46
# Previously, this was required for our rewheel patch to work.
b9e8a46
# This is technically no longer needed, but we keep it recommended
b9e8a46
# for the developer experience.
1b0f2ac
Recommends: %{pkgname}-setuptools
1b0f2ac
Recommends: %{pkgname}-pip
b9e8a46
3f778c4
# This prevents ALL subpackages built from this spec to require
3f778c4
# /usr/bin/python3*. Granularity per subpackage is impossible.
3f778c4
# It's intended for the libs package not to drag in the interpreter, see
3f778c4
# https://bugzilla.redhat.com/show_bug.cgi?id=1547131
d799859
# All others require %%{pkgname} anyway.
3f778c4
%global __requires_exclude ^/usr/bin/python3
3f778c4
d799859
%description -n %{pkgname}
d799859
Python %{pybasever} is an accessible, high-level, dynamically typed, interpreted
d799859
programming language, designed with an emphasis on code readability.
c2f8719
It includes an extensive standard library, and has a vast ecosystem of
c2f8719
third-party libraries.
6245861
d799859
The %{pkgname} package provides the "%{exename}" executable: the reference
15a5ab1
interpreter for the Python language, version 3.
d799859
The majority of its standard library is provided in the %{pkgname}-libs package,
d799859
which should be installed automatically along with %{pkgname}.
c2f8719
The remaining parts of the Python standard library are broken out into the
d799859
%{pkgname}-tkinter and %{pkgname}-test packages, which may need to be installed
c2f8719
separately.
6245861
d799859
Documentation for Python is provided in the %{pkgname}-docs package.
c2f8719
c2f8719
Packages containing additional libraries for Python are generally named with
d799859
the "%{pkgname}-" prefix.
6245861
a3483f9
83f99db
%if %{with main_python}
988896a
# https://fedoraproject.org/wiki/Changes/Move_usr_bin_python_into_separate_package
988896a
# https://fedoraproject.org/wiki/Changes/Python_means_Python3
988896a
%package -n python-unversioned-command
988896a
Summary: The "python" command that runs Python 3
988896a
BuildArch: noarch
988896a
988896a
# In theory this could require any python3 version
988896a
Requires: python3 == %{version}-%{release}
988896a
# But since we want to provide versioned python, we require exact version
988896a
Provides: python = %{version}-%{release}
988896a
# This also save us an explicit conflict for older python3 builds
988896a
988896a
%description -n python-unversioned-command
988896a
This package contains /usr/bin/python - the "python" command that runs Python 3.
988896a
83f99db
%endif # with main_python
83f99db
988896a
d799859
%package -n %{pkgname}-libs
6245861
Summary:        Python runtime libraries
a3483f9
0b241ab
%if %{with rpmwheels}
0b241ab
Requires: python-setuptools-wheel
0b241ab
Requires: python-pip-wheel
0b241ab
%else
7367fec
Provides: bundled(python3dist(pip)) = %{pip_version}
7367fec
Provides: bundled(python3dist(setuptools)) = %{setuptools_version}
0b241ab
%endif
0b241ab
3f778c4
# There are files in the standard library that have python shebang.
3f778c4
# We've filtered the automatic requirement out so libs are installable without
3f778c4
# the main package. This however makes it pulled in by default.
3f778c4
# See https://bugzilla.redhat.com/show_bug.cgi?id=1547131
d799859
Recommends: %{pkgname}%{?_isa} = %{version}-%{release}
3f778c4
9885fc6
# tkinter is part of the standard library,
9885fc6
# but it is torn out to save an unwanted dependency on tk and X11.
9885fc6
# we recommend it when tk is already installed (for better UX)
d799859
Recommends: (%{pkgname}-tkinter%{?_isa} = %{version}-%{release} if tk%{?_isa})
9885fc6
988896a
# https://fedoraproject.org/wiki/Changes/Move_usr_bin_python_into_separate_package
988896a
# In Fedora 31, several "unversioned" files like /usr/bin/pydoc and all the
988896a
# "unversioned" provides were moved from python2 to python3.
988896a
# So, newer python3 packages need to conflict with old Python 2 builds that
988896a
# still provided unversioned Python.
988896a
# Since all python packages, new and old, have versioned requires on
988896a
# python?-libs, we do it here:
988896a
Conflicts: python-libs < 3
988896a
# (We explicitly conflict with python-libs and not python2-libs, so only the
988896a
# old Python 2 builds that still provided unversioned Python are handled.)
988896a
988896a
d799859
%description -n %{pkgname}-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
d799859
  a scripting language, and by the main "%{exename}" executable
c2f8719
a3483f9
d799859
%package -n %{pkgname}-devel
6245861
Summary: Libraries and header files needed for Python development
d799859
Requires: %{pkgname} = %{version}-%{release}
d799859
Requires: %{pkgname}-libs%{?_isa} = %{version}-%{release}
e9ba67b
# The RPM related dependencies bring nothing to a non-RPM Python developer
e9ba67b
# But we want them when packages BuildRequire python3-devel
e9ba67b
Requires: (python-rpm-macros if rpm-build)
e9ba67b
Requires: (python3-rpm-macros if rpm-build)
b9306b1
ad7d856
%if %{without bootstrap}
4da7cff
# This is not "API" (packages that need setuptools should still BuildRequire it)
4da7cff
# However some packages apparently can build both with and without setuptools
4da7cff
# producing egg-info as file or directory (depending on setuptools presence).
4da7cff
# Directory-to-file updates are problematic in RPM, so we ensure setuptools is
4da7cff
# installed when -devel is required.
4da7cff
# See https://bugzilla.redhat.com/show_bug.cgi?id=1623914
4da7cff
# See https://fedoraproject.org/wiki/Packaging:Directory_Replacement
1b0f2ac
Requires: (%{pkgname}-setuptools if rpm-build)
4da7cff
e9ba67b
Requires: (python3-rpm-generators if rpm-build)
ad7d856
%endif
ad7d856
d799859
Provides: %{pkgname}-2to3 = %{version}-%{release}
d938460
Provides: 2to3 = %{version}-%{release}
d938460
d799859
Conflicts: %{pkgname} < %{version}-%{release}
a3483f9
988896a
# In Fedora 31, several "unversioned" files were moved here from Python 2:
988896a
# pygettext.py, msgfmt.py, python-config, python.pc
988896a
Conflicts: python-devel < 3
988896a
d799859
%description -n %{pkgname}-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
d938460
It also contains the necessary macros to build RPM packages with Python modules
d938460
and 2to3 tool, an automatic source converter from Python 2.X.
6245861
a3483f9
d799859
%package -n %{pkgname}-idle
d938460
Summary: A basic graphical development environment for Python
d799859
Requires: %{pkgname} = %{version}-%{release}
d799859
Requires: %{pkgname}-tkinter = %{version}-%{release}
a3483f9
b0aea52
Provides: idle3 = %{version}-%{release}
988896a
Provides: idle = %{version}-%{release}
b0aea52
d799859
Provides: %{pkgname}-tools = %{version}-%{release}
d799859
Provides: %{pkgname}-tools%{?_isa} = %{version}-%{release}
d799859
Obsoletes: %{pkgname}-tools < %{version}-%{release}
357f40b
988896a
# In Fedora 31, /usr/bin/idle was moved here from Python 2.
988896a
Conflicts: python-tools < 3
988896a
d799859
%description -n %{pkgname}-idle
d938460
IDLE is Python’s Integrated Development and Learning Environment.
d938460
d938460
IDLE has the following features: Python shell window (interactive
d938460
interpreter) with colorizing of code input, output, and error messages;
d938460
multi-window text editor with multiple undo, Python colorizing,
d938460
smart indent, call tips, auto completion, and other features;
d938460
search within any window, replace within editor windows, and
d938460
search through multiple files (grep); debugger with persistent
d938460
breakpoints, stepping, and viewing of global and local namespaces;
d938460
configuration, browsers, and other dialogs.
c2f8719
a3483f9
d799859
%package -n %{pkgname}-tkinter
6245861
Summary: A GUI toolkit for Python
d799859
Requires: %{pkgname} = %{version}-%{release}
a3483f9
d799859
%description -n %{pkgname}-tkinter
c2f8719
The Tkinter (Tk interface) library is a graphical user interface toolkit for
c2f8719
the Python programming language.
c2f8719
a3483f9
d799859
%package -n %{pkgname}-test
c2f8719
Summary: The self-test suite for the main python3 package
d799859
Requires: %{pkgname} = %{version}-%{release}
d799859
Requires: %{pkgname}-libs%{?_isa} = %{version}-%{release}
a3483f9
d799859
%description -n %{pkgname}-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,
d799859
you should use the unittest module from %{pkgname}-libs, or a library such as
d799859
%{pkgname}-pytest.
a3483f9
a3483f9
043c574
%if %{with debug_build}
d799859
%package -n %{pkgname}-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
3bbc2a0
# 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:
d799859
Requires: %{pkgname}%{?_isa} = %{version}-%{release}
d799859
Requires: %{pkgname}-libs%{?_isa} = %{version}-%{release}
d799859
Requires: %{pkgname}-devel%{?_isa} = %{version}-%{release}
d799859
Requires: %{pkgname}-test%{?_isa} = %{version}-%{release}
d799859
Requires: %{pkgname}-tkinter%{?_isa} = %{version}-%{release}
d799859
Requires: %{pkgname}-idle%{?_isa} = %{version}-%{release}
55cf580
988896a
# In Fedora 31, /usr/bin/python-debug was moved here from Python 2.
988896a
Conflicts: python-debug < 3
988896a
d799859
%description -n %{pkgname}-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 debug build shares installation directories with the standard Python
69c2d11
runtime. Python modules -- source (.py), bytecode (.pyc), and C-API extensions
69c2d11
(.cpython*.so) -- are compatible between this and the standard version
69c2d11
of Python.
69c2d11
69c2d11
The debug runtime additionally supports debug builds of C-API extensions
69c2d11
(with the "d" ABI flag) for debugging issues in those extensions.
043c574
%endif # with debug_build
55cf580
8c67baf
%else  # with flatpackage
8c67baf
8c67baf
# We'll not provide this, on purpose
8c67baf
# No package in Fedora shall ever depend on flatpackage via this
8c67baf
%global __requires_exclude ^python\\(abi\\) = 3\\..$
8c67baf
%global __provides_exclude ^python\\(abi\\) = 3\\..$
8c67baf
97711d6
# Python interpreter packages used to be named (or provide) name pythonXY (e.g.
97711d6
# python39). However, to align it with the executable names and to prepare for
97711d6
# Python 3.10, they were renamed to pythonX.Y (e.g. python3.9, python3.10). We
97711d6
# provide and obsolete the previous names.
97711d6
# - Here are the tags for the flat package. For the nonflat package, the
97711d6
#   provide is repeated many lines above.
97711d6
Provides: python%{pyshortver} = %{version}-%{release}
97711d6
Obsoletes: python%{pyshortver} < %{version}-%{release}
d799859
0b241ab
%if %{with rpmwheels}
0b241ab
Requires: python-setuptools-wheel
0b241ab
Requires: python-pip-wheel
0b241ab
%else
7367fec
Provides: bundled(python3dist(pip)) = %{pip_version}
7367fec
Provides: bundled(python3dist(setuptools)) = %{setuptools_version}
0b241ab
%endif
8c67baf
d799859
# The description for the flat package (SRPM and built)
8c67baf
%description
8c67baf
Python %{pybasever} package for developers.
8c67baf
fc23c47
This package exists to allow developers to test their code against a newer
8c67baf
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.
8c67baf
8c67baf
%endif # with flatpackage
c2f8719
c769a6b
# ======================================================
c769a6b
# The prep phase of the build:
c769a6b
# ======================================================
c769a6b
a3483f9
%prep
853a0fc
%gpgverify -k2 -s1 -d0
0a760f0
%autosetup -S git_am -N -n Python-%{upstream_version}
0a760f0
0a760f0
# Apply patches up to 188
0a760f0
%autopatch -M 188
0a760f0
0a760f0
%if %{with rpmwheels}
0a760f0
%apply_patch -q %{PATCH189}
0a760f0
rm Lib/ensurepip/_bundled/*.whl
0a760f0
%endif
0a760f0
0a760f0
# Apply the remaining patches
0a760f0
%autopatch -m 190
0a760f0
1092d47
# Remove all exe files to ensure we are not shipping prebuilt binaries
1092d47
# note that those are only used to create Microsoft Windows installers
1092d47
# and that functionality is broken on Linux anyway
1092d47
find -name '*.exe' -print -delete
6859f23
3a884e4
# Remove bundled libraries to ensure that we're using the system copy.
3a884e4
rm -r Modules/expat
1ae4dd3
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
8449402
# We utilize the %%extension_...flags macros here so users building C/C++
8449402
# extensions with our python won't get all the compiler/linker flags used
8449402
# in Fedora RPMs.
8449402
# Standard library built here will still use the %%build_...flags,
8449402
# Fedora packages utilizing %%py3_build will use them as well
8449402
# https://fedoraproject.org/wiki/Changes/Python_Extension_Flags
8449402
export CFLAGS="%{extension_cflags} -D_GNU_SOURCE -fPIC -fwrapv"
33b3a95
export CFLAGS_NODIST="%{build_cflags} -D_GNU_SOURCE -fPIC -fwrapv%{?with_no_semantic_interposition: -fno-semantic-interposition}"
8449402
export CXXFLAGS="%{extension_cxxflags} -D_GNU_SOURCE -fPIC -fwrapv"
db2797c
export CPPFLAGS="$(pkg-config --cflags-only-I libffi)"
8449402
export OPT="%{extension_cflags} -D_GNU_SOURCE -fPIC -fwrapv"
a3483f9
export LINKCC="gcc"
db2797c
export CFLAGS="$CFLAGS $(pkg-config --cflags openssl)"
8449402
export LDFLAGS="%{extension_ldflags} -g $(pkg-config --libs-only-L openssl)"
33b3a95
export LDFLAGS_NODIST="%{build_ldflags}%{?with_no_semantic_interposition: -fno-semantic-interposition} -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
Marcel Plch 1206bb9
  # A workaround for https://bugs.python.org/issue39761
Marcel Plch 1206bb9
  export DFLAGS=" "
Marcel Plch 1206bb9
c969609
%configure \
b89d4ad
  --with-platlibdir=%{_lib} \
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 \
969d514
  --with-ssl-default-suites=openssl \
043c574
%if %{with valgrind}
31a06df
  --with-valgrind \
31a06df
%endif
55cf580
  $ExtraConfigArgs \
55cf580
  %{nil}
c969609
0c70c9d
%global flags_override EXTRA_CFLAGS="$MoreCFlags" CFLAGS_NODIST="$CFLAGS_NODIST $MoreCFlags"
0c70c9d
7e0c125
%if %{without bootstrap}
7e0c125
  # Regenerate generated files (needs python3)
0c70c9d
  %make_build %{flags_override} regen-all PYTHON_FOR_REGEN="python%{pybasever}"
7e0c125
%endif
7e0c125
db2797c
  # Invoke the build
0c70c9d
  %make_build %{flags_override}
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" \
091b4b2
  "-Og"
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}
06c7812
DirHoldingGdbPy=%{_usr}/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
eecc383
%global _pyconfig_h pyconfig-%{__isa_bits}.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
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
9c09449
  %make_install EXTRA_CFLAGS="$MoreCFlags"
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
e8fa184
#include "%{_pyconfig32_h}"
6c51695
#elif __WORDSIZE == 64
e8fa184
#include "%{_pyconfig64_h}"
6c51695
#else
6c51695
#error "Unknown word size"
6c51695
#endif
6c51695
EOF
6c51695
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 \
ffaa0f3
  %{LDVERSION_debug}
043c574
%endif # with debug_build
55cf580
55cf580
# Now the optimized build:
55cf580
InstallPython optimized \
208332b
  %{py_INSTSONAME_optimized} \
474cc9f
  "" \
ffaa0f3
  %{LDVERSION_optimized}
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
83f99db
%if %{with main_python}
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
341bcbc
install -D -m 0644 Lib/idlelib/Icons/idle_256.png %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/idle3.png
b3fc51b
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE10}
860f392
860f392
# Install and validate appdata file
838e397
mkdir -p %{buildroot}%{_metainfodir}
838e397
cp -a %{SOURCE11} %{buildroot}%{_metainfodir}
838e397
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/idle3.appdata.xml
8c67baf
%endif
860f392
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
d938460
# Install pathfix.py to bindir
d938460
# See https://github.com/fedora-python/python-rpm-porting/issues/24
d938460
cp -p Tools/scripts/pathfix.py %{buildroot}%{_bindir}/
d938460
83a5f52
# Install i18n tools to bindir
83a5f52
# They are also in python2, so we version them
83a5f52
# https://bugzilla.redhat.com/show_bug.cgi?id=1571474
83a5f52
for tool in pygettext msgfmt; do
83a5f52
  cp -p Tools/i18n/${tool}.py %{buildroot}%{_bindir}/${tool}%{pybasever}.py
83a5f52
  ln -s ${tool}%{pybasever}.py %{buildroot}%{_bindir}/${tool}3.py
83a5f52
done
83a5f52
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 \
6c5992e
  -i "%{_bindir}/python%{pybasever}" -pn \
6c5992e
  %{buildroot} \
83a5f52
  %{buildroot}%{_bindir}/*%{pybasever}.py \
6c5992e
  %{?with_gdb_hooks:%{buildroot}$DirHoldingGdbPy/*.py}
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
# 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
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
42de082
# Python CMD line options:
42de082
# -s - don't add user site directory to sys.path
42de082
# -B - don't write .pyc files on import
e8961f7
# compileall CMD line options:
42de082
# -f - force rebuild even if timestamps are up to date
42de082
# -o - optimization levels to run compilation with
42de082
# -s - part of path to left-strip from path to source file (buildroot)
42de082
# -p - path to add as prefix to path to source file (/ to make it absolute)
093c145
# --hardlink-dupes - hardlink different optimization level pycs together if identical (saves space)
42de082
LD_LIBRARY_PATH="%{buildroot}%{dynload_dir}/:%{buildroot}%{_libdir}" \
e8961f7
%{buildroot}%{_bindir}/python%{pybasever} -s -B -m compileall \
e8961f7
-f %{_smp_mflags} -o 0 -o 1 -o 2 -s %{buildroot} -p / %{buildroot} --hardlink-dupes || :
093c145
093c145
# Turn this BRP off, it is done by compileall2 --hardlink-dupes above
093c145
%global __brp_python_hardlink %{nil}
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
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
83f99db
%if %{with debug_build} && %{with main_python}
9640a7e
ln -s \
9640a7e
  %{_bindir}/python%{LDVERSION_debug} \
9640a7e
  %{buildroot}%{_bindir}/python3-debug
00fd884
%endif
9640a7e
dc669ab
# There's 2to3-X.X executable and 2to3 soft link to it.
dc669ab
# No reason to have both, so keep only 2to3 as an executable.
dc669ab
# See https://bugzilla.redhat.com/show_bug.cgi?id=1111275
dc669ab
mv %{buildroot}%{_bindir}/2to3-%{pybasever} %{buildroot}%{_bindir}/2to3
6a6d4a0
83f99db
%if %{without main_python}
8c67baf
# Remove stuff that would conflict with python3 package
8c67baf
rm %{buildroot}%{_bindir}/python3
8c67baf
rm %{buildroot}%{_bindir}/pydoc3
8c67baf
rm %{buildroot}%{_bindir}/pathfix.py
83a5f52
rm %{buildroot}%{_bindir}/pygettext3.py
83a5f52
rm %{buildroot}%{_bindir}/msgfmt3.py
8c67baf
rm %{buildroot}%{_bindir}/idle3
8c67baf
rm %{buildroot}%{_bindir}/python3-*
6a6d4a0
rm %{buildroot}%{_bindir}/2to3
8c67baf
rm %{buildroot}%{_libdir}/libpython3.so
8c67baf
rm %{buildroot}%{_mandir}/man1/python3.1*
8c67baf
rm %{buildroot}%{_libdir}/pkgconfig/python3.pc
a292838
rm %{buildroot}%{_libdir}/pkgconfig/python3-embed.pc
988896a
%else
988896a
# Link the unversioned stuff
988896a
# https://fedoraproject.org/wiki/Changes/Python_means_Python3
988896a
ln -s ./python3 %{buildroot}%{_bindir}/python
988896a
ln -s ./pydoc3 %{buildroot}%{_bindir}/pydoc
988896a
ln -s ./pygettext3.py %{buildroot}%{_bindir}/pygettext.py
988896a
ln -s ./msgfmt3.py %{buildroot}%{_bindir}/msgfmt.py
988896a
ln -s ./idle3 %{buildroot}%{_bindir}/idle
988896a
ln -s ./python3-config %{buildroot}%{_bindir}/python-config
988896a
ln -s ./python3.1 %{buildroot}%{_mandir}/man1/python.1
988896a
ln -s ./python3.pc %{buildroot}%{_libdir}/pkgconfig/python.pc
988896a
%if %{with debug_build}
988896a
ln -s ./python3-debug %{buildroot}%{_bindir}/python-debug
988896a
%endif
8c67baf
%endif
7e7918a
740668a
# Remove large, autogenerated sources and keep only the non-optimized pycache
740668a
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
740668a
    directory=$(dirname ${file})
740668a
    module=$(basename ${file%%.py})
740668a
    mv ${directory}/{__pycache__/${module}.cpython-%{pyshortver}.pyc,${module}.pyc}
740668a
    rm ${directory}/{__pycache__/${module}.cpython-%{pyshortver}.opt-?.pyc,${module}.py}
740668a
done
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
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
e21e6a6
  # Show some info, helpful for debugging test failures
e21e6a6
  LD_LIBRARY_PATH=$ConfDir $ConfDir/python -m test.pythoninfo
e21e6a6
35551f9
  # Run the upstream test suite
Victor Stinner f4a58d6
  # --timeout=1800: kill test running for longer than 30 minutes
17d3976
  # test_distutils
17d3976
  #   distutils.tests.test_bdist_rpm tests fail when bootstraping the Python
17d3976
  #   package: rpmbuild requires /usr/bin/pythonX.Y to be installed
a971d07
  # test_gdb on arm:
a971d07
  #   https://bugzilla.redhat.com/show_bug.cgi?id=1846390
9a778ac
  LD_LIBRARY_PATH=$ConfDir $ConfDir/python -m test.regrtest \
Victor Stinner f4a58d6
    -wW --slowest -j0 --timeout=1800 \
17d3976
    %if %{with bootstrap}
17d3976
    -x test_distutils \
17d3976
    %endif
4bc70e0
    %ifarch %{mips64}
1b09295
    -x test_ctypes \
4bc70e0
    %endif
a971d07
    %ifarch %{arm}
a971d07
    -x test_gdb \
a971d07
    %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
d799859
%files -n %{pkgname}
Iryna Shcherbina aba719b
%doc README.rst
8c67baf
83f99db
%if %{with main_python}
a3483f9
%{_bindir}/pydoc*
a3483f9
%{_bindir}/python3
8c67baf
%else
8c67baf
%{_bindir}/pydoc%{pybasever}
8c67baf
%endif
63459d7
8c67baf
%{_bindir}/python%{pybasever}
285f554
%{_bindir}/python%{LDVERSION_optimized}
988896a
%{_mandir}/*/*3*
26c1be5
26c1be5
83f99db
%if %{with main_python}
8c67baf
%if %{without flatpackage}
988896a
%files -n python-unversioned-command
83f99db
%endif
988896a
%{_bindir}/python
988896a
%{_mandir}/*/python.1*
83f99db
%endif
988896a
83f99db
%if %{without flatpackage}
d799859
%files -n %{pkgname}-libs
Iryna Shcherbina aba719b
%doc README.rst
8c67baf
%endif
60aba0a
11efc8e
%dir %{pylibdir}
11efc8e
%dir %{dynload_dir}
11efc8e
ff90d23
%license %{pylibdir}/LICENSE.txt
ff90d23
60aba0a
%{pylibdir}/lib2to3
8c67baf
%if %{without flatpackage}
60aba0a
%exclude %{pylibdir}/lib2to3/tests
8c67baf
%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}
8c67baf
0b241ab
%if %{with rpmwheels}
60aba0a
%exclude %{pylibdir}/ensurepip/_bundled
8c67baf
%else
8c67baf
%dir %{pylibdir}/ensurepip/_bundled
8c67baf
%{pylibdir}/ensurepip/_bundled/*.whl
78bc51a
%{pylibdir}/ensurepip/_bundled/__init__.py
78bc51a
%{pylibdir}/ensurepip/_bundled/__pycache__/*%{bytecode_suffixes}
8c67baf
%endif
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
cea6d60
%{dynload_dir}/_contextvars.%{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
cea6d60
%{dynload_dir}/_queue.%{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
4352870
%{dynload_dir}/_statistics.%{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
1fb3c04
%{dynload_dir}/_posixshmem.%{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
5080ffc
%{dynload_dir}/unicodedata.%{SOABI_optimized}.so
d668c1e
%{dynload_dir}/_uuid.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/xxlimited.%{SOABI_optimized}.so
1fb3c04
%{dynload_dir}/_xxsubinterpreters.%{SOABI_optimized}.so
5080ffc
%{dynload_dir}/zlib.%{SOABI_optimized}.so
c75e05c
%{dynload_dir}/_zoneinfo.%{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
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
8c67baf
%if %{without flatpackage}
5080ffc
%exclude %{pylibdir}/turtle.py
5080ffc
%exclude %{pylibdir}/__pycache__/turtle*%{bytecode_suffixes}
8c67baf
%endif
5080ffc
a3483f9
%{pylibdir}/urllib
347356c
%{pylibdir}/xml
d860201
%{pylibdir}/zoneinfo
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}
83f99db
%if %{with main_python}
34c15c7
%{_libdir}/libpython3.so
8c67baf
%endif
a3483f9
63459d7
8c67baf
%if %{without flatpackage}
d799859
%files -n %{pkgname}-devel
83f99db
%endif
83f99db
83f99db
%if %{with main_python}
d938460
%{_bindir}/2to3
8c67baf
%endif
8c67baf
bea97d9
%{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/*
8c67baf
%if %{without flatpackage}
bea97d9
%exclude %{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/Makefile
8c67baf
%exclude %{_includedir}/python%{LDVERSION_optimized}/%{_pyconfig_h}
8c67baf
%endif
5080ffc
%{_includedir}/python%{LDVERSION_optimized}/*.h
1385d6e
%{_includedir}/python%{LDVERSION_optimized}/internal/
1fb3c04
%{_includedir}/python%{LDVERSION_optimized}/cpython/
a3483f9
%doc Misc/README.valgrind Misc/valgrind-python.supp Misc/gdbinit
8c67baf
83f99db
%if %{with main_python}
a3483f9
%{_bindir}/python3-config
988896a
%{_bindir}/python-config
8c67baf
%{_libdir}/pkgconfig/python3.pc
988896a
%{_libdir}/pkgconfig/python.pc
a292838
%{_libdir}/pkgconfig/python3-embed.pc
8c67baf
%{_bindir}/pathfix.py
83a5f52
%{_bindir}/pygettext3.py
988896a
%{_bindir}/pygettext.py
83a5f52
%{_bindir}/msgfmt3.py
988896a
%{_bindir}/msgfmt.py
8c67baf
%endif
8c67baf
83a5f52
%{_bindir}/pygettext%{pybasever}.py
83a5f52
%{_bindir}/msgfmt%{pybasever}.py
83a5f52
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
a292838
%{_libdir}/pkgconfig/python-%{LDVERSION_optimized}-embed.pc
55cf580
%{_libdir}/pkgconfig/python-%{pybasever}.pc
a292838
%{_libdir}/pkgconfig/python-%{pybasever}-embed.pc
a3483f9
63459d7
8c67baf
%if %{without flatpackage}
d799859
%files -n %{pkgname}-idle
83f99db
%endif
8c67baf
83f99db
%if %{with main_python}
a3483f9
%{_bindir}/idle*
8c67baf
%else
8c67baf
%{_bindir}/idle%{pybasever}
8c67baf
%endif
8c67baf
d938460
%{pylibdir}/idlelib
8c67baf
83f99db
%if %{with main_python}
838e397
%{_metainfodir}/idle3.appdata.xml
860f392
%{_datadir}/applications/idle3.desktop
860f392
%{_datadir}/icons/hicolor/*/apps/idle3.*
8c67baf
%endif
a3483f9
8c67baf
%if %{without flatpackage}
d799859
%files -n %{pkgname}-tkinter
8c67baf
%endif
8c67baf
a3483f9
%{pylibdir}/tkinter
8c67baf
%if %{without flatpackage}
a3483f9
%exclude %{pylibdir}/tkinter/test
8c67baf
%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
8c67baf
%if %{without flatpackage}
d799859
%files -n %{pkgname}-test
8c67baf
%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
285f554
%{dynload_dir}/_testinternalcapi.%{SOABI_optimized}.so
285f554
%{dynload_dir}/_testmultiphase.%{SOABI_optimized}.so
d668c1e
%{dynload_dir}/_xxtestfuzz.%{SOABI_optimized}.so
a3483f9
%{pylibdir}/lib2to3/tests
a3483f9
%{pylibdir}/tkinter/test
e1c7be0
%{pylibdir}/unittest/test
a3483f9
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}
8c67baf
%if %{without flatpackage}
d799859
%files -n %{pkgname}-debug
83f99db
%endif
83f99db
83f99db
%if %{with main_python}
8c67baf
%{_bindir}/python3-debug
988896a
%{_bindir}/python-debug
8c67baf
%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
cea6d60
%{dynload_dir}/_contextvars.%{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
cea6d60
%{dynload_dir}/_queue.%{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
4352870
%{dynload_dir}/_statistics.%{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
1fb3c04
%{dynload_dir}/_posixshmem.%{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
5080ffc
%{dynload_dir}/unicodedata.%{SOABI_debug}.so
d668c1e
%{dynload_dir}/_uuid.%{SOABI_debug}.so
1fb3c04
%{dynload_dir}/_xxsubinterpreters.%{SOABI_debug}.so
d668c1e
%{dynload_dir}/_xxtestfuzz.%{SOABI_debug}.so
5080ffc
%{dynload_dir}/zlib.%{SOABI_debug}.so
c75e05c
%{dynload_dir}/_zoneinfo.%{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}
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
d8879e2
%{_libdir}/libpython%{LDVERSION_debug}.so.%{py_SOVERSION}
5080ffc
%{_libdir}/pkgconfig/python-%{LDVERSION_debug}.pc
a292838
%{_libdir}/pkgconfig/python-%{LDVERSION_debug}-embed.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
285f554
%{dynload_dir}/_testinternalcapi.%{SOABI_debug}.so
285f554
%{dynload_dir}/_testmultiphase.%{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
#
15a050e
# 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
02c3d0c
* Mon Jul 20 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~b5-1
02c3d0c
- Update to 3.9.0b5
02c3d0c
740668a
* Thu Jul 16 2020 Marcel Plch <mplch@redhat.com> - 3.9.0~b4-2
740668a
- Remove large, autogenerated Python sources and redundant pycache levels to reduce filesystem footprint
740668a
efdda00
* Sat Jul 04 2020 Tomas Hrnciar <thrnciar@redhat.com> - 3.9.0~b4-1
efdda00
- Update to 3.9.0b4
efdda00
3332fa2
* Wed Jun 10 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~b3-1
3332fa2
- Update to 3.9.0b3
3332fa2
d860201
* Tue Jun 09 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~b2-1
d860201
- Update to 3.9.0b2
d860201
424eca1
* Fri May 29 2020 Petr Viktorin <pviktori@redhat.com> - 3.9.0~b1-4
424eca1
- Add cherry-picks for bugs found in 3.9.0b1
424eca1
1524215
* Thu May 21 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~b1-3
1524215
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python3.9
1524215
feaf2a6
* Thu May 21 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~b1-2
feaf2a6
- Bootstrap for https://fedoraproject.org/wiki/Changes/Python3.9
feaf2a6
c75e05c
* Tue May 19 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~b1-1
c75e05c
- Update to Python 3.9.0b1
c75e05c
97711d6
* Thu May 07 2020 Tomas Orsava <torsava@redhat.com> - 3.9.0~a6-2
97711d6
- Rename from python39 to python3.9
97711d6
341bcbc
* Tue Apr 28 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~a6-1
341bcbc
- Update to Python 3.9.0a6
341bcbc
b89d4ad
* Tue Mar 24 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~a5-1
b89d4ad
- Update to Python 3.9.0a5
b89d4ad
Marcel Plch 1206bb9
* Thu Feb 27 2020 Marcel Plch <mplch@redhat.com> - 3.9.0~a4-1
Marcel Plch 1206bb9
- Update to Python 3.9.0a4
Marcel Plch 1206bb9
088c30c
* Tue Feb 11 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~a3-2
088c30c
- Update the ensurepip module to work with setuptools >= 45
088c30c
Victor Stinner 0ae3172
* Mon Jan 27 2020 Victor Stinner <vstinner@python.org> - 3.9.0~a3-1
Victor Stinner 0ae3172
- Update to Python 3.9.0a3
Victor Stinner 0ae3172
d335168
* Thu Dec 19 2019 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~a2-1
d335168
- Rebased to Python 3.9.0a2
d335168
620353d
* Wed Dec 04 2019 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~a1-3
620353d
- Build Python with -fno-semantic-interposition for better performance
620353d
- https://fedoraproject.org/wiki/Changes/PythonNoSemanticInterpositionSpeedup
620353d
a6d1cbb
* Thu Nov 28 2019 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~a1-2
a6d1cbb
- Don't remove the test.test_tools module
a6d1cbb
b180b30
* Wed Nov 20 2019 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~a1-1
b180b30
- Rebased to Python 3.9.0a1
b180b30
e070419
* Mon Oct 14 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0-1
e070419
- Update to Python 3.8.0 final
e070419
8e2dbb0
* Tue Oct 01 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~rc1-1
8e2dbb0
- Rebased to Python 3.8.0rc1
8e2dbb0
4352870
* Sat Aug 31 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~b4-1
4352870
- Rebased to Python 3.8.0b4
8f6e312
- Enable Profile-guided optimization for all arches, not just x86 (#1741015)
8f6e312
29530ba
* Mon Jul 29 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~b3-1
29530ba
- Update to 3.8.0b3
29530ba
d35394e
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.8.0~b2-2
d35394e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
d35394e
13257b5
* Fri Jul 05 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~b2-1
13257b5
- Update to 3.8.0b2
13257b5
a292838
* Wed Jun 05 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~b1-1
a292838
- Update to 3.8.0b1
a292838
7aab0dd
* Fri May 17 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~a4-2
7aab0dd
- Remove a faulty patch that resulted in invalid value of
7aab0dd
  distutils.sysconfig.get_config_var('LIBPL') (#1710767)
7aab0dd
285f554
* Tue May 07 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~a4-1
285f554
- Update to 3.8.0a4
285f554
804ec7c
* Tue Mar 26 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~a3-1
804ec7c
- Update to 3.8.0a3
804ec7c
5e25a87
* Mon Feb 25 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~a2-1
5e25a87
- Update to 3.8.0a2
5e25a87
8449402
* Mon Feb 18 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~a1-3
8449402
- Reduced default build flags used to build extension modules
8449402
  https://fedoraproject.org/wiki/Changes/Python_Extension_Flags
8449402
d080918
* Sun Feb 17 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.8.0~a1-2
d080918
- Rebuild for readline 8.0
d080918
1fb3c04
* Tue Feb 05 2019 Miro Hrončok <mhroncok@redhat.com> - 3.8.0~a1-1
1fb3c04
- Update to 3.8.0a1