Blame SPECS/python3.11-wheel.spec

bc0fae
%global __python3 /usr/bin/python3.11
bc0fae
%global python3_pkgversion 3.11
bc0fae
bc0fae
# The function of bootstrap is that it disables the wheel subpackage
7a1482
%bcond_with bootstrap
bc0fae
bc0fae
# Default: when bootstrapping -> disable tests
bc0fae
%if %{with bootstrap}
bc0fae
%bcond_with tests
bc0fae
%else
bc0fae
%bcond_without tests
bc0fae
%endif
bc0fae
bc0fae
# Similar to what we have in pythonX.Y.spec files.
bc0fae
# If enabled, provides unversioned executables and other stuff.
bc0fae
# Disable it if you build this package in an alternative stack.
bc0fae
%bcond_with main_python
bc0fae
bc0fae
%global pypi_name wheel
bc0fae
%global python_wheel_name %{pypi_name}-%{version}-py3-none-any.whl
bc0fae
bc0fae
Name:           python%{python3_pkgversion}-%{pypi_name}
bc0fae
Version:        0.38.4
7a1482
Release:        3%{?dist}
bc0fae
Summary:        Built-package format for Python
bc0fae
bc0fae
# packaging is ASL 2.0 or BSD
bc0fae
License:        MIT and (ASL 2.0 or BSD)
bc0fae
URL:            https://github.com/pypa/wheel
bc0fae
Source0:        %{url}/archive/%{version}/%{pypi_name}-%{version}.tar.gz
bc0fae
BuildArch:      noarch
bc0fae
bc0fae
BuildRequires:  python%{python3_pkgversion}-devel
7a1482
BuildRequires:  python%{python3_pkgversion}-rpm-macros
bc0fae
BuildRequires:  python%{python3_pkgversion}-setuptools
bc0fae
bc0fae
# python3 bootstrap: this is rebuilt before the final build of python3, which
bc0fae
# adds the dependency on python3-rpm-generators, so we require it manually
bc0fae
BuildRequires:  python3-rpm-generators
bc0fae
bc0fae
%if %{with tests}
bc0fae
BuildRequires:  python%{python3_pkgversion}-pytest
bc0fae
# several tests compile extensions
bc0fae
# those tests are skipped if gcc is not found
bc0fae
BuildRequires:  gcc
bc0fae
%endif
bc0fae
bc0fae
# Virtual provides for the packages bundled by wheel.
bc0fae
# Actual version can be found in git history:
bc0fae
# https://github.com/pypa/wheel/commits/master/src/wheel/vendored/packaging/tags.py
bc0fae
%global bundled %{expand:
bc0fae
Provides:       bundled(python%{python3_version}dist(packaging)) = 21.3
bc0fae
}
bc0fae
bc0fae
%{bundled}
bc0fae
bc0fae
bc0fae
# Require alternatives version that implements the --keep-foreign flag
bc0fae
Requires(postun): alternatives >= 1.19.1-1
bc0fae
bc0fae
# python3.11 installs the alternatives master symlink to which we attach a slave
bc0fae
Requires:       python%{python3_pkgversion}
bc0fae
Requires(post): python%{python3_pkgversion}
bc0fae
Requires(postun): python%{python3_pkgversion}
bc0fae
bc0fae
%global _description %{expand:
bc0fae
Wheel is the reference implementation of the Python wheel packaging standard,
bc0fae
as defined in PEP 427.
bc0fae
bc0fae
It has two different roles:
bc0fae
bc0fae
 1. A setuptools extension for building wheels that provides the bdist_wheel
bc0fae
    setuptools command.
bc0fae
 2. A command line tool for working with wheel files.}
bc0fae
bc0fae
%description %{_description}
bc0fae
bc0fae
%if %{without bootstrap}
bc0fae
%package -n     %{python_wheel_pkg_prefix}-%{pypi_name}-wheel
bc0fae
Summary:        The Python wheel module packaged as a wheel
bc0fae
%{bundled}
bc0fae
bc0fae
%description -n %{python_wheel_pkg_prefix}-%{pypi_name}-wheel
bc0fae
A Python wheel of wheel to use with virtualenv.
bc0fae
%endif
bc0fae
bc0fae
bc0fae
%prep
bc0fae
%autosetup -n %{pypi_name}-%{version} -p1
bc0fae
bc0fae
bc0fae
%build
bc0fae
%py3_build
bc0fae
bc0fae
bc0fae
%install
bc0fae
%py3_install
bc0fae
mv %{buildroot}%{_bindir}/%{pypi_name}{,-%{python3_version}}
bc0fae
%if %{with main_python}
bc0fae
ln -s %{pypi_name}-%{python3_version} %{buildroot}%{_bindir}/%{pypi_name}-3
bc0fae
ln -s %{pypi_name}-3 %{buildroot}%{_bindir}/%{pypi_name}
bc0fae
%endif
bc0fae
# Create an empty file to be used by `alternatives`
bc0fae
touch %{buildroot}%{_bindir}/%{pypi_name}-3
bc0fae
bc0fae
%if %{without bootstrap}
bc0fae
# We can only use bdist_wheel when wheel is installed, hence we don't build the wheel in %%build
bc0fae
export PYTHONPATH=%{buildroot}%{python3_sitelib}
bc0fae
%py3_build_wheel
bc0fae
mkdir -p %{buildroot}%{python_wheel_dir}
bc0fae
install -p dist/%{python_wheel_name} -t %{buildroot}%{python_wheel_dir}
bc0fae
%endif
bc0fae
bc0fae
bc0fae
%if %{with tests}
bc0fae
%check
bc0fae
rm setup.cfg  # to drop pytest coverage options configured there
bc0fae
%pytest -v --ignore build
bc0fae
%endif
bc0fae
bc0fae
%post -n python%{python3_pkgversion}-%{pypi_name}
bc0fae
alternatives --keep-foreign --add-slave python3 %{_bindir}/python%{python3_version} \
bc0fae
    %{_bindir}/%{pypi_name}-3 \
bc0fae
    %{pypi_name}-3 \
bc0fae
    %{_bindir}/%{pypi_name}-%{python3_version}
bc0fae
bc0fae
%postun -n python%{python3_pkgversion}-%{pypi_name}
bc0fae
# Do this only during uninstall process (not during update)
bc0fae
if [ $1 -eq 0 ]; then
bc0fae
   alternatives --remove-slave python3 %{_bindir}/python%{python3_version} \
bc0fae
       %{pypi_name}-3
bc0fae
fi
bc0fae
bc0fae
bc0fae
%files -n python%{python3_pkgversion}-%{pypi_name}
bc0fae
%license LICENSE.txt
bc0fae
%doc README.rst
bc0fae
%{_bindir}/%{pypi_name}-%{python3_version}
bc0fae
%if %{with main_python}
bc0fae
%{_bindir}/%{pypi_name}
bc0fae
%{_bindir}/%{pypi_name}-3
bc0fae
%endif
bc0fae
%ghost %{_bindir}/%{pypi_name}-3
bc0fae
%{python3_sitelib}/%{pypi_name}*/
bc0fae
bc0fae
%if %{without bootstrap}
bc0fae
%files -n %{python_wheel_pkg_prefix}-%{pypi_name}-wheel
bc0fae
%license LICENSE.txt
bc0fae
# we own the dir for simplicity
bc0fae
%dir %{python_wheel_dir}/
bc0fae
%{python_wheel_dir}/%{python_wheel_name}
bc0fae
%endif
bc0fae
bc0fae
%changelog
7a1482
* Wed Feb 01 2023 Charalampos Stratakis <cstratak@redhat.com> - 0.38.4-3
7a1482
- Explicitly require the python3.11-rpm-macros
7a1482
7a1482
* Wed Feb 01 2023 Charalampos Stratakis <cstratak@redhat.com> - 0.38.4-2
7a1482
- Disable bootstrap
7a1482
bc0fae
* Tue Dec 13 2022 Charalampos Stratakis <cstratak@redhat.com> - 0.38.4-1
bc0fae
- Initial package
bc0fae
- Fedora contributions by:
7a1482
      Charalampos Stratakis <cstratak@redhat.com>
7a1482
      Dennis Gilmore <dennis@ausil.us>
7a1482
      Haikel Guemar <hguemar@fedoraproject.org>
7a1482
      Igor Gnatenko <ignatenkobrain@fedoraproject.org>
7a1482
      Karolina Surma <ksurma@redhat.com>
7a1482
      Lumir Balhar <lbalhar@redhat.com>
7a1482
      Matej Stuchlik <mstuchli@redhat.com>
7a1482
      Miro HronĨok <miro@hroncok.cz>
7a1482
      Robert Kuska <rkuska@redhat.com>
7a1482
      Slavek Kabrda <bkabrda@redhat.com>
7a1482
      Tomas Hrnciar <thrnciar@redhat.com>
7a1482
      Tomas Orsava <torsava@redhat.com>