File python-timer2.spec of Package python-timer2
#
# spec file for package python-timer2
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2014 LISA GmbH, Bingen, 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-timer2
Version: 0.1.0
Release: 0
License: BSD-4-Clause
Summary: Scheduler for Python functions
Url: http://github.com/ask/timer2/
Group: Development/Languages/Python
Source: https://pypi.python.org/packages/source/t/timer2/timer2-%{version}.tar.gz
BuildRequires: python-devel
BuildRequires: python-setuptools
#BuildRequires: python-nose
#BuildRequires: python-nose-cover3
#BuildRequires: python-unittest2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch: noarch
%endif
%description
The ``timer2`` module lets you schedule Python functions at specific times,
or at an interval. It can be used as a replacement to ``threading.Timer``,
the difference is that ``timer2`` is always only using a single thread (unless
you manually start more of them)
You should never use this to apply expensive operations, as this would not
be effective when running in a single thread, rather you should make the
timer move the operations to a execution pool (like a thread/multiprocessing
pool, or maybe sending a message)::
>>> pool = multiprocessing.Pool()
>>> timer2.apply_after(10000, pool.apply_async, (expensive_fun, ))
Documentation is available at http://ask.github.com/timer2
%prep
%setup -q -n timer2-%{version}
%build
python setup.py build
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
#%%check -- disabled, since pkg contains none
#python setup.py test
%files
%defattr(-,root,root,-)
%doc AUTHORS Changelog LICENSE README.rst TODO
%{python_sitelib}/*
%changelog