Blame SPECS/python36.spec

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