Blame SPECS/python3.11-wheel.spec

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