#16 Make wheel ready for alternative Python stacks
Merged 3 years ago by lbalhar. Opened 3 years ago by lbalhar.
rpms/ lbalhar/python-wheel compatibility  into  master

file modified
+16 -8
@@ -8,6 +8,11 @@ 

  %bcond_without tests

  %endif

  

+ # Similar to what we have in pythonX.Y.spec files.

+ # If enabled, provides unversioned executables and other stuff.

+ # Disable it if you build this package in an alternative stack.

+ %bcond_without main_python

+ 

  %global pypi_name wheel

  %global python_wheelname %{pypi_name}-%{version}-py2.py3-none-any.whl

  %global python_wheeldir %{_datadir}/python-wheels
@@ -23,15 +28,15 @@ 

  Source0:        %{url}/archive/%{version}/%{pypi_name}-%{version}.tar.gz

  BuildArch:      noarch

  

- BuildRequires:  python3-devel

- BuildRequires:  python3-setuptools

+ BuildRequires:  python%{python3_pkgversion}-devel

+ BuildRequires:  python%{python3_pkgversion}-setuptools

  

  # 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

  

  %if %{with tests}

- BuildRequires:  python3-pytest

+ BuildRequires:  python%{python3_pkgversion}-pytest

  # several tests compile extensions

  # those tests are skipped if gcc is not found

  BuildRequires:  gcc
@@ -50,9 +55,9 @@ 

  %description %{_description}

  

  

- %package -n     python3-%{pypi_name}

+ %package -n     python%{python3_pkgversion}-%{pypi_name}

  Summary:        %{summary}

- %description -n python3-%{pypi_name} %{_description}

+ %description -n python%{python3_pkgversion}-%{pypi_name} %{_description}

  

  

  %if %{without bootstrap}
@@ -74,8 +79,10 @@ 

  %install

  %py3_install

  mv %{buildroot}%{_bindir}/%{pypi_name}{,-%{python3_version}}

+ %if %{with main_python}

  ln -s %{pypi_name}-%{python3_version} %{buildroot}%{_bindir}/%{pypi_name}-3

  ln -s %{pypi_name}-3 %{buildroot}%{_bindir}/%{pypi_name}

+ %endif

  

  %if %{without bootstrap}

  # We can only use bdist_wheel when wheel is installed, hence we don't build the wheel in %%build
@@ -92,13 +99,14 @@ 

  %pytest -v --ignore build

  %endif

  

- 

- %files -n python3-%{pypi_name}

+ %files -n python%{python3_pkgversion}-%{pypi_name}

  %license LICENSE.txt

  %doc README.rst

+ %{_bindir}/%{pypi_name}-%{python3_version}

+ %if %{with main_python}

  %{_bindir}/%{pypi_name}

  %{_bindir}/%{pypi_name}-3

- %{_bindir}/%{pypi_name}-%{python3_version}

+ %endif

  %{python3_sitelib}/%{pypi_name}*/

  

  %if %{without bootstrap}

Two changes to make wheel ready for alternative python stacks:

  • use %{python3_pkgversion} instead of hardcoded 3
  • use bcond main_python to disable unversioned parts which only the main package should ship

Build succeeded.

Pull-Request has been merged by lbalhar

3 years ago