Blob Blame History Raw
%global with_python3 1

Name:           python-workerpool
Version:        0.9.2
Release:        7%{?dist}
Summary:        Multithreaded job distribution module

License:        MIT
URL:            https://github.com/shazow/workerpool
Source0:        http://workerpool.googlecode.com/files/workerpool-%{version}.tar.gz
# Fix tests to account for non-sequential ordering
# https://github.com/shazow/workerpool/pull/4
Patch0:         python-workerpool-test.patch

BuildArch:      noarch
BuildRequires:  python2-devel
BuildRequires:  python-nose
BuildRequires:  python-setuptools
%if 0%{?with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-nose
BuildRequires:  python3-setuptools
# For 2to3
BuildRequires:  python-tools
%endif # if with_python3

%description
The workerpool module for python 2 is a simple framework for easily
distributing jobs into multiple worker threads.  Examples of usage can be
found in the unit tests and the samples provided.  This module facilitates
distributing simple operations into jobs that are sent to worker threads,
maintained by a pool object.

It consists of these components:

* Jobs - single units of work that need to be performed.
* Workers - workers grab jobs from a queue and run them.
* Worker pool - keeps track of workers and the job queue.


%if 0%{?with_python3}
%package -n python3-workerpool
Summary:        Multithreaded job distribution module

%description -n python3-workerpool
The workerpool module for python 3 is a simple framework for easily
distributing jobs into multiple worker threads.  Examples of usage can be
found in the unit tests and the samples provided.  This module facilitates
distributing simple operations into jobs that are sent to worker threads,
maintained by a pool object.

It consists of these components:

* Jobs - single units of work that need to be performed.
* Workers - workers grab jobs from a queue and run them.
* Worker pool - keeps track of workers and the job queue.
%endif # if with_python3


%prep
%setup -q -n workerpool-%{version}
%patch0 -p1 -b .test
rm -r workerpool.egg-info

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
2to3  --write --nobackups %{py3dir}
%endif # with_python3


%build
%{__python} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3


%install
# Must do the python3 install first because the scripts in /usr/bin are
# overwritten with every setup.py install (and we want the python2 version
# to be the default for now).
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif # with_python3

%{__python} setup.py install --skip-build --root %{buildroot}


%check
# Error at exit due to http://bugs.python.org/issue15881
# Hopefully to be fixed in 2.7.4
%{__python} setup.py test

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif # with_python3

 
%files
%doc CHANGES LICENSE README samples
%{python_sitelib}/*

%if 0%{?with_python3}
%files -n python3-workerpool
%doc CHANGES LICENSE README samples
%{python3_sitelib}/*
%endif # with_python3


%changelog
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.2-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Fri May 02 2014 Orion Poplawski <orion@cora.nwra.com> - 0.9.2-6
- Rebuild for Python 3.4

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Fri May 3 2013 Orion Poplawski <orion@cora.nwra.com> - 0.9.2-4
- Don't ship tests
- Remove shipped egg-info

* Thu May 2 2013 Orion Poplawski <orion@cora.nwra.com> - 0.9.2-3
- Add patch to fix tests

* Thu May 2 2013 Orion Poplawski <orion@cora.nwra.com> - 0.9.2-2
- Change license to MIT
- Fix macro consistency
- Add BR python-nose

* Sun Apr 7 2013 Orion Poplawski <orion@cora.nwra.com> - 0.9.2-1
- Initial Fedora package