#2 Conditionalize the Python 2 subpackage and don't build it on EL > 7 and Fedora > 28
Closed 4 years ago by churchyard. Opened 4 years ago by churchyard.
rpms/ churchyard/python-blivet nopy2  into  master

file modified
+34 -17
@@ -1,10 +1,19 @@ 

  %define is_rhel 0%{?rhel} != 0

  

- # python3 is not available on RHEL

- %if %{is_rhel}

- %define with_python3 0

+ # python3 is not available on RHEL <=7

+ %if %{is_rhel} && 0%{?rhel} <= 7

+ # disable python3 by default

+ %bcond_with python3

+ %else

+ %bcond_without python3

+ %endif

+ 

+ # python2 is not available on RHEL > 7 and not needed on Fedora > 28

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

BTW The 0%{?fedora} > 28 condition can be changed if you don't like it.

+ # disable python2 by default

+ %bcond_with python2

  %else

- %define with_python3 1

+ %bcond_without python2

  %endif

  

  Summary:  A python module for system storage configuration
@@ -14,7 +23,7 @@ 

  

  %global prerelease .b1

  # prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2

- Release: 0.5%{?prerelease}%{?dist}

+ Release: 0.6%{?prerelease}%{?dist}

  Epoch: 1

  License: LGPLv2+

  Group: System Environment/Libraries
@@ -52,7 +61,7 @@ 

  The %{realname}-data package provides data files required by the %{realname}

  python module.

  

- %if %{with_python3}

+ %if %{with python3}

  %package -n python3-%{realname}

  Summary: A python3 package for examining and modifying storage configuration.

  
@@ -78,13 +87,20 @@ 

  Requires: %{realname}-data = %{epoch}:%{version}-%{release}

  

  Obsoletes: blivet-data < 1:2.0.0

+ 

+ %if %{without python2}

+ Obsoletes: python2-blivet < 1:3.0.0-0.6

+ Obsoletes: python-blivet < 1:3.0.0-0.6

+ %else

  Obsoletes: python-blivet < 1:2.0.0

+ %endif

  

  %description -n python3-%{realname}

  The python3-%{realname} is a python3 package for examining and modifying storage

  configuration.

  %endif

  

+ %if %{with python2}

  %package -n python2-%{realname}

  Summary: A python2 package for examining and modifying storage configuration.

  
@@ -127,23 +143,18 @@ 

  %description -n python2-%{realname}

  The python2-%{realname} is a python2 package for examining and modifying storage

  configuration.

+ %endif

  

  %prep

  %autosetup -n %{realname}-%{realversion} -p1

  

  %build

- make PYTHON=%{__python2}

- 

- %if %{with_python3}

- make PYTHON=%{__python3}

- %endif

+ %{?with_python2:make PYTHON=%{__python2}}

+ %{?with_python3:make PYTHON=%{__python3}}

  

  %install

- make PYTHON=%{__python2} DESTDIR=%{buildroot} install

- 

- %if %{with_python3}

- make PYTHON=%{__python3} DESTDIR=%{buildroot} install

- %endif

+ %{?with_python2:make PYTHON=%{__python2} DESTDIR=%{buildroot} install}

+ %{?with_python3:make PYTHON=%{__python3} DESTDIR=%{buildroot} install}

  

  %find_lang %{realname}

  
@@ -153,12 +164,14 @@ 

  %{_libexecdir}/*

  %{_unitdir}/*

  

+ %if %{with python2}

  %files -n python2-%{realname}

  %license COPYING

  %doc README ChangeLog examples

  %{python2_sitelib}/*

+ %endif

  

- %if %{with_python3}

+ %if %{with python3}

  %files -n python3-%{realname}

  %license COPYING

  %doc README ChangeLog examples
@@ -166,6 +179,10 @@ 

  %endif

  

  %changelog

+ * Tue Mar 20 2018 Miro Hrončok <mhroncok@redhat.com> - 1:3.0.0-0.6.b1

+ - Use bcond for with python3, allow it on RHEL > 7

+ - Conditionalize the Python 2 subpackage and don't build it on EL > 7 and Fedora > 28

+ 

  * Sat Mar 17 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1:3.0.0-0.5.b1

  - Update Python 2 dependency declarations to new packaging standards

    (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

Also, build python3 on EL >= 7.

(Once we agree on this, we need to merge it to f28 as well.)

BTW The 0%{?fedora} > 28 condition can be changed if you don't like it.

This looks like a better version of what I just merged upstream:

https://github.com/storaged-project/blivet/pull/670

Any chance you could rebase and open a pull request there?

Pull-Request has been closed by churchyard

4 years ago