Hello community, here is the log from the commit of package sacad for openSUSE:Factory checked in at 2020-09-22 21:03:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/sacad (Old) and /work/SRC/openSUSE:Factory/.sacad.new.4249 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "sacad" Tue Sep 22 21:03:48 2020 rev:4 rq:828654 version:2.3.3 Changes: -------- --- /work/SRC/openSUSE:Factory/sacad/sacad.changes 2020-08-03 14:18:06.956663342 +0200 +++ /work/SRC/openSUSE:Factory/.sacad.new.4249/sacad.changes 2020-09-22 21:04:48.791595077 +0200 @@ -1,0 +2,6 @@ +Fri Aug 21 17:29:20 UTC 2020 - Dirk Mueller <[email protected]> + +- update to 2.3.3: + * Fix tqdm_logging thread safety + +------------------------------------------------------------------- Old: ---- sacad-2.3.2.tar.gz New: ---- sacad-2.3.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ sacad.spec ++++++ --- /var/tmp/diff_new_pack.N2w2oU/_old 2020-09-22 21:04:49.899596047 +0200 +++ /var/tmp/diff_new_pack.N2w2oU/_new 2020-09-22 21:04:49.903596050 +0200 @@ -17,7 +17,7 @@ Name: sacad -Version: 2.3.2 +Version: 2.3.3 Release: 0 Summary: Search and download music album covers License: MPL-2.0 ++++++ sacad-2.3.2.tar.gz -> sacad-2.3.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sacad-2.3.2/sacad/__init__.py new/sacad-2.3.3/sacad/__init__.py --- old/sacad-2.3.2/sacad/__init__.py 2020-07-25 13:44:37.000000000 +0200 +++ new/sacad-2.3.3/sacad/__init__.py 2020-08-16 16:21:13.000000000 +0200 @@ -2,7 +2,7 @@ """ Smart Automatic Cover Art Downloader : search and download music album covers. """ -__version__ = "2.3.2" +__version__ = "2.3.3" __author__ = "desbma" __license__ = "MPL 2.0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sacad-2.3.2/sacad/recurse.py new/sacad-2.3.3/sacad/recurse.py --- old/sacad-2.3.2/sacad/recurse.py 2020-07-25 13:44:37.000000000 +0200 +++ new/sacad-2.3.3/sacad/recurse.py 2020-08-16 16:21:13.000000000 +0200 @@ -13,6 +13,7 @@ import operator import os import string +import sys import tempfile import mutagen @@ -332,7 +333,7 @@ # so work in smaller chunks to avoid hitting fd limit # this also updates the progress faster (instead of working on all searches, work on finishing the chunk before # getting to the next one) - work_chunk_length = 12 + work_chunk_length = 4 if sys.platform.startswith("win") else 12 for work_chunk in ichunk(work, work_chunk_length): futures = {} for i, cur_work in enumerate(work_chunk, i): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sacad-2.3.2/sacad/sources/amazonbase.py new/sacad-2.3.3/sacad/sources/amazonbase.py --- old/sacad-2.3.2/sacad/sources/amazonbase.py 2020-07-25 13:44:37.000000000 +0200 +++ new/sacad-2.3.3/sacad/sources/amazonbase.py 2020-08-16 16:21:13.000000000 +0200 @@ -1,7 +1,6 @@ from sacad.sources.base import CoverSource - class AmazonBaseCoverSource(CoverSource): """ Base class for Amazon cover sources. """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sacad-2.3.2/sacad/tqdm_logging.py new/sacad-2.3.3/sacad/tqdm_logging.py --- old/sacad-2.3.2/sacad/tqdm_logging.py 2020-07-25 13:44:37.000000000 +0200 +++ new/sacad-2.3.3/sacad/tqdm_logging.py 2020-08-16 16:21:13.000000000 +0200 @@ -3,6 +3,11 @@ import contextlib import logging +import threading + + +logging_handlers_lock = threading.Lock() + class TqdmLoggingHandler(logging.Handler): @@ -19,21 +24,25 @@ @contextlib.contextmanager def redirect_logging(tqdm_obj, logger=logging.getLogger()): - """ Context manager to redirect logging to a TqdmLoggingHandler object and then restore the original. """ - # remove current handler - assert(len(logger.handlers) == 1) - prev_handler = logger.handlers[0] - logger.removeHandler(prev_handler) - - # add tqdm handler - tqdm_handler = TqdmLoggingHandler(tqdm_obj) - if prev_handler.formatter is not None: - tqdm_handler.setFormatter(prev_handler.formatter) - logger.addHandler(tqdm_handler) + """ Context manager to redirect logging to a TqdmLoggingHandler object and then restore the original logging behavior. """ + with logging_handlers_lock: + # remove current handlers + prev_handlers = [] + for handler in logger.handlers.copy(): + prev_handlers.append(handler) + logger.removeHandler(handler) + + # add tqdm handler + tqdm_handler = TqdmLoggingHandler(tqdm_obj) + if prev_handlers[-1].formatter is not None: + tqdm_handler.setFormatter(prev_handlers[-1].formatter) + logger.addHandler(tqdm_handler) try: yield finally: - # restore handler - logger.removeHandler(tqdm_handler) - logger.addHandler(prev_handler) + # restore handlers + with logging_handlers_lock: + logger.removeHandler(tqdm_handler) + for handler in prev_handlers: + logger.addHandler(handler)
