File python3-cairo.spec of Package python3-cairo

# spec file for package python3-cairo
# Copyright (c) 2014 SUSE LINUX Products 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

%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
Source:         %{modname}-%{version}.tar.bz2
Source1:        waf-py34.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
Requires:       python(abi) = %{py3_ver}

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}

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

export PYTHON=python3
# an extremely crude way to patch the bundled-in version of waf. sorry.
# first run waf to extract its library
python3 waf --help > /dev/null
# find and patch the file
find -path "*/Tools/" -exec patch -i %{S:1} {} ";"
# continue with build

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

python3 ./waf install --destdir=%{buildroot}
# waf is broken and generated byte-code that references the build root, see
rm %{buildroot}%{python3_sitearch}/%{pyname}/*.py[co]

rm -rf %{buildroot}


%files devel

openSUSE Build Service is sponsored by