#2 Don't build the Python 2 subpackage on EL > 7
Merged 6 years ago by mrunge. Opened 6 years ago by torsava.
rpms/ torsava/python-testrepository master  into  master

file modified
+44 -8
@@ -1,13 +1,23 @@ 

  # Created by pyp2rpm-1.0.1

  %global pypi_name testrepository

  

- %if 0%{?fedora}

- %global with_python3 1

+ %if 0%{?fedora} || 0%{?rhel} > 7

+ # Enable python3 build by default

+ %bcond_without python3

+ %else

+ %bcond_with python3

+ %endif

+ 

+ %if 0%{?rhel} > 7

+ # Disable python2 build by default

+ %bcond_with python2

+ %else

+ %bcond_without python2

  %endif

  

  Name:           python-%{pypi_name}

  Version:        0.0.20

- Release:        13%{?dist}

+ Release:        14%{?dist}

  Summary:        A repository of test results

  

  License:        ASL 2.0
@@ -25,6 +35,7 @@ 

  

  %description %_description

  

+ %if %{with python2}

  %package -n python2-%{pypi_name}

  Summary: %summary

  BuildRequires:  python2-devel
@@ -41,8 +52,9 @@ 

  %{?python_provide:%python_provide python2-%{pypi_name}}

  

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

+ %endif # with python2

  

- %if 0%{?with_python3}

+ %if %{with python3}

  %package -n python3-%{pypi_name}

  Summary:        A repository of test results (for Python 3)

  BuildRequires:  python3-devel
@@ -55,6 +67,13 @@ 

  Requires:       python3-subunit

  Requires:       python3-testtools

  Requires:       python3-extras

+ %{?python_provide:%python_provide python3-%{pypi_name}}

+ 

+ %if %{without python2}

+ # Provide a clean upgrade path when the python2 package is removed

+ Obsoletes:      python-%{pypi_name} < %{version}-%{release}

+ Obsoletes:      python2-%{pypi_name} < %{version}-%{release}

+ %endif # without python2

  

  %description -n python3-%{pypi_name}

  Provides a database of test results which can be used to
@@ -72,37 +91,54 @@ 

  rm -rf %{pypi_name}.egg-info

  

  %build

+ %if %{with python2}

  %py2_build

- %if 0%{?with_python3}

+ %endif # with python2

+ 

+ %if %{with python3}

  %py3_build

  %endif

  

  

  %install

- %if 0%{?with_python3}

+ %if %{with python3}

  # install Py3 version first, so it will not override the binary in /usr/bin

  %py3_install

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

- %endif

  

+ %if %{without python2}

+ cp %{buildroot}%{_bindir}/testr{-%{python3_version},}

+ %endif # without python2

+ %endif # with python3

+ 

+ %if %{with python2}

  %py2_install

+ %endif # with python2

  

  

+ %if %{with python2}

  %files -n python2-%{pypi_name}

  %doc README.txt Apache-2.0

  %{_bindir}/testr

  %{python2_sitelib}/%{pypi_name}

  %{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info

+ %endif # with python2

  

- %if 0%{?with_python3}

+ %if %{with python3}

  %files -n python3-%{pypi_name}

  %doc README.txt Apache-2.0

+ %if %{without python2}

+ %{_bindir}/testr

+ %endif # without python2

  %{_bindir}/testr-%{python3_version}

  %{python3_sitelib}/%{pypi_name}

  %{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info

  %endif

  

  %changelog

+ * Fri Mar 16 2018 Tomas Orsava <torsava@redhat.com> - 0.0.20-14

+ - Conditionalize the Python 2 subpackage

+ 

  * Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.0.20-13

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

  

Conditionalize the Python 2 subpackage and don't build it on EL > 7.

I've also updated the Python 3 conditionals to bconds so they are uniform with Python 2. Bconds have the advantage of being able to be configured from the command line, modulemd file, etc.

It is important that this gets merged into F28 as well. Would you be ok with us merging it there after this PR is resolved?

Pull-Request has been merged by mrunge

6 years ago