#3 Prepare bcond for Python 2 subpackage
Opened 2 months ago by lbalhar. Modified 2 months ago
rpms/ lbalhar/python-idna master  into  master

file modified
+15

@@ -1,6 +1,9 @@ 

  %global with_python3 1

  %global srcname idna

  

+ # Prepared for Python 2 removal

+ %bcond_without python2

+ 

  Name:           python-%{srcname}

  Version:        2.8

  Release:        4%{?dist}

@@ -11,8 +14,10 @@ 

  Source0:        https://pypi.io/packages/source/i/%{srcname}/%{srcname}-%{version}.tar.gz

  BuildArch:      noarch

  

+ %if %{with python2}

  BuildRequires:  python2-devel

  BuildRequires:  python2-setuptools

+ %endif

  BuildRequires:  python3-devel

  BuildRequires:  python3-setuptools

  

@@ -26,6 +31,7 @@ 

  "encodings.idna" module that comes with the Python standard library but

  currently only supports the older 2003 specification.

  

+ %if %{with python2}

  %package -n python2-%{srcname}

  Summary:        Internationalized Domain Names in Applications (IDNA)

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

@@ -39,6 +45,7 @@ 

  The library is also intended to act as a suitable drop-in replacement for the

  "encodings.idna" module that comes with the Python standard library but

  currently only supports the older 2003 specification.

+ %endif

  

  %package -n python3-%{srcname}

  Summary:        Internationalized Domain Names in Applications (IDNA)

@@ -60,23 +67,31 @@ 

  rm -rf %{srcname}.egg-info

  

  %build

+ %if %{with python2}

  %py2_build

+ %endif

  %py3_build

  

  %install

  %py3_install

+ %if %{with python2}

  %py2_install

+ %endif

  

  %check

+ %if %{with python2}

  %{__python2} setup.py test

+ %endif

  %{__python3} setup.py test

  

  

+ %if %{with python2}

  %files -n python2-%{srcname}

  %license LICENSE.rst

  %doc README.rst HISTORY.rst

  %{python2_sitelib}/%{srcname}

  %{python2_sitelib}/%{srcname}-%{version}-py%{python2_version}.egg-info

+ %endif

  

  %files -n python3-%{srcname}

  %license LICENSE.rst

With this change, python2 subpackage can be easily disabled in the future.

rebased onto c4ad4e9

2 months ago