Blame SPECS/python3.11-wheel.spec

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