65193d8
# The function of bootstrap is that it builds the package with flit_core.wheel
65193d8
# and installs it by unzipping it.
65193d8
# A real build uses %%pyproject_wheel and %%pyproject_install.
f03709b
%bcond bootstrap 0
db76a0a
# Default: when bootstrapping -> disable tests
f03709b
%bcond tests %{without bootstrap}
db76a0a
f8d62d5
# Similar to what we have in pythonX.Y.spec files.
f8d62d5
# If enabled, provides unversioned executables and other stuff.
f8d62d5
# Disable it if you build this package in an alternative stack.
f03709b
%bcond main_python 1
f8d62d5
62eec5b
%global pypi_name wheel
3ee403b
%global python_wheel_name %{pypi_name}-%{version}-py3-none-any.whl
62eec5b
62eec5b
Name:           python-%{pypi_name}
ca06398
Version:        0.43.0
4eeedb1
Release:        %autorelease
14a14e2
Epoch:          1
14a14e2
Summary:        Built-package format for Python
62eec5b
3285379
# packaging is Apache-2.0 OR BSD-2-Clause
3285379
License:        MIT AND (Apache-2.0 OR BSD-2-Clause)
4afa238
URL:            https://github.com/pypa/wheel
4afa238
Source0:        %{url}/archive/%{version}/%{pypi_name}-%{version}.tar.gz
1d30281
# This is used in bootstrap mode where we manually install the wheel and
1d30281
# entrypoints
1d30281
Source1:        wheel-entrypoint
62eec5b
BuildArch:      noarch
3f2c609
54b3904
BuildRequires:  python%{python3_pkgversion}-devel
e9bd4f7
# python3 bootstrap: this is rebuilt before the final build of python3, which
e9bd4f7
# adds the dependency on python3-rpm-generators, so we require it manually
e9bd4f7
BuildRequires:  python3-rpm-generators
e9bd4f7
1d30281
# Needed to manually build and unpack the wheel
1d30281
%if %{with bootstrap}
1d30281
BuildRequires:  python%{python3_pkgversion}-flit-core
1d30281
BuildRequires:  unzip
1d30281
%endif
1d30281
db76a0a
%if %{with tests}
54b3904
BuildRequires:  python%{python3_pkgversion}-pytest
1d30281
BuildRequires:  python%{python3_pkgversion}-setuptools
03fc6b4
# several tests compile extensions
03fc6b4
# those tests are skipped if gcc is not found
03fc6b4
BuildRequires:  gcc
03fc6b4
%endif
03fc6b4
e9bd4f7
%global _description %{expand:
e9bd4f7
Wheel is the reference implementation of the Python wheel packaging standard,
e9bd4f7
as defined in PEP 427.
e9bd4f7
e9bd4f7
It has two different roles:
5ac60a9
e9bd4f7
 1. A setuptools extension for building wheels that provides the bdist_wheel
e9bd4f7
    setuptools command.
e9bd4f7
 2. A command line tool for working with wheel files.}
62eec5b
Igor Gnatenko 0a308dc
%description %{_description}
Igor Gnatenko 0a308dc
07699ca
# Virtual provides for the packages bundled by wheel.
750949a
# Actual version can be found in git history:
750949a
# https://github.com/pypa/wheel/commits/master/src/wheel/vendored/packaging/tags.py
07699ca
%global bundled %{expand:
ca06398
Provides:       bundled(python3dist(packaging)) = 24
07699ca
}
07699ca
3f2c609
54b3904
%package -n     python%{python3_pkgversion}-%{pypi_name}
Igor Gnatenko 0a308dc
Summary:        %{summary}
07699ca
%{bundled}
07699ca
54b3904
%description -n python%{python3_pkgversion}-%{pypi_name} %{_description}
62eec5b
2e315e2
e6f33fb
%package -n     %{python_wheel_pkg_prefix}-%{pypi_name}-wheel
2e315e2
Summary:        The Python wheel module packaged as a wheel
07699ca
%{bundled}
07699ca
e6f33fb
%description -n %{python_wheel_pkg_prefix}-%{pypi_name}-wheel
2e315e2
A Python wheel of wheel to use with virtualenv.
61ba858
62eec5b
62eec5b
%prep
4afa238
%autosetup -n %{pypi_name}-%{version} -p1
03fc6b4
61ba858
1d30281
%if %{without bootstrap}
1d30281
%generate_buildrequires
1d30281
%pyproject_buildrequires
1d30281
%endif
1d30281
1d30281
62eec5b
%build
1d30281
%if %{with bootstrap}
1d30281
%global _pyproject_wheeldir dist
1d30281
%python3 -m flit_core.wheel
1d30281
%else
1d30281
%pyproject_wheel
1d30281
%endif
2e315e2
62eec5b
62eec5b
%install
1d30281
# pip is not available when bootstrapping, so we need to unpack the wheel and
1d30281
# create the entrypoints manually.
1d30281
%if %{with bootstrap}
1d30281
mkdir -p %{buildroot}%{python3_sitelib}
1d30281
unzip %{_pyproject_wheeldir}/%{python_wheel_name} \
1d30281
    -d %{buildroot}%{python3_sitelib} -x wheel-%{version}.dist-info/RECORD
1d30281
install -Dpm 0755 %{SOURCE1} %{buildroot}%{_bindir}/wheel
1d30281
%py3_shebang_fix %{buildroot}%{_bindir}/wheel
1d30281
%else
1d30281
%pyproject_install
1d30281
%endif
1d30281
8accaa3
mv %{buildroot}%{_bindir}/%{pypi_name}{,-%{python3_version}}
f8d62d5
%if %{with main_python}
8accaa3
ln -s %{pypi_name}-%{python3_version} %{buildroot}%{_bindir}/%{pypi_name}-3
8accaa3
ln -s %{pypi_name}-3 %{buildroot}%{_bindir}/%{pypi_name}
f8d62d5
%endif
8accaa3
e6f33fb
mkdir -p %{buildroot}%{python_wheel_dir}
1d30281
install -p %{_pyproject_wheeldir}/%{python_wheel_name} -t %{buildroot}%{python_wheel_dir}
2e315e2
2e315e2
62eec5b
%check
1d30281
# Smoke test
1d30281
%{py3_test_envvars} wheel-%{python3_version} version
1d30281
%py3_check_import wheel
1d30281
1d30281
%if %{with tests}
e9bd4f7
%pytest -v --ignore build
Igor Gnatenko 98bd0f3
%endif
Igor Gnatenko 0a308dc
54b3904
%files -n python%{python3_pkgversion}-%{pypi_name}
Igor Gnatenko 0a308dc
%license LICENSE.txt
03fc6b4
%doc README.rst
f8d62d5
%{_bindir}/%{pypi_name}-%{python3_version}
f8d62d5
%if %{with main_python}
8accaa3
%{_bindir}/%{pypi_name}
Igor Gnatenko 0a308dc
%{_bindir}/%{pypi_name}-3
f8d62d5
%endif
e9bd4f7
%{python3_sitelib}/%{pypi_name}*/
2e315e2
e6f33fb
%files -n %{python_wheel_pkg_prefix}-%{pypi_name}-wheel
2e315e2
%license LICENSE.txt
2e315e2
# we own the dir for simplicity
e6f33fb
%dir %{python_wheel_dir}/
e6f33fb
%{python_wheel_dir}/%{python_wheel_name}
62eec5b
62eec5b
%changelog
4eeedb1
%autochangelog