Blame SPECS/python3.11-wheel.spec

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