Hello community,

here is the log from the commit of package python-Pebble for openSUSE:Factory 
checked in at 2019-10-08 19:58:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-Pebble (Old)
 and      /work/SRC/openSUSE:Factory/.python-Pebble.new.2352 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-Pebble"

Tue Oct  8 19:58:23 2019 rev:3 rq:735888 version:4.4.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-Pebble/python-Pebble.changes      
2019-08-24 18:49:46.669737771 +0200
+++ /work/SRC/openSUSE:Factory/.python-Pebble.new.2352/python-Pebble.changes    
2019-10-08 19:58:27.488102646 +0200
@@ -1,0 +2,6 @@
+Mon Oct  7 15:00:00 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 4.4.0:
+  * Various doc and test fixes
+
+-------------------------------------------------------------------

Old:
----
  Pebble-4.3.10.tar.gz

New:
----
  Pebble-4.4.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-Pebble.spec ++++++
--- /var/tmp/diff_new_pack.ftjhRl/_old  2019-10-08 19:58:28.192100538 +0200
+++ /var/tmp/diff_new_pack.ftjhRl/_new  2019-10-08 19:58:28.212100478 +0200
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-Pebble
-Version:        4.3.10
+Version:        4.4.0
 Release:        0
 Summary:        Threading and multiprocessing eye-candy for Python
 License:        LGPL-3.0-only

++++++ Pebble-4.3.10.tar.gz -> Pebble-4.4.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Pebble-4.3.10/PKG-INFO new/Pebble-4.4.0/PKG-INFO
--- old/Pebble-4.3.10/PKG-INFO  2019-02-17 16:01:43.000000000 +0100
+++ new/Pebble-4.4.0/PKG-INFO   2019-09-29 18:51:48.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: Pebble
-Version: 4.3.10
+Version: 4.4.0
 Summary: Threading and multiprocessing eye-candy.
 Home-page: https://github.com/noxdafox/pebble
 Author: Matteo Cafasso
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Pebble-4.3.10/Pebble.egg-info/PKG-INFO 
new/Pebble-4.4.0/Pebble.egg-info/PKG-INFO
--- old/Pebble-4.3.10/Pebble.egg-info/PKG-INFO  2019-02-17 16:01:43.000000000 
+0100
+++ new/Pebble-4.4.0/Pebble.egg-info/PKG-INFO   2019-09-29 18:51:48.000000000 
+0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: Pebble
-Version: 4.3.10
+Version: 4.4.0
 Summary: Threading and multiprocessing eye-candy.
 Home-page: https://github.com/noxdafox/pebble
 Author: Matteo Cafasso
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Pebble-4.3.10/pebble/common.py 
new/Pebble-4.4.0/pebble/common.py
--- old/Pebble-4.3.10/pebble/common.py  2019-02-10 00:16:37.000000000 +0100
+++ new/Pebble-4.4.0/pebble/common.py   2019-09-29 18:45:18.000000000 +0200
@@ -29,6 +29,7 @@
 
 class ProcessExpired(OSError):
     """Raised when process dies unexpectedly."""
+
     def __init__(self, msg, code=0):
         super(ProcessExpired, self).__init__(msg)
         self.exitcode = code
@@ -101,6 +102,7 @@
     Exception.__cause__ requires a BaseException subclass.
 
     """
+
     def __init__(self, traceback):
         self.traceback = traceback
 
@@ -110,6 +112,7 @@
 
 class RemoteException(object):
     """Pickling wrapper for exceptions in remote process."""
+
     def __init__(self, exception, traceback):
         self.exception = exception
         self.traceback = traceback
@@ -124,16 +127,16 @@
     return exception
 
 
-def launch_thread(function, *args, **kwargs):
-    thread = Thread(target=function, args=args, kwargs=kwargs)
+def launch_thread(name, function, *args, **kwargs):
+    thread = Thread(target=function, name=name, args=args, kwargs=kwargs)
     thread.daemon = True
     thread.start()
 
     return thread
 
 
-def launch_process(function, *args, **kwargs):
-    process = Process(target=function, args=args, kwargs=kwargs)
+def launch_process(name, function, *args, **kwargs):
+    process = Process(target=function, name=name, args=args, kwargs=kwargs)
     process.daemon = True
     process.start()
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Pebble-4.3.10/pebble/concurrent/process.py 
new/Pebble-4.4.0/pebble/concurrent/process.py
--- old/Pebble-4.3.10/pebble/concurrent/process.py      2019-02-09 
12:11:00.000000000 +0100
+++ new/Pebble-4.4.0/pebble/concurrent/process.py       2019-09-29 
18:45:18.000000000 +0200
@@ -43,25 +43,28 @@
     The timeout parameter will set a maximum execution time
     for the decorated function. If the execution exceeds the timeout,
     the process will be stopped and the Future will raise TimeoutError.
-
+    The name parameter will set the process name.
     """
     timeout = kwargs.get('timeout')
+    name = kwargs.get('name')
 
     # decorator without parameters
     if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
-        return _process_wrapper(args[0], timeout)
+        return _process_wrapper(args[0], timeout, name)
     else:
         # decorator with parameters
         if timeout is not None and not isinstance(timeout, (int, float)):
             raise TypeError('Timeout expected to be None or integer or float')
+        if name is not None and not isinstance(name, str):
+            raise TypeError('Name expected to be None or string')
 
         def decorating_function(function):
-            return _process_wrapper(function, timeout)
+            return _process_wrapper(function, timeout, name)
 
         return decorating_function
 
 
-def _process_wrapper(function, timeout):
+def _process_wrapper(function, timeout, name):
     _register_function(function)
 
     @wraps(function)
@@ -76,13 +79,13 @@
             target = function
 
         worker = launch_process(
-            _function_handler, target, args, kwargs, writer)
+            name, _function_handler, target, args, kwargs, writer)
 
         writer.close()
 
         future.set_running_or_notify_cancel()
 
-        launch_thread(_worker_handler, future, worker, reader, timeout)
+        launch_thread(name, _worker_handler, future, worker, reader, timeout)
 
         return future
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Pebble-4.3.10/pebble/concurrent/thread.py 
new/Pebble-4.4.0/pebble/concurrent/thread.py
--- old/Pebble-4.3.10/pebble/concurrent/thread.py       2019-02-09 
12:11:00.000000000 +0100
+++ new/Pebble-4.4.0/pebble/concurrent/thread.py        2019-09-29 
18:45:18.000000000 +0200
@@ -21,25 +21,42 @@
 from pebble.common import launch_thread
 
 
-def thread(function):
+def thread(*args, **kwargs):
     """Runs the decorated function within a concurrent thread,
     taking care of the result and error management.
 
     Decorated functions will return a concurrent.futures.Future object
     once called.
 
+    The name parameter will set the process name.    
     """
+    name = kwargs.get('name')
+
+    if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
+        return _thread_wrapper(args[0], name)
+    else:
+        # decorator with parameters
+        if name is not None and not isinstance(name, str):
+            raise TypeError('Name expected to be None or string')
+
+        def decorating_function(function):
+            return _thread_wrapper(function, name)
+
+        return decorating_function
+    
+
+
+def _thread_wrapper(function, name):
     @wraps(function)
     def wrapper(*args, **kwargs):
         future = Future()
 
-        launch_thread(_function_handler, function, args, kwargs, future)
+        launch_thread(name, _function_handler, function, args, kwargs, future)
 
         return future
 
     return wrapper
 
-
 def _function_handler(function, args, kwargs, future):
     """Runs the actual function in separate thread and returns its result."""
     future.set_running_or_notify_cancel()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Pebble-4.3.10/pebble/pool/process.py 
new/Pebble-4.4.0/pebble/pool/process.py
--- old/Pebble-4.3.10/pebble/pool/process.py    2019-02-17 10:33:21.000000000 
+0100
+++ new/Pebble-4.4.0/pebble/pool/process.py     2019-09-29 18:45:18.000000000 
+0200
@@ -61,13 +61,12 @@
         with self._context.state_mutex:
             if self._context.state == CREATED:
                 self._pool_manager.start()
-                self._loops = (launch_thread(task_scheduler_loop,
+                self._loops = (launch_thread(None, task_scheduler_loop,
                                              self._pool_manager),
-                               launch_thread(pool_manager_loop,
+                               launch_thread(None, pool_manager_loop,
                                              self._pool_manager),
-                               launch_thread(message_manager_loop,
+                               launch_thread(None, message_manager_loop,
                                              self._pool_manager))
-
                 self._context.state = RUNNING
 
     def schedule(self, function, args=(), kwargs={}, timeout=None):
@@ -116,7 +115,7 @@
 
         futures = [self.schedule(
             process_chunk, args=(function, chunk), timeout=timeout)
-                   for chunk in iter_chunks(chunksize, *iterables)]
+            for chunk in iter_chunks(chunksize, *iterables)]
 
         map_future = ProcessMapFuture(futures)
         if not futures:
@@ -255,6 +254,7 @@
     Tasks are registered, acknowledged and completed.
     Timing out and cancelled tasks are handled as well.
     """
+
     def __init__(self, task_done_callback):
         self.tasks = {}
         self.task_done_callback = task_done_callback
@@ -304,6 +304,7 @@
 
     Maintains the workers active and encapsulates their communication logic.
     """
+
     def __init__(self, workers, worker_parameters):
         self.workers = {}
         self.workers_number = workers
@@ -354,7 +355,7 @@
     def new_worker(self):
         try:
             worker = launch_process(
-                worker_process, self.worker_parameters, self.workers_channel)
+                None, worker_process, self.worker_parameters, 
self.workers_channel)
             self.workers[worker.pid] = worker
         except (OSError, EnvironmentError) as error:
             raise BrokenProcessPool(error)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Pebble-4.3.10/pebble/pool/thread.py 
new/Pebble-4.4.0/pebble/pool/thread.py
--- old/Pebble-4.3.10/pebble/pool/thread.py     2019-02-17 10:33:25.000000000 
+0100
+++ new/Pebble-4.4.0/pebble/pool/thread.py      2019-09-29 18:45:18.000000000 
+0200
@@ -50,7 +50,7 @@
         with self._context.state_mutex:
             if self._context.state == CREATED:
                 self._pool_manager.start()
-                self._loops = (launch_thread(pool_manager_loop,
+                self._loops = (launch_thread(None, pool_manager_loop,
                                              self._pool_manager),)
 
                 self._context.state = RUNNING
@@ -143,7 +143,7 @@
 
     def create_workers(self):
         for _ in range(self.context.workers - len(self.workers)):
-            worker = launch_thread(worker_thread, self.context)
+            worker = launch_thread(None, worker_thread, self.context)
 
             self.workers.append(worker)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Pebble-4.3.10/test/test_concurrent_process_fork.py 
new/Pebble-4.4.0/test/test_concurrent_process_fork.py
--- old/Pebble-4.3.10/test/test_concurrent_process_fork.py      2019-02-10 
00:35:55.000000000 +0100
+++ new/Pebble-4.4.0/test/test_concurrent_process_fork.py       2019-09-29 
18:45:18.000000000 +0200
@@ -65,7 +65,18 @@
     signal.signal(signal.SIGTERM, signal.SIG_IGN)
     time.sleep(10)
 
[email protected]()
+def name_keyword_argument(name='function_kwarg'):
+    return name
+
[email protected](name='concurrent_process_name')
+def name_keyword_decorated():
+    return multiprocessing.current_process().name
 
+
[email protected](name='decorator_kwarg')
+def name_keyword_decorated_and_argument(name='bar'):
+    return (multiprocessing.current_process().name, name)
 class ProcessConcurrentObj:
     a = 0
 
@@ -202,3 +213,25 @@
         future = sigterm_decorated()
         with self.assertRaises(TimeoutError):
             future.result()
+
+    def test_name_keyword_argument(self):
+        """name keyword can be passed to a decorated function process without 
name"""
+        f = name_keyword_argument()
+        fn_out = f.result()
+        self.assertEqual(fn_out, "function_kwarg")
+
+    def test_name_keyword_decorated(self):
+        """
+        Check that a simple use case of the name keyword passed to the 
decorator works
+        """
+        f = name_keyword_decorated()
+        dec_out = f.result()
+        self.assertEqual(dec_out, "concurrent_process_name")
+
+    def test_name_keyword_decorated_result_colision(self):
+        """name kwarg is handled  without modifying the function kwargs"""
+        f = name_keyword_decorated_and_argument(name="function_kwarg")
+        dec_out, fn_out = f.result()
+        self.assertEqual(dec_out, "decorator_kwarg")
+        self.assertEqual(fn_out, "function_kwarg")
+    
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Pebble-4.3.10/test/test_concurrent_thread.py 
new/Pebble-4.4.0/test/test_concurrent_thread.py
--- old/Pebble-4.3.10/test/test_concurrent_thread.py    2019-02-09 
12:10:58.000000000 +0100
+++ new/Pebble-4.4.0/test/test_concurrent_thread.py     2019-09-29 
18:45:18.000000000 +0200
@@ -15,6 +15,21 @@
     raise RuntimeError("BOOM!")
 
 
[email protected]()
+def name_keyword_argument(name='function_kwarg'):
+    return name
+
+
[email protected](name='concurrent_thread_name')
+def name_keyword_decorated():
+    return threading.current_thread().name
+
+
[email protected](name='decorator_kwarg')
+def name_keyword_decorated_and_argument(name='bar'):
+    return (threading.current_thread().name, name)
+
+
 class ThreadConcurrentObj:
     a = 0
 
@@ -96,3 +111,24 @@
         self.event.wait(timeout=1)
         self.assertTrue(isinstance(self.exception, RuntimeError),
                         msg=str(self.exception))
+
+    def test_name_keyword_argument(self):
+        """name keyword can be passed to a decorated function process without 
name """
+        f = name_keyword_argument()
+        fn_out = f.result()
+        self.assertEqual(fn_out, "function_kwarg")
+
+    def test_name_keyword_decorated(self):
+        """
+        Check that a simple use case of the name keyword passed to the 
decorator works
+        """
+        f = name_keyword_decorated()
+        dec_out = f.result()
+        self.assertEqual(dec_out, "concurrent_thread_name")
+
+    def test_name_keyword_decorated_result(self):
+        """name kwarg is handled  without modifying the function kwargs"""
+        f = name_keyword_decorated_and_argument(name="function_kwarg")
+        dec_out, fn_out = f.result()
+        self.assertEqual(dec_out, "decorator_kwarg")
+        self.assertEqual(fn_out, "function_kwarg")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Pebble-4.3.10/test/test_pebble.py 
new/Pebble-4.4.0/test/test_pebble.py
--- old/Pebble-4.3.10/test/test_pebble.py       2019-02-09 12:10:58.000000000 
+0100
+++ new/Pebble-4.4.0/test/test_pebble.py        2019-09-29 18:45:18.000000000 
+0200
@@ -127,20 +127,20 @@
 class TestWaitForThreads(unittest.TestCase):
     def test_waitforthreads_single(self):
         """Waitforthreads waits for a single thread."""
-        thread = launch_thread(thread_function, 0.01)
+        thread = launch_thread(None, thread_function, 0.01)
         self.assertEqual(list(waitforthreads([thread]))[0], thread)
 
     def test_waitforthreads_multiple(self):
         """Waitforthreads waits for multiple threads."""
         threads = []
         for _ in range(5):
-            threads.append(launch_thread(thread_function, 0.01))
+            threads.append(launch_thread(None, thread_function, 0.01))
         time.sleep(0.1)
         self.assertEqual(list(waitforthreads(threads)), threads)
 
     def test_waitforthreads_timeout(self):
         """Waitforthreads returns empty list if timeout."""
-        thread = launch_thread(thread_function, 0.1)
+        thread = launch_thread(None, thread_function, 0.1)
         self.assertEqual(list(waitforthreads([thread], timeout=0.01)), [])
 
     def test_waitforthreads_restore(self):
@@ -149,7 +149,7 @@
             expected = threading.get_ident
         else:
             expected = threading._get_ident
-        thread = launch_thread(thread_function, 0)
+        thread = launch_thread(None, thread_function, 0)
         time.sleep(0.01)
         waitforthreads([thread])
         if hasattr(threading, 'get_ident'):
@@ -160,7 +160,7 @@
     def test_waitforthreads_spurious(self):
         """Waitforthreads tolerates spurious wakeups."""
         lock = threading.RLock()
-        thread = launch_thread(spurious_wakeup_function, 0.1, lock)
+        thread = launch_thread(None, spurious_wakeup_function, 0.1, lock)
         self.assertEqual(list(waitforthreads([thread])), [thread])
 
 
@@ -170,24 +170,24 @@
 
     def test_waitforqueues_single(self):
         """Waitforqueues waits for a single queue."""
-        launch_thread(queue_function, self.queues, 0, 0.01)
+        launch_thread(None, queue_function, self.queues, 0, 0.01)
         self.assertEqual(list(waitforqueues(self.queues))[0], self.queues[0])
 
     def test_waitforqueues_multiple(self):
         """Waitforqueues waits for multiple queues."""
         for index in range(3):
-            launch_thread(queue_function, self.queues, index, 0.01)
+            launch_thread(None, queue_function, self.queues, index, 0.01)
         time.sleep(0.1)
         self.assertEqual(list(waitforqueues(self.queues)), self.queues)
 
     def test_waitforqueues_timeout(self):
         """Waitforqueues returns empty list if timeout."""
-        launch_thread(queue_function, self.queues, 0, 0.1)
+        launch_thread(None, queue_function, self.queues, 0, 0.1)
         self.assertEqual(list(waitforqueues(self.queues, timeout=0.01)), [])
 
     def test_waitforqueues_restore(self):
         """Waitforqueues Queue object is restored to original one."""
         expected = sorted(dir(self.queues[0]))
-        launch_thread(queue_function, self.queues, 0, 0)
+        launch_thread(None, queue_function, self.queues, 0, 0)
         waitforqueues(self.queues)
         self.assertEqual(sorted(dir(self.queues[0])), expected)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Pebble-4.3.10/version.py new/Pebble-4.4.0/version.py
--- old/Pebble-4.3.10/version.py        2019-02-17 16:01:43.000000000 +0100
+++ new/Pebble-4.4.0/version.py 2019-09-29 18:51:48.000000000 +0200
@@ -1,3 +1,3 @@
 """Versioning controlled via Git Tag, check setup.py"""
 
-__version__ = "4.3.10"
+__version__ = "4.4.0"


Reply via email to