churchyard / rpms / python3

Forked from rpms/python3 2 years ago
Clone
043c57
# ==================
043c57
# Top-level metadata
043c57
# ==================
043c57
d668c1
%global pybasever 3.7
c769a6
043c57
# pybasever without the dot:
d668c1
%global pyshortver 37
043c57
8c67ba
Name: python3
8c67ba
Summary: Interpreter of the Python programming language
8c67ba
URL: https://www.python.org/
8c67ba
b7855d
#  WARNING  When rebasing to a new Python version,
b7855d
#           remember to update the python3-docs package as well
20bc33
%global general_version %{pybasever}.5
ed58d6
#global prerel ...
45a436
%global upstream_version %{general_version}%{?prerel}
45a436
Version: %{general_version}%{?prerel:~%{prerel}}
dd5f80
Release: 1%{?dist}
043c57
License: Python
043c57
043c57
043c57
# ==================================
043c57
# Conditionals controlling the build
043c57
# ==================================
043c57
043c57
# Note that the bcond macros are named for the CLI option they create.
043c57
# "%%bcond_without" means "ENABLE by default and create a --without option"
043c57
63459d
8c67ba
# Flat package, i.e. python36, python37, python38 for tox etc.
8c67ba
# warning: changes some other defaults
8c67ba
# in Fedora, never turn this on for the python3 package
63459d
# and always keep it on for python37 etc.
8c67ba
# WARNING: This does not change the package name and summary above
8c67ba
%bcond_with flatpackage
8c67ba
0b241a
# Whether to use RPM build wheels from the python-{pip,setuptools}-wheel package
0b241a
# Uses upstream bundled prebuilt wheels otherwise
0b241a
%bcond_without rpmwheels
8c67ba
f63e27
# Expensive optimizations (mainly, profile-guided optimizations)
a7a170
%ifarch %{ix86} x86_64
3ba1d1
%bcond_without optimizations
a7a170
%else
f63e27
# On some architectures, the optimized build takes tens of hours, possibly
f63e27
# longer than Koji's 24-hour timeout. Disable optimizations here.
a7a170
%bcond_with optimizations
a7a170
%endif
a7a170
f63e27
# Run the test suite in %%check
3ba1d1
%bcond_without tests
f63e27
f63e27
# Extra build for debugging the interpreter or C-API extensions
f63e27
# (the -debug subpackages)
8c67ba
%if %{with flatpackage}
8c67ba
%bcond_with debug_build
8c67ba
%else
043c57
%bcond_without debug_build
8c67ba
%endif
f63e27
f63e27
# Support for the GDB debugger
043c57
%bcond_without gdb_hooks
f63e27
f63e27
# The dbm.gnu module (key-value database)
043c57
%bcond_without gdbm
f63e27
f63e27
# Main interpreter loop optimization
043c57
%bcond_without computed_gotos
043c57
f63e27
# Support for the Valgrind debugger/profiler
a64e7f
%ifarch %{valgrind_arches}
043c57
%bcond_without valgrind
043c57
%else
043c57
%bcond_with valgrind
043c57
%endif
043c57
043c57
d90f98
# Notes from bootstraping Python 3.7:
d90f98
# https://fedoraproject.org/wiki/SIGs/Python/UpgradingPython
Matej Stuchlik 95668b
Matej Stuchlik 11fb59
043c57
# =====================
043c57
# General global macros
043c57
# =====================
5080ff
a3483f
%global pylibdir %{_libdir}/python%{pybasever}
4aab45
%global dynload_dir %{pylibdir}/lib-dynload
a3483f
0c74e1
# ABIFLAGS, LDVERSION and SOABI are in the upstream configure.ac
0c74e1
# See PEP 3149 for some background: http://www.python.org/dev/peps/pep-3149/
1c94c1
%global ABIFLAGS_optimized m
1c94c1
%global ABIFLAGS_debug     dm
5080ff
5080ff
%global LDVERSION_optimized %{pybasever}%{ABIFLAGS_optimized}
5080ff
%global LDVERSION_debug     %{pybasever}%{ABIFLAGS_debug}
5080ff
Robert Kuska 08f373
%global SOABI_optimized cpython-%{pyshortver}%{ABIFLAGS_optimized}-%{_arch}-linux%{_gnu}
Robert Kuska 08f373
%global SOABI_debug     cpython-%{pyshortver}%{ABIFLAGS_debug}-%{_arch}-linux%{_gnu}
5080ff
0c74e1
# All bytecode files are in a __pycache__ subdirectory, with a name
0c74e1
# reflecting the version of the bytecode.
0c74e1
# See PEP 3147: http://www.python.org/dev/peps/pep-3147/
7eb10c
# For example,
7eb10c
#   foo/bar.py
0c74e1
# has bytecode at:
043c57
#   foo/__pycache__/bar.cpython-%%{pyshortver}.pyc
043c57
#   foo/__pycache__/bar.cpython-%%{pyshortver}.opt-1.pyc
3bbc2a
#   foo/__pycache__/bar.cpython-%%{pyshortver}.opt-2.pyc
043c57
%global bytecode_suffixes .cpython-%{pyshortver}*.pyc
7eb10c
d5a5bf
# Python's configure script defines SOVERSION, and this is used in the Makefile
d5a5bf
# to determine INSTSONAME, the name of the libpython DSO:
d5a5bf
#   LDLIBRARY='libpython$(VERSION).so'
d5a5bf
#   INSTSONAME="$LDLIBRARY".$SOVERSION
d5a5bf
# We mirror this here in order to make it easier to add the -gdb.py hooks.
d5a5bf
# (if these get out of sync, the payload of the libs subpackage will fail
d5a5bf
# and halt the build)
d5a5bf
%global py_SOVERSION 1.0
5080ff
%global py_INSTSONAME_optimized libpython%{LDVERSION_optimized}.so.%{py_SOVERSION}
5080ff
%global py_INSTSONAME_debug     libpython%{LDVERSION_debug}.so.%{py_SOVERSION}
d5a5bf
1824b3
# Disable automatic bytecompilation. The python3 binary is not yet be
1824b3
# available in /usr/bin when Python is built. Also, the bytecompilation fails
1824b3
# on files that test invalid syntax.
1824b3
%undefine py_auto_byte_compile
7eb10c
9f5808
# Don't let RPM set SOURCE_DATE_EPOCH based on the latest %%changelog date
9f5808
# It breaks tests with: can't find '__main__' module in .../test_zip.zip
9f5808
# Reported at https://bugs.python.org/issue34022
9f5808
# Tracked at https://bugzilla.redhat.com/show_bug.cgi?id=1724753
9f5808
%global source_date_epoch_from_changelog 0
9f5808
64593a
# For multilib support, files that are different between 32- and 64-bit arches
64593a
# need different filenames. Use "64" or "32" according to the word size.
4ced9a
# Currently, the best way to determine an architecture's word size happens to
4ced9a
# be checking %%{_lib}.
4ced9a
%if "%{_lib}" == "lib64"
64593a
%global wordsize 64
64593a
%else
64593a
%global wordsize 32
64593a
%endif
64593a
64593a
c769a6
# =======================
c769a6
# Build-time requirements
c769a6
# =======================
c769a6
c769a6
# (keep this list alphabetized)
c769a6
c769a6
BuildRequires: autoconf
81ac8c
BuildRequires: bluez-libs-devel
c769a6
BuildRequires: bzip2
c769a6
BuildRequires: bzip2-devel
66c621
BuildRequires: desktop-file-utils
33e110
BuildRequires: expat-devel
5974f1
c769a6
BuildRequires: findutils
c769a6
BuildRequires: gcc-c++
043c57
%if %{with gdbm}
75005c
BuildRequires: gdbm-devel
5fe31d
%endif
7be8ee
BuildRequires: glibc-all-langpacks
c769a6
BuildRequires: glibc-devel
c769a6
BuildRequires: gmp-devel
66c621
BuildRequires: libappstream-glib
c769a6
BuildRequires: libffi-devel
6ff303
BuildRequires: libnsl2-devel
6ff303
BuildRequires: libtirpc-devel
c769a6
BuildRequires: libGL-devel
d668c1
BuildRequires: libuuid-devel
c769a6
BuildRequires: libX11-devel
c769a6
BuildRequires: ncurses-devel
66c621
c769a6
BuildRequires: openssl-devel
c769a6
BuildRequires: pkgconfig
c769a6
BuildRequires: readline-devel
8927d3
BuildRequires: redhat-rpm-config >= 127
c769a6
BuildRequires: sqlite-devel
47069f
BuildRequires: gdb
c769a6
c769a6
BuildRequires: tar
c769a6
BuildRequires: tcl-devel
c769a6
BuildRequires: tix-devel
c769a6
BuildRequires: tk-devel
c769a6
043c57
%if %{with valgrind}
c769a6
BuildRequires: valgrind-devel
c769a6
%endif
c769a6
f2b86e
BuildRequires: xz-devel
c769a6
BuildRequires: zlib-devel
c769a6
51501f
BuildRequires: /usr/bin/dtrace
51501f
5f24f3
# workaround http://bugs.python.org/issue19804 (test_uuid requires ifconfig)
5f24f3
BuildRequires: /usr/sbin/ifconfig
5f24f3
0b241a
%if %{with rpmwheels}
0b241a
BuildRequires: python-setuptools-wheel
0b241a
BuildRequires: python-pip-wheel
Matej Stuchlik 11fb59
%endif
Matej Stuchlik 11fb59
c769a6
c769a6
# =======================
c769a6
# Source code and patches
c769a6
# =======================
c769a6
45a436
Source: https://www.python.org/ftp/python/%{general_version}/Python-%{upstream_version}.tar.xz
4aab45
3dbbc1
# A simple script to check timestamps of bytecode files
3dbbc1
# Run in check section with Python that is currently being built
37056b
# Originally written by bkabrda
37056b
Source8: check-pyc-timestamps.py
71040c
860f39
# Desktop menu entry for idle3
860f39
Source10: idle3.desktop
860f39
860f39
# AppData file for idle3
860f39
Source11: idle3.appdata.xml
860f39
d27ccf
# 00001 #
a3483f
# Fixup distutils/unixccompiler.py to remove standard library path from rpath:
a3483f
# Was Patch0 in ivazquez' python3000 specfile:
d27ccf
Patch1:         00001-rpath.patch
a3483f
2c6abc
# 00102 #
2c6abc
# Change the various install paths to use /usr/lib64/ instead or /usr/lib
15a050
# Only used when "%%{_lib}" == "lib64"
2c6abc
# Not yet sent upstream.
2c6abc
Patch102: 00102-lib64.patch
c923b5
6b3496
# 00111 #
c923b5
# Patch the Makefile.pre.in so that the generated Makefile doesn't try to build
c4a573
# a libpythonMAJOR.MINOR.a
c4a573
# See https://bugzilla.redhat.com/show_bug.cgi?id=556092
bbb508
# Downstream only: not appropriate for upstream
c923b5
Patch111: 00111-no-static-lib.patch
c923b5
6b3496
# 00155 #
8a2810
# Avoid allocating thunks in ctypes unless absolutely necessary, to avoid
8a2810
# generating SELinux denials on "import ctypes" and "import uuid" when
c4a573
# embedding Python within httpd
c4a573
# See https://bugzilla.redhat.com/show_bug.cgi?id=814391
8a2810
Patch155: 00155-avoid-ctypes-thunks.patch
8a2810
3b4dd2
Robert Kuska a0e3ab
# 00170 #
Robert Kuska a0e3ab
# In debug builds, try to print repr() when a C-level assert fails in the
Robert Kuska a0e3ab
# garbage collector (typically indicating a reference-counting error
Robert Kuska a0e3ab
# somewhere else e.g in an extension module)
720c2a
# The new macros/functions within gcmodule.c are hidden to avoid exposing
Robert Kuska a0e3ab
# them within the extension API.
720c2a
# Sent upstream: http://bugs.python.org/issue9263
720c2a
# See https://bugzilla.redhat.com/show_bug.cgi?id=614680
Robert Kuska 86a9a2
Patch170: 00170-gc-assertions.patch
260cee
502323
# 00178 #
502323
# Don't duplicate various FLAGS in sysconfig values
502323
# http://bugs.python.org/issue17679
502323
# Does not affect python2 AFAICS (different sysconfig values initialization)
502323
Patch178: 00178-dont-duplicate-flags-in-sysconfig.patch
e72147
Matej Stuchlik 11fb59
# 00189 #
0b241a
# Instead of bundled wheels, use our RPM packaged wheels from
0b241a
# /usr/share/python-wheels
0b241a
Patch189: 00189-use-rpm-wheels.patch
486eb4
3702d0
# 00205 #
Robert Kuska a52dea
# LIBPL variable in makefile takes LIBPL from configure.ac
Robert Kuska a52dea
# but the LIBPL variable defined there doesn't respect libdir macro
Robert Kuska a52dea
Patch205: 00205-make-libpl-respect-lib64.patch
Robert Kuska a52dea
332b94
# 00251
332b94
# Set values of prefix and exec_prefix in distutils install command
332b94
# to /usr/local if executable is /usr/bin/python* and RPM build
332b94
# is not detected to make pip and distutils install into separate location
46034c
# Fedora Change: https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe
332b94
Patch251: 00251-change-user-install-location.patch
332b94
9423d3
# 00274 #
9423d3
# Upstream uses Debian-style architecture naming. Change to match Fedora.
9423d3
Patch274: 00274-fix-arch-names.patch
9423d3
15d5b5
# 00316 #
15d5b5
# We remove the exe files from distutil's bdist_wininst
15d5b5
# So we mark the command as unsupported - and the tests are skipped
15d5b5
Patch316: 00316-mark-bdist_wininst-unsupported.patch
15d5b5
99ac2f
# (New patches go here ^^^)
99ac2f
#
77a5f9
# When adding new patches to "python" and "python3" in Fedora, EL, etc.,
77a5f9
# please try to keep the patch numbers in-sync between all specfiles.
99ac2f
#
77a5f9
# More information, and a patch number catalog, is at:
99ac2f
#
77a5f9
#     https://fedoraproject.org/wiki/SIGs/Python/PythonPatches
77a5f9
c96960
094ccc
# ==========================================
094ccc
# Descriptions, and metadata for subpackages
094ccc
# ==========================================
a3483f
75005c
# People might want to dnf install pythonX.Y instead of pythonXY;
75005c
# we enable this in both flat and nonflat package.
75005c
Provides: python%{pybasever} = %{version}-%{release}
75005c
8c67ba
%if %{without flatpackage}
8c67ba
094ccc
# Packages with Python modules in standard locations automatically
094ccc
# depend on python(abi). Provide that here.
a3483f
Provides: python(abi) = %{pybasever}
a3483f
26c1be
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
26c1be
f50a7d
# In order to support multiple Python interpreters for development purposes,
8c67ba
# packages with the naming scheme flatpackage (e.g. python35) exist for
f50a7d
# non-default versions of Python 3.
f50a7d
# For consistency, and to keep the upgrade path clean, we Provide/Obsolete
f50a7d
# these names here.
176898
Provides: python%{pyshortver} = %{version}-%{release}
f50a7d
# Note that using Obsoletes without package version is not standard practice.
f50a7d
# Here we assert that *any* version of the system's default interpreter is
f50a7d
# preferable to an "extra" interpreter. For example, python3-3.6.1 will
f50a7d
# replace python36-3.6.2.
f50a7d
Obsoletes: python%{pyshortver}
176898
e522c8
# Shall be removed in Fedora 31
1f528d
# The release is bumped to 20, so we can do f27 platform-python updates
1f528d
# If the release in f27 ever goes >= 20, raise it here
1f528d
# If platform-python is ever reintroduced, make it higher version than this:
1f528d
%global platpyver 3.6.2-20
e522c8
Obsoletes: platform-python < %{platpyver}
e522c8
b9e8a4
# Previously, this was required for our rewheel patch to work.
b9e8a4
# This is technically no longer needed, but we keep it recommended
b9e8a4
# for the developer experience.
b9e8a4
Recommends: python3-setuptools
b9e8a4
Recommends: python3-pip
b9e8a4
3f778c
# This prevents ALL subpackages built from this spec to require
3f778c
# /usr/bin/python3*. Granularity per subpackage is impossible.
3f778c
# It's intended for the libs package not to drag in the interpreter, see
3f778c
# https://bugzilla.redhat.com/show_bug.cgi?id=1547131
3f778c
# All others require %%{name} anyway.
3f778c
%global __requires_exclude ^/usr/bin/python3
3f778c
3f778c
15a5ab
# The description used both for the SRPM and the main `python3` subpackage:
a3483f
%description
c2f871
Python is an accessible, high-level, dynamically typed, interpreted programming
3bbc2a
language, designed with an emphasis on code readability.
c2f871
It includes an extensive standard library, and has a vast ecosystem of
c2f871
third-party libraries.
624586
af1dc2
The %{name} package provides the "python3" executable: the reference
15a5ab
interpreter for the Python language, version 3.
c2f871
The majority of its standard library is provided in the %{name}-libs package,
c2f871
which should be installed automatically along with %{name}.
c2f871
The remaining parts of the Python standard library are broken out into the
c2f871
%{name}-tkinter and %{name}-test packages, which may need to be installed
c2f871
separately.
624586
c2f871
Documentation for Python is provided in the %{name}-docs package.
c2f871
c2f871
Packages containing additional libraries for Python are generally named with
c2f871
the "%{name}-" prefix.
624586
a3483f
a3483f
%package libs
624586
Summary:        Python runtime libraries
a3483f
0b241a
%if %{with rpmwheels}
0b241a
Requires: python-setuptools-wheel
0b241a
Requires: python-pip-wheel
0b241a
%else
20bc33
Provides: bundled(python3-pip) = 19.2.3
20bc33
Provides: bundled(python3-setuptools) = 41.2.0