[python-workerpool] Initial import

Orion Poplawski orion at fedoraproject.org
Sat May 4 20:45:03 UTC 2013


commit 679e98d662b79b774b2ff64c7b03fe7f406ee179
Author: Orion Poplawski <orion at cora.nwra.com>
Date:   Sat May 4 14:44:55 2013 -0600

    Initial import

 .gitignore                   |    1 +
 python-workerpool-test.patch |   21 +++++++
 python-workerpool.spec       |  132 ++++++++++++++++++++++++++++++++++++++++++
 sources                      |    1 +
 4 files changed, 155 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..09ab940 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/workerpool-0.9.2.tar.gz
diff --git a/python-workerpool-test.patch b/python-workerpool-test.patch
new file mode 100644
index 0000000..ceb7fa0
--- /dev/null
+++ b/python-workerpool-test.patch
@@ -0,0 +1,21 @@
+diff -up workerpool-0.9.2/test/test_workerpool.py.test workerpool-0.9.2/test/test_workerpool.py
+--- workerpool-0.9.2/test/test_workerpool.py.test	2008-03-09 20:06:48.000000000 -0600
++++ workerpool-0.9.2/test/test_workerpool.py	2013-05-02 17:47:33.610190881 -0600
+@@ -13,7 +13,7 @@ class TestWorkerPool(unittest.TestCase):
+         pool = workerpool.WorkerPool(2)
+         def double(i): return i*2
+         r = pool.map(double, [1,2,3,4,5])
+-        self.assertEquals(r, [2,4,6,8,10])
++        self.assertEquals(set(r), {2,4,6,8,10})
+         pool.shutdown()
+ 
+     def test_map_multiparam(self):
+@@ -21,7 +21,7 @@ class TestWorkerPool(unittest.TestCase):
+         pool = workerpool.WorkerPool(2)
+         def add(*args): return sum(args)
+         r = pool.map(add, [1,2,3], [4,5,6])
+-        self.assertEquals(r, [5,7,9])
++        self.assertEquals(set(r), {5,7,9})
+         pool.shutdown()
+ 
+     def test_wait(self):
diff --git a/python-workerpool.spec b/python-workerpool.spec
new file mode 100644
index 0000000..85508ce
--- /dev/null
+++ b/python-workerpool.spec
@@ -0,0 +1,132 @@
+%global with_python3 1
+
+Name:           python-workerpool
+Version:        0.9.2
+Release:        4%{?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
+* Fri May 3 2013 Orion Poplawski <orion at cora.nwra.com> - 0.9.2-4
+- Don't ship tests
+- Remove shipped egg-info
+
+* Thu May 2 2013 Orion Poplawski <orion at cora.nwra.com> - 0.9.2-3
+- Add patch to fix tests
+
+* Thu May 2 2013 Orion Poplawski <orion at 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 at cora.nwra.com> - 0.9.2-1
+- Initial Fedora package
diff --git a/sources b/sources
index e69de29..4098cd3 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+42904070f1a58f2a7b7276b22134375b  workerpool-0.9.2.tar.gz


More information about the scm-commits mailing list