diff --git a/python-cups.spec b/python-cups.spec index fd52c47..b5a032a 100644 --- a/python-cups.spec +++ b/python-cups.spec @@ -6,7 +6,7 @@ Summary: Python bindings for CUPS Name: python-cups Version: 1.9.72 -Release: 17%{?dist} +Release: 18%{?dist} URL: http://cyberelk.net/tim/software/pycups/ Source: http://cyberelk.net/tim/data/pycups/pycups-%{version}.tar.bz2 License: GPLv2+ @@ -15,6 +15,9 @@ License: GPLv2+ BuildRequires: gcc BuildRequires: cups-devel +%if 0%{?rhel} <= 7 || 0%{?fedora} <= 30 +BuildRequires: python2-devel +%endif BuildRequires: python3-devel BuildRequires: epydoc @@ -23,10 +26,21 @@ This package provides Python bindings for CUPS API, known as pycups. It was written for use with system-config-printer, but can be put to other uses as well. -%package -n python3-cups +%if 0%{?rhel} <= 7 || 0%{?fedora} <= 30 +%package -n python2-cups +Summary: Python2 bindings for CUPS API, known as pycups. # defined in /usr/lib/rpm/macros.d/macros.python # if python_provide() is defined, call python_provide(python2-cups) # which may eventually add Provides: ... (see the function definition) +%{?python_provide:%python_provide python2-cups} + +%description -n python2-cups +This package provides Python 2 bindings for CUPS API, +known as pycups. It was written for use with +system-config-printer, but can be put to other uses as well. +%endif + +%package -n python3-cups Summary: Python3 bindings for CUPS API, known as pycups. %{?python_provide:%python_provide python3-cups} @@ -47,14 +61,30 @@ Documentation for python-cups. sed -i '/^#!\/usr\/bin\/python/d' examples/cupstree.py %build +%if 0%{?rhel} <= 7 || 0%{?fedora} <= 30 +%py2_build +%endif %py3_build rm -rf html -#epydoc -v -o html --html build/lib*/cups*.so +%if 0%{?rhel} <= 7 || 0%{?fedora} <= 30 +epydoc -v -o html --html build/lib*/*cups.so +%endif %install make install-rpmhook DESTDIR="%{buildroot}" +%if 0%{?rhel} <= 7 || 0%{?fedora} <= 30 +%py2_install +%endif %py3_install +%if 0%{?rhel} <= 7 || 0%{?fedora} <= 30 +%files -n python2-cups +%doc README NEWS TODO +%license COPYING +%{python2_sitearch}/cups.so +%{python2_sitearch}/pycups*.egg-info +%endif + %files -n python3-cups %doc README NEWS TODO %license COPYING @@ -65,8 +95,14 @@ make install-rpmhook DESTDIR="%{buildroot}" %files doc %doc examples +%if 0%{?rhel} <= 7 || 0%{?fedora} <= 30 +%doc html +%endif %changelog +* Thu Apr 12 2018 Zdenek Dohnal - 1.9.72-18 +- make building python2 subpackage optional + * Wed Apr 11 2018 Zdenek Dohnal - 1.9.72-17 - remove python2 subpackage