File python-event.spec of Package python-event

#
# spec file for package python-event
#
# 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 http://bugs.opensuse.org/
#


Name:           python-event
Version:        0.3
Release:        0
Summary:        Python bindings for libevent
License:        BSD-2-Clause
Group:          Development/Languages
Url:            http://code.google.com/p/pyevent/
Source0:        http://pyevent.googlecode.com/files/pyevent-%{version}.tar.gz
Patch0:         pyevent-0.3-lib64.patch
Patch1:         pyevent-0.3-timeout-assignment.patch
Patch2:         pyevent-0.3-libevent-2_0.patch
BuildRequires:  libevent-devel >= 2.0
BuildRequires:  pyrex
BuildRequires:  python-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Pyevent is the python bindings for libevent which is a generic event system

Example usage:

import event

def sig_cb(a, b, c):
    print a, b, c
    event.abort()

def time_cb(msg):
    print msg
    return True

event.timeout(5, time_cb, 'hello world')
event.signal(2, sig_cb, 1, [1,2], 345)
event.dispatch()

Break with ^C


%prep
%setup -q -n pyevent-%{version}
%patch0 -p1 -b .lib64
%patch1 -p1 -b .timeout-assignment
%patch2 -p1 -b .libevent-2_0

%build
# we should build the pyrex sources to make sure
# other using the srpm to make changes can build also
touch event.pyx
CFLAGS="%{optflags}" make
CFLAGS="%{optflags}" python setup.py build

%install
python setup.py install -O1 --skip-build --prefix=%{_prefix} --root %{buildroot}

%files
%defattr(-,root,root,-)
%doc README LICENSE
%{py_sitedir}/event.so
%{py_sitedir}/event-%{version}-py%{py_ver}.egg-info

%changelog
openSUSE Build Service is sponsored by