Blame SPECS/python36.spec

8c7fcc
# ==================
8c7fcc
# Top-level metadata
8c7fcc
# ==================
8c7fcc
8c7fcc
%global pybasever 3.6
8c7fcc
8c7fcc
Name:       python36
8c7fcc
Version:    %{pybasever}.8
8c7fcc
Release:    37%{?dist}
8c7fcc
Summary:    Interpreter of the Python programming language
8c7fcc
8c7fcc
License:    Python
8c7fcc
URL:        https://www.python.org/
8c7fcc
8c7fcc
# LICENSE file is fetched from the Python 3 github repository
8c7fcc
# for the respective version.
8c7fcc
Source0:    https://github.com/python/cpython/raw/v%{version}/LICENSE
8c7fcc
Source1:    README
8c7fcc
Source2:    macros.python36
8c7fcc
8c7fcc
%global debug_package %{nil}
8c7fcc
8c7fcc
# ==================================
8c7fcc
# Conditionals controlling the build
8c7fcc
# ==================================
8c7fcc
8c7fcc
# Extra build for debugging the interpreter or C-API extensions
8c7fcc
# (the -debug subpackages)
8c7fcc
%bcond_without debug_build
8c7fcc
8c7fcc
8c7fcc
# ==============================================
8c7fcc
# Metadata and macros from the python3 component
8c7fcc
# ==============================================
8c7fcc
8c7fcc
# ABIFLAGS, LDVERSION and SOABI are in the upstream configure.ac
8c7fcc
# See PEP 3149 for some background: http://www.python.org/dev/peps/pep-3149/
8c7fcc
%global ABIFLAGS_optimized m
8c7fcc
%global ABIFLAGS_debug     dm
8c7fcc
8c7fcc
%global LDVERSION_optimized %{pybasever}%{ABIFLAGS_optimized}
8c7fcc
%global LDVERSION_debug     %{pybasever}%{ABIFLAGS_debug}
8c7fcc
8c7fcc
8c7fcc
# =======================
8c7fcc
# Package and subpackages
8c7fcc
# =======================
8c7fcc
8c7fcc
# python36 package itself
8c7fcc
Provides: python3 = %{version}-%{release}
8c7fcc
Provides: python3%{?_isa} = %{version}-%{release}
8c7fcc
Obsoletes: python3 < 3.6.6-13
8c7fcc
8c7fcc
# When the user tries to `yum install python`, yum will list this package among
8c7fcc
# the possible alternatives
8c7fcc
Provides: alternative-for(python)
8c7fcc
8c7fcc
Requires:   %{_libexecdir}/platform-python
8c7fcc
# python36 carries alternatives slave links for these packages, so they have to be installed
8c7fcc
Requires:   python3-pip
8c7fcc
Requires:   python3-setuptools
8c7fcc
8c7fcc
# Runtime require alternatives
8c7fcc
Requires:         %{_sbindir}/alternatives
8c7fcc
Requires(post):   %{_sbindir}/alternatives
8c7fcc
Requires(postun): %{_sbindir}/alternatives
8c7fcc
8c7fcc
%global _description \
8c7fcc
Python is an accessible, high-level, dynamically typed, interpreted programming\
8c7fcc
language, designed with an emphasis on code readibility.\
8c7fcc
It includes an extensive standard library, and has a vast ecosystem of\
8c7fcc
third-party libraries.\
8c7fcc
\
8c7fcc
The python36 package provides the "python3.6" executable: the reference\
8c7fcc
interpreter for the Python language, version 3.\
8c7fcc
The package also installs the "python3" executable which is user configurable\
8c7fcc
using the "alternatives --config python3" command.\
8c7fcc
For the unversioned "python" command, see manual page "unversioned-python".\
8c7fcc
\
8c7fcc
The python36-devel package contains files for dovelopment of Python application\
8c7fcc
and the python36-debug is helpful for debugging.\
8c7fcc
\
8c7fcc
Packages containing additional libraries for Python 3.6 are generally named\
8c7fcc
with the "python3-" prefix.
8c7fcc
8c7fcc
%description %_description
8c7fcc
8c7fcc
8c7fcc
%package devel
8c7fcc
Summary:    Libraries and header files needed for Python development
8c7fcc
Provides:   python3-devel = %{version}-%{release}
8c7fcc
Provides:   python3-devel%{?_isa} = %{version}-%{release}
8c7fcc
Requires:   python36
8c7fcc
Requires:   platform-python-devel
8c7fcc
# python36 installs the alternatives master symlink to which we attach a slave
8c7fcc
Requires(post): python36
8c7fcc
Requires(postun): python36
8c7fcc
8c7fcc
%description devel
8c7fcc
This package contains the header files and configuration needed to compile
8c7fcc
Python extension modules (typically written in C or C++), to embed Python
8c7fcc
into other programs, and to make binary distributions for Python libraries.
8c7fcc
8c7fcc
If you want to build an RPM against the python36 module, you also need to
8c7fcc
install the python36-rpm-macros package.
8c7fcc
8c7fcc
8c7fcc
%if %{with debug_build}
8c7fcc
%package debug
8c7fcc
Summary:    Debug version of the Python runtime
8c7fcc
Provides:   python3-debug = %{version}-%{release}
8c7fcc
Provides:   python3-debug%{?_isa} = %{version}-%{release}
8c7fcc
Obsoletes:  python3-debug < 3.6.6-13
8c7fcc
Requires:   python36
8c7fcc
Requires:   python36-devel
8c7fcc
Requires:   platform-python-debug
8c7fcc
# python36 installs the alternatives master symlink to which we attach a slave
8c7fcc
Requires(post): python36
8c7fcc
Requires(postun): python36
8c7fcc
8c7fcc
%description debug
8c7fcc
python36-debug provides a version of the Python runtime with numerous debugging
8c7fcc
features enabled, aimed at advanced Python users such as developers of Python
8c7fcc
extension modules.
8c7fcc
8c7fcc
This version uses more memory and will be slower than the regular Python build,
8c7fcc
but is useful for tracking down reference-counting issues and other bugs.
8c7fcc
8c7fcc
The bytecode format is unchanged, so that .pyc files are compatible between
8c7fcc
this and the standard version of Python, but the debugging features mean that
8c7fcc
C/C++ extension modules are ABI-incompatible and must be built for each version
8c7fcc
separately.
8c7fcc
8c7fcc
The debug build shares installation directories with the standard Python
8c7fcc
runtime, so that .py and .pyc files can be shared.
8c7fcc
Compiled extension modules use a special ABI flag ("d") in the filename,
8c7fcc
so extensions for both verisons can co-exist in the same directory.
8c7fcc
%endif # with debug_build
8c7fcc
8c7fcc
8c7fcc
%package -n python36-rpm-macros
8c7fcc
Summary:    RPM macros for building RPMs with Python 3.6
8c7fcc
Provides:   python36-modular-devel = %{version}-%{release}
8c7fcc
Provides:   python-modular-rpm-macros == 3.6
8c7fcc
Conflicts:  python-modular-rpm-macros > 3.6
8c7fcc
Requires:   python3-rpm-macros
8c7fcc
BuildArch:  noarch
8c7fcc
8c7fcc
%description -n python36-rpm-macros
8c7fcc
RPM macros for building RPMs with Python 3.6 from the python36 module.
8c7fcc
If you want to build an RPM against the python36 module, you need to
8c7fcc
BuildRequire: python36-rpm-macros.
8c7fcc
8c7fcc
8c7fcc
%prep
8c7fcc
cp %{SOURCE0} LICENSE
8c7fcc
cp %{SOURCE1} README
8c7fcc
8c7fcc
8c7fcc
%build
8c7fcc
8c7fcc
8c7fcc
%install
8c7fcc
mkdir -p %{buildroot}%{_bindir}
8c7fcc
mkdir -p %{buildroot}%{_mandir}/man1/
8c7fcc
8c7fcc
# Symlink the executable to libexec
8c7fcc
ln -s %{_libexecdir}/platform-python%{pybasever} %{buildroot}%{_bindir}/python%{pybasever}
8c7fcc
8c7fcc
# Symlink the config executables
8c7fcc
ln -s python%{LDVERSION_optimized}-config %{buildroot}%{_bindir}/python%{pybasever}-config
8c7fcc
8c7fcc
# LDVERSION specific section
8c7fcc
InstallPython() {
8c7fcc
  LDVersion=$1
8c7fcc
8c7fcc
  # Symlink python*-config to libexec
8c7fcc
  ln -s %{_libexecdir}/platform-python${LDVersion}-config %{buildroot}%{_bindir}/python${LDVersion}-config
8c7fcc
  ln -s %{_libexecdir}/platform-python${LDVersion}-`uname -m`-config %{buildroot}%{_bindir}/python${LDVersion}-`uname -m`-config
8c7fcc
8c7fcc
  # Symlink optimized and debug executables
8c7fcc
  ln -s %{_libexecdir}/platform-python${LDVersion} %{buildroot}%{_bindir}/python${LDVersion}
8c7fcc
}
8c7fcc
8c7fcc
%if %{with debug_build}
8c7fcc
InstallPython %{LDVERSION_debug}
8c7fcc
# General debug symlinks
8c7fcc
ln -s python%{LDVERSION_debug}-config %{buildroot}%{_bindir}/python%{pybasever}-debug-config
8c7fcc
ln -s python%{LDVERSION_debug} %{buildroot}%{_bindir}/python%{pybasever}-debug
8c7fcc
%endif # with debug_build
8c7fcc
8c7fcc
InstallPython %{LDVERSION_optimized}
8c7fcc
8c7fcc
# Python RPM macros
8c7fcc
mkdir -p %{buildroot}/%{rpmmacrodir}/
8c7fcc
install -m 644 %{SOURCE2} \
8c7fcc
    %{buildroot}/%{rpmmacrodir}/
8c7fcc
8c7fcc
# All ghost files controlled by alternatives need to exist for the files
8c7fcc
# section check to succeed
8c7fcc
# - Don't list /usr/bin/python as a ghost file so `yum install /usr/bin/python`
8c7fcc
#   doesn't install this package
8c7fcc
touch %{buildroot}%{_bindir}/unversioned-python
8c7fcc
touch %{buildroot}%{_mandir}/man1/python.1.gz
8c7fcc
touch %{buildroot}%{_bindir}/python3
8c7fcc
touch %{buildroot}%{_mandir}/man1/python3.1.gz
8c7fcc
touch %{buildroot}%{_bindir}/pip3
8c7fcc
touch %{buildroot}%{_bindir}/pip-3
8c7fcc
touch %{buildroot}%{_bindir}/easy_install-3
8c7fcc
touch %{buildroot}%{_bindir}/pydoc3
8c7fcc
touch %{buildroot}%{_bindir}/pydoc-3
8c7fcc
touch %{buildroot}%{_bindir}/pyvenv-3
8c7fcc
touch %{buildroot}%{_bindir}/python3-config
8c7fcc
touch %{buildroot}%{_bindir}/python3-debug
8c7fcc
touch %{buildroot}%{_bindir}/python3-debug-config
8c7fcc
8c7fcc
8c7fcc
%post
8c7fcc
# Alternative for /usr/bin/python -> /usr/bin/python3 + man page
8c7fcc
alternatives --install %{_bindir}/unversioned-python \
8c7fcc
                       python \
8c7fcc
                       %{_bindir}/python3 \
8c7fcc
                       300 \
8c7fcc
             --slave   %{_bindir}/python \
8c7fcc
                       unversioned-python \
8c7fcc
                       %{_bindir}/python3 \
8c7fcc
             --slave   %{_mandir}/man1/python.1.gz \
8c7fcc
                       unversioned-python-man \
8c7fcc
                       %{_mandir}/man1/python3.1.gz
8c7fcc
8c7fcc
# Alternative for /usr/bin/python3 -> /usr/bin/python3.6
8c7fcc
# Create only if it doesn't exist already
8c7fcc
EXISTS=`alternatives --display python3 | \
8c7fcc
        grep -c "^/usr/bin/python3.6 - priority [0-9]*"`
8c7fcc
8c7fcc
if [ $EXISTS -eq 0 ]; then
8c7fcc
    alternatives --install %{_bindir}/python3 \
8c7fcc
                           python3 \
8c7fcc
                           %{_bindir}/python3.6 \
8c7fcc
                           1000000 \
8c7fcc
                 --slave   %{_mandir}/man1/python3.1.gz \
8c7fcc
                           python3-man \
8c7fcc
                           %{_mandir}/man1/python3.6.1.gz \
8c7fcc
                 --slave   %{_bindir}/pip3 \
8c7fcc
                           pip3 \
8c7fcc
                           %{_bindir}/pip3.6 \
8c7fcc
                 --slave   %{_bindir}/pip-3 \
8c7fcc
                           pip-3 \
8c7fcc
                           %{_bindir}/pip-3.6 \
8c7fcc
                 --slave   %{_bindir}/easy_install-3 \
8c7fcc
                           easy_install-3 \
8c7fcc
                           %{_bindir}/easy_install-3.6 \
8c7fcc
                 --slave   %{_bindir}/pydoc3 \
8c7fcc
                           pydoc3 \
8c7fcc
                           %{_bindir}/pydoc3.6 \
8c7fcc
                 --slave   %{_bindir}/pydoc-3 \
8c7fcc
                           pydoc-3 \
8c7fcc
                           %{_bindir}/pydoc3.6 \
8c7fcc
                 --slave   %{_bindir}/pyvenv-3 \
8c7fcc
                           pyvenv-3 \
8c7fcc
                           %{_bindir}/pyvenv-3.6
8c7fcc
fi
8c7fcc
8c7fcc
%postun
8c7fcc
# Do this only during uninstall process (not during update)
8c7fcc
if [ $1 -eq 0 ]; then
8c7fcc
    alternatives --remove python3 \
8c7fcc
                        %{_bindir}/python3.6
8c7fcc
8c7fcc
    # Remove link python → python3 if no other python3.* exists
8c7fcc
    if ! alternatives --display python3 > /dev/null; then
8c7fcc
        alternatives --remove python \
8c7fcc
                            %{_bindir}/python3
8c7fcc
    fi
8c7fcc
fi
8c7fcc
8c7fcc
8c7fcc
%post -n python36-devel
8c7fcc
alternatives --add-slave python3 %{_bindir}/python3.6 \
8c7fcc
    %{_bindir}/python3-config \
8c7fcc
    python3-config \
8c7fcc
    %{_bindir}/python3.6-config
8c7fcc
8c7fcc
%postun -n python36-devel
8c7fcc
# Do this only during uninstall process (not during update)
8c7fcc
if [ $1 -eq 0 ]; then
8c7fcc
    alternatives --remove-slave python3 %{_bindir}/python3.6 \
8c7fcc
        python3-config
8c7fcc
fi
8c7fcc
8c7fcc
8c7fcc
%post -n python36-debug
8c7fcc
alternatives --add-slave python3 %{_bindir}/python3.6 \
8c7fcc
    %{_bindir}/python3-debug \
8c7fcc
    python3-debug \
8c7fcc
    %{_bindir}/python3.6-debug
8c7fcc
alternatives --add-slave python3 %{_bindir}/python3.6 \
8c7fcc
    %{_bindir}/python3-debug-config \
8c7fcc
    python3-debug-config \
8c7fcc
    %{_bindir}/python3.6-debug-config
8c7fcc
8c7fcc
%postun -n python36-debug
8c7fcc
# Do this only during uninstall process (not during update)
8c7fcc
if [ $1 -eq 0 ]; then
8c7fcc
    alternatives --remove-slave python3 %{_bindir}/python3.6 \
8c7fcc
        python3-debug
8c7fcc
    alternatives --remove-slave python3 %{_bindir}/python3.6 \
8c7fcc
        python3-debug-config
8c7fcc
fi
8c7fcc
8c7fcc
8c7fcc
%files
8c7fcc
%license LICENSE
8c7fcc
%doc README
8c7fcc
%{_bindir}/python%{pybasever}
8c7fcc
%{_bindir}/python%{LDVERSION_optimized}
8c7fcc
%ghost %{_bindir}/unversioned-python
8c7fcc
%ghost %{_mandir}/man1/python.1.gz
8c7fcc
%ghost %{_bindir}/python3
8c7fcc
%ghost %{_mandir}/man1/python3.1.gz
8c7fcc
%ghost %{_bindir}/pip3
8c7fcc
%ghost %{_bindir}/pip-3
8c7fcc
%ghost %{_bindir}/easy_install-3
8c7fcc
%ghost %{_bindir}/pydoc3
8c7fcc
%ghost %{_bindir}/pydoc-3
8c7fcc
%ghost %{_bindir}/pyvenv-3
8c7fcc
8c7fcc
%files devel
8c7fcc
%license LICENSE
8c7fcc
%doc README
8c7fcc
%{_bindir}/python%{pybasever}-config
8c7fcc
%{_bindir}/python%{LDVERSION_optimized}-config
8c7fcc
%{_bindir}/python%{LDVERSION_optimized}-*-config
8c7fcc
%ghost %{_bindir}/python3-config
8c7fcc
8c7fcc
%files debug
8c7fcc
%license LICENSE
8c7fcc
%doc README
8c7fcc
%{_bindir}/python%{LDVERSION_debug}
8c7fcc
%{_bindir}/python%{LDVERSION_debug}-config
8c7fcc
%{_bindir}/python%{LDVERSION_debug}-*-config
8c7fcc
%{_bindir}/python%{pybasever}-debug-config
8c7fcc
%{_bindir}/python%{pybasever}-debug
8c7fcc
%ghost %{_bindir}/python3-debug
8c7fcc
%ghost %{_bindir}/python3-debug-config
8c7fcc
8c7fcc
%files -n python36-rpm-macros
8c7fcc
%license LICENSE
8c7fcc
%doc README
8c7fcc
%{rpmmacrodir}/macros.python36
8c7fcc
8c7fcc
8c7fcc
%changelog
8c7fcc
* Fri May 07 2021 Charalampos Stratakis <cstratak@redhat.com> - 3.6.8-37
8c7fcc
- Bump the release to a number higher than RHEL7
8c7fcc
- Resolves: rhbz#1954567
8c7fcc
8c7fcc
* Thu Apr 25 2019 Tomas Orsava <torsava@redhat.com> - 3.6.8-2
8c7fcc
- Bumping due to problems with modular RPM upgrade path
8c7fcc
- Resolves: rhbz#1695587
8c7fcc
8c7fcc
* Mon Jan 21 2019 Charalampos Stratakis <cstratak@redhat.com> - 3.6.8-1
8c7fcc
- Sync version-release with the python3 component
8c7fcc
- Resolves: rhbz#1658271
8c7fcc
8c7fcc
* Tue Dec 04 2018 Tomas Orsava <torsava@redhat.com> - 3.6.6-18
8c7fcc
- Remove the Python source tarball as it's not being used in this symlink
8c7fcc
  component
8c7fcc
- Create a new explanatory README
8c7fcc
- Resolves: rhbz#1654867
8c7fcc
8c7fcc
* Tue Oct 16 2018 Tomas Orsava <torsava@redhat.com> - 3.6.6-17
8c7fcc
- Slightly edit the description
8c7fcc
- Related: rhbz#1633534
8c7fcc
8c7fcc
* Sun Oct 14 2018 Tomas Orsava <torsava@redhat.com> - 3.6.6-16
8c7fcc
- Add Requires (/post/postun) on /usr/sbin/alternatives
8c7fcc
- Resolves: rhbz#1633534
8c7fcc
8c7fcc
* Fri Oct 12 2018 Tomas Orsava <torsava@redhat.com> - 3.6.6-15
8c7fcc
- Don't list /usr/bin/python as a ghost file so `yum install /usr/bin/python`
8c7fcc
  doesn't install this package
8c7fcc
- Resolves: rhbz#1633534
8c7fcc
8c7fcc
* Mon Oct 08 2018 Tomas Orsava <torsava@redhat.com> - 3.6.6-14
8c7fcc
- Set a special Provides tag that advertises the `python36` package as an
8c7fcc
  alternative to the non-existing `python` package
8c7fcc
- Resolves: rhbz#1633561
8c7fcc
8c7fcc
* Tue Oct 02 2018 Tomas Orsava <torsava@redhat.com> - 3.6.6-13.1
8c7fcc
- Fix update of alternatives in the devel and debug packages
8c7fcc
- Resolves: rhbz#1633534
8c7fcc
8c7fcc
* Sat Sep 29 2018 Tomas Orsava <torsava@redhat.com> - 3.6.6-13
8c7fcc
- Provide the name `python3`, `python3-devel` and `python3-debug` from their
8c7fcc
  respective packages to provide a sane default for Python 3
8c7fcc
- Provide the name `python36-modular-devel` from python36-rpm-macros so it's
8c7fcc
  easier to remember and describe in documentation
8c7fcc
- Sync version-release with the python3 component
8c7fcc
- Resolves: rhbz#1632637
8c7fcc
8c7fcc
* Sat Sep 29 2018 Tomas Orsava <torsava@redhat.com> - 3.6-7
8c7fcc
- Implement the alternatives system for Python in RHEL8
8c7fcc
- Resolves: rhbz#1633534
8c7fcc
8c7fcc
* Tue Sep 25 2018 Tomas Orsava <torsava@redhat.com> - 3.6-6
8c7fcc
- Require the Python interpreter directly instead of using the package name
8c7fcc
- Related: rhbz#1619153
8c7fcc
8c7fcc
* Tue Aug 14 2018 Lumír Balhar <lbalhar@redhat.com> - 3.6-5
8c7fcc
- Add general symlinks python3.6-debug[-config] for symlinks modules
8c7fcc
- Resolves: rhbz#1615727
8c7fcc
8c7fcc
* Sat Aug 04 2018 Tomas Orsava <torsava@redhat.com> - 3.6-4
8c7fcc
- Switched devel subpackage's dependency from python3-devel to
8c7fcc
  python3-libs-devel: python3-devel is now buildroot only and the contents were
8c7fcc
  moved to python3-libs-devel
8c7fcc
8c7fcc
* Tue Jul 31 2018 Tomas Orsava <torsava@redhat.com> - 3.6-3
8c7fcc
- Make the python36-rpm-macros package noarch
8c7fcc
8c7fcc
* Wed Apr 04 2018 Tomas Orsava <torsava@redhat.com> - 3.6-2
8c7fcc
- Include python36-rpm-macros for building RPMs against this module
8c7fcc
8c7fcc
* Wed Apr 04 2018 Tomas Orsava <torsava@redhat.com> - 3.6-1
8c7fcc
- This new package python36 will belong to the python36 module that will house
8c7fcc
  symlinks from /usr/bin/python* to /usr/libexec/platform-python* et al.
8c7fcc