Blob Blame History Raw
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}

Name:           python-atfork
Version:        0.1.2
Release:        1%{?dist}
Summary:        Provides an API to register callbacks when forking
Group:          Development/Languages
License:        ASL 2.0
URL:            https://code.google.com/p/python-atfork
Source0:        http://python-atfork.googlecode.com/files/atfork-%{version}.zip
# This patch is temporary to resolve non-executable-script rpmlint errors
Patch0:         0001-Resolve-rpmlint-non-executable-script-error.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch
%if 0%{?fedora} >= 11 || 0%{?rhel} >= 6
BuildRequires:  python-setuptools-devel
%else
BuildRequires:  python-setuptools
%endif

%description
Atfork provides a pthread_atfork() work-a-like API for Python 2.4, 2.5 and 2.6
along with fixers to monkey patch standard library modules at run time to be
safe in programs using both threading and forking.

While mixing threads and forking in a program is generally considered to be a
bad idea it need not be so painful.

A missing API in the Python is an atfork mechanism so that locks can be
acquired and released properly around fork calls.  This module adds that.  It
also provides monkey patchers that fix the standard library to properly
register callbacks for locks they create.


%prep
%setup -q -n atfork-%{version}
%patch0 -p1


%build
%if 0%{?fedora} >= 11 || 0%{?rhel} >= 6
%{__python} setup.py build
%else
CFLAGS="$RPM_OPT_FLAGS" %{__python} -c 'import setuptools; execfile("setup.py")' build
%endif


%install
rm -rf $RPM_BUILD_ROOT
%if 0%{?fedora} >= 11 || 0%{?rhel} >= 6
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
%else
%{__python} -c 'import setuptools; execfile("setup.py")' install --skip-build --root $RPM_BUILD_ROOT
%endif


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%{python_sitelib}/atfork
%{python_sitelib}/*egg-info


%changelog
* Thu May 26 2011 James Laska<jlaska@redhat.com> - 0.1.2-1
- Initial packaging