File python-atomiclong.spec of Package python-atomiclong
#
# spec file for package python-atomiclong
#
# Copyright (c) 2015 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-atomiclong
Version: 0.1.1
Release: 0
License: MIT
Summary: An AtomicLong type using CFFI
Url: https://github.com/dreid/atomiclong
Group: Development/Languages/Python
Source: https://pypi.python.org/packages/source/a/atomiclong/atomiclong-%{version}.tar.gz
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: python-pytest
BuildRequires: python-cffi
Requires: python-cffi
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitearch: %global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%endif
%description
AtomicLong
==========
Sometimes you need to increment some numbers
... atomically
... in python.
``AtomicLong`` was born out of the need for fast thread-safe counters in python.
It uses `CFFI`_ to bind `GCC's Atomic Builtins`_.
Its value is a C ``long`` which can be incremented, decremented, and set
atomically. It is inspired by Java's `java.util.concurrent.atomic.AtomicLong`_.
Example::
>>> from atomiclong import AtomicLong
>>> a = AtomicLong(0)
>>> a += 1
>>> a.value
1
>>> a += 10
>>> a.value
11
>>> a.value = 1000
>>> a.value
1000
>>> a -= 100
>>> a.value
900
.. _GCC's Atomic Builtins: http://gcc.gnu.org/onlinedocs/gcc-4.3.5/gcc/Atomic-Builtins.html
.. _CFFI: https://cffi.readthedocs.org
.. _java.util.concurrent.atomic.AtomicLong: http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/atomic/AtomicLong.html
%prep
%setup -q -n atomiclong-%{version}
%build
CFLAGS="%{optflags}" python setup.py build
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
%check
python setup.py test
%files
%defattr(-,root,root,-)
%doc LICENSE README.rst
%{python_sitearch}/*
%changelog