%{?filter_setup:
%filter_provides_in %{python_sitearch}/.*\.so$ 
%filter_setup
}

Summary:        Python bindings for CUPS
Name:           python-cups
Version:        2.0.1
Release:        1%{?_dist_release}
Group:          programming
Vendor:         Project Vine
Distribution:   Vine Linux

License:        GPLv2+
URL:            https://github.com/OpenPrinting/pycups
Source:         https://github.com/OpenPrinting/pycups/releases/download/v%{version}/pycups-%{version}.tar.gz

BuildRequires:  cups-devel
BuildRequires:  python3-rpm-macros
BuildRequires:  python3-devel

%description
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
Summary:        Python3 bindings for CUPS API, known as pycups.
Group:          programming

%description -n python3-cups
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.

This is a ported release for python 3

%package doc
Summary:       Documentation for python-cups
Group:         documentation
BuildArch:     noarch

%description doc
Documentation for python-cups.

%prep
%setup -q -n pycups-%{version}

sed -i '/^#!\/usr\/bin\/python/d' examples/cupstree.py


%build
%py3_build


%install
make install-rpmhook DESTDIR="%{buildroot}"
%py3_install

%ifarch x86_64
export PYTHONPATH=%{buildroot}%{python3_sitearch}
%{__python3} -m pydoc -w cups
rm -rf html
mkdir html
mv cups.html html
%endif


%files -n python3-cups
%license COPYING
%doc README NEWS
%{python3_sitearch}/cups.cpython-3*.so
%{python3_sitearch}/pycups*.egg-info
%{_rpmconfigdir}/fileattrs/psdriver.attr
%{_rpmconfigdir}/postscriptdriver.prov

%ifarch x86_64
%files doc
%doc examples html
%endif


%changelog
* Sun Aug 16 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.0.1-1
- new upstream release.
- built with python3 only.

* Wed Apr 03 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.9.74-1
- new upstream release.

* Sat Nov 17 2018 Toshiaki Ara <ara_t@384.jp> 1.9.72-1
- new upstream release.

* Sat Jan 04 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.9.66-1
- new upstream release.

* Sat Sep 10 2011 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.9.58-1
- new upstream release.
- built for Vine Linux.

* Thu Jun  9 2011 Tim Waugh <twaugh@redhat.com> - 1.9.57-1
- 1.9.57.  Fixes rpm provides script (bug #712027).

* Sun Mar 20 2011 Tim Waugh <twaugh@redhat.com> - 1.9.55-1
- 1.9.55.  Support for IPP "resolution" type.

* Wed Feb 23 2011 Tim Waugh <twaugh@redhat.com> - 1.9.54-1
- 1.9.54.  The rpm hook is now upstream.

* Wed Feb 23 2011 Tim Waugh <twaugh@redhat.com> - 1.9.53-5
- Use rpmconfigdir macro throughout.

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9.53-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Tue Jan 25 2011 Tim Waugh <twaugh@redhat.com> - 1.9.53-3
- Fixed typo in psdriver.attr that prevented PPD files from being
  scanned when generating postscriptdriver tags.

* Thu Jan 20 2011 Tim Waugh <twaugh@redhat.com> - 1.9.53-2
- Moved postscriptdriver RPM tagging machinery here.  Fixed
  leading/trailing whitespace in tags as well.

* Wed Dec 15 2010 Tim Waugh <twaugh@redhat.com> - 1.9.53-1
- 1.9.53 fixing a thread-local storage issue (bug #662805).

* Wed Nov 17 2010 Jiri Popelka <jpopelka@redhat.com> - 1.9.52-2
- Fixed rpmlint errors/warnings (#648986)
- doc subpackage

* Mon Nov 01 2010 Jiri Popelka <jpopelka@redhat.com> - 1.9.52-1
- Initial RPM spec file
