%bcond_with bootstrap %bcond_with tests %global pypi_name wheel %global python_wheel_name %{pypi_name}-%{version}-py3-none-any.whl Name: python-%{pypi_name} Version: 0.42.0 Release: %mkrel 1 Summary: A built-package format for Python Group: Development/Python License: MIT URL: https://pypi.org/project/wheel Source0: %{pypi_source} # This is used in bootstrap mode where we manually install the wheel and # entrypoints Source1: wheel-entrypoint BuildArch: noarch BuildRequires: python3-devel # python3 bootstrap: this is rebuilt before the final build of python3, which # adds the dependency on python3-rpm-generators, so we require it manually BuildRequires: python3-rpm-generators # Needed to manually build and unpack the wheel %if %{with bootstrap} BuildRequires: python3-flit-core BuildRequires: unzip %endif %if %{with tests} BuildRequires: python3-pytest BuildRequires: python3-setuptools # several tests compile extensions # those tests are skipped if gcc is not found BuildRequires: gcc %endif %description A built-package format for Python. A wheel is a ZIP-format archive with a specially formatted filename and the .whl extension. It is designed to contain all the files for a PEP 376 compatible install in a way that is very close to the on-disk format. %package -n python3-%{pypi_name} Summary: A built-package format for Python %if %{with bootstrap} Provides: python%{python3_pkgversion}dist(wheel) = %{version} Provides: python%{python3_version}dist(wheel) = %{version} %endif %description -n python3-%{pypi_name} A built-package format for Python. A wheel is a ZIP-format archive with a specially formatted filename and the .whl extension. It is designed to contain all the files for a PEP 376 compatible install in a way that is very close to the on-disk format. %package wheel Summary: The Python wheel module packaged as a wheel Group: Development/Python %description wheel A Python wheel of wheel to use with virtualenv. %prep %autosetup -n %{pypi_name}-%{version} -p1 %if %{without bootstrap} %generate_buildrequires %pyproject_buildrequires %endif %build %if %{with bootstrap} %global _pyproject_wheeldir dist %python3 -m flit_core.wheel %else %pyproject_wheel %endif %install # pip is not available when bootstrapping, so we need to unpack the wheel and # create the entrypoints manually. %if %{with bootstrap} mkdir -p %{buildroot}%{python3_sitelib} unzip %{_pyproject_wheeldir}/%{python_wheel_name} \ -d %{buildroot}%{python3_sitelib} -x wheel-%{version}.dist-info/RECORD install -Dpm 0755 %{SOURCE1} %{buildroot}%{_bindir}/wheel %py3_shebang_fix %{buildroot}%{_bindir}/wheel %else %pyproject_install %endif mv %{buildroot}%{_bindir}/%{pypi_name}{,-%{python3_version}} ln -s %{pypi_name}-%{python3_version} %{buildroot}%{_bindir}/%{pypi_name}-3 ln -s %{pypi_name}-3 %{buildroot}%{_bindir}/%{pypi_name} mkdir -p %{buildroot}%{python_wheel_dir} install -p %{_pyproject_wheeldir}/%{python_wheel_name} -t %{buildroot}%{python_wheel_dir} %check # Smoke test %{py3_test_envvars} wheel-%{python3_version} version %py3_check_import wheel %if %{with tests} %pytest -v --ignore build %endif %files -n python3-%{pypi_name} %license LICENSE.txt %doc README.rst %{_bindir}/%{pypi_name}-%{python3_version} %{_bindir}/%{pypi_name} %{_bindir}/%{pypi_name}-3 %{python3_sitelib}/%{pypi_name}*/ %files wheel %license LICENSE.txt # we own the dir for simplicity %dir %{python_wheel_dir}/ %{python_wheel_dir}/%{python_wheel_name}