File python3-cairo.spec of Package python3-cairo

#
# spec file for package python3-cairo
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define pyname  cairo
Name:           python3-%{pyname}
%define modname py%{pyname}
Version:        1.10.0
Release:        0
Summary:        Python Bindings for Cairo
License:        LGPL-3.0
Group:          Development/Libraries/Python
# FIXME: on update, check if we still need to manually remove the byte-code in %%install
Url:            http://www.cairographics.org/
Source:         %{modname}-%{version}.tar.bz2
Patch1:         waf-py34.patch
# PATCH-FIX-UPSTREAM pycairo-1.10.0-80_fix-pickle.patch bfo#91561 - Fix waf pickling on Python 3.5
Patch10:        pycairo-1.10.0-80_fix-pickle.patch
# PATCH-FIX-UPSTREAM pycairo-1.10.0-81_pickling-again.patch bfo#91561 - Further waf pickling on Python 3.5
Patch11:        pycairo-1.10.0-81_pickling-again.patch
BuildRequires:  cairo-devel
# Needed to have the modules for different hash algorithms; python3-devel only brings in python3-base
BuildRequires:  python3
BuildRequires:  python3-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Python bindings for the Cairo vector graphics library.

%package devel
Summary:        Development files for %{name}
Group:          Development/Libraries/Python
Requires:       %{name} = %{version}
Requires:       cairo-devel
Requires:       python3-devel

%description devel
Development libraries and headers needed to build 
software using %{name}

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

# Patch bundled-in waf.
# First, run waf to extract its library.
PYTHON=python3 python3 waf --help > /dev/null

# Second, enter the extracted directory to do the patches.
# The directory name depends on the exact waf version,
# which we don't know ahead-of-time, so we can't put it
# in the patch directly.
pushd .waf3-*
%patch1 -p1
%patch10 -p1 
%patch11 -p1
popd

%build
export PYTHON=python3 
python3 ./waf configure --prefix=%{_prefix} --libdir=%{_libdir}
python3 ./waf build

%install
python3 ./waf install --destdir=%{buildroot}
# waf is broken and generated byte-code that references the build root, see http://code.google.com/p/waf/issues/detail?id=986
rm %{buildroot}%{python3_sitearch}/%{pyname}/*.py[co]

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc AUTHORS COPYING.LESSER NEWS README
%{python3_sitearch}/%{pyname}/

%files devel
%defattr(-,root,root)
%{_includedir}/%{modname}/
%{_libdir}/pkgconfig/py3%{pyname}.pc

%changelog
openSUSE Build Service is sponsored by