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

%define py3dir  %{_builddir}/python3-%{name}-%{version}-%{release}
%define __python3 /usr/bin/python3
%define python3_sitearch  %(%{__python3} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib(1))")
%define python3_sitelib %(%{__python3} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib(0))")

Summary:       Python bindings for CUPS
Name:          python-cups
Version:       1.9.74
Release:       1%{?_dist_release}
URL:           http://cyberelk.net/tim/software/pycups/
Source:        http://cyberelk.net/tim/data/pycups/pycups-%{version}.tar.bz2
License:       GPLv2+
Group:         Development/Languages
BuildRequires: cups-devel
BuildRequires: python-devel
BuildRequires: python3-devel
BuildRequires: epydoc

Vendor: Project Vine
Distribution: Vine Linux
Packager: tomop

%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:         Development/Languages

%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

%description doc
Documentation for python-cups.

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

rm -rf %{py3dir}
cp -a . %{py3dir}

%build
make CFLAGS="%{optflags} -fno-strict-aliasing"
make doc

pushd %{py3dir}
CFLAGS="%{optflags}" %{__python3} setup.py build
popd


%install
make install DESTDIR="%{buildroot}"

pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
chmod 755 %{buildroot}%{python3_sitearch}/cups*.so
popd

%files
%license COPYING
%doc README NEWS TODO
%{python_sitearch}/cups.so
%{python_sitearch}/pycups*.egg-info
%{_rpmconfigdir}/fileattrs/psdriver.attr
%{_rpmconfigdir}/postscriptdriver.prov

%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

%files doc
%doc examples html

%changelog
* 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
