Adapted the code of the non-daemonic pool to recent python versions
fixes #9739 The non-daemonic pool relies heavily on implementation details of the multiprocessing package. In this commit we provide an implementation that fits recent python versions.
This commit is contained in:
parent
4ba3c81bc8
commit
05779d911f
@ -60,18 +60,30 @@ def handle_starttag(self, tag, attrs):
|
|||||||
|
|
||||||
class NonDaemonProcess(multiprocessing.Process):
|
class NonDaemonProcess(multiprocessing.Process):
|
||||||
"""Process tha allows sub-processes, so pools can have sub-pools."""
|
"""Process tha allows sub-processes, so pools can have sub-pools."""
|
||||||
def _get_daemon(self):
|
@property
|
||||||
|
def daemon(self):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _set_daemon(self, value):
|
@daemon.setter
|
||||||
|
def daemon(self, value):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
daemon = property(_get_daemon, _set_daemon)
|
|
||||||
|
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
class NonDaemonPool(multiprocessing.pool.Pool):
|
class NonDaemonPool(multiprocessing.pool.Pool):
|
||||||
"""Pool that uses non-daemon processes"""
|
"""Pool that uses non-daemon processes"""
|
||||||
Process = NonDaemonProcess
|
Process = NonDaemonProcess
|
||||||
|
else:
|
||||||
|
|
||||||
|
class NonDaemonContext(type(multiprocessing.get_context())):
|
||||||
|
Process = NonDaemonProcess
|
||||||
|
|
||||||
|
class NonDaemonPool(multiprocessing.pool.Pool):
|
||||||
|
"""Pool that uses non-daemon processes"""
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
kwargs['context'] = NonDaemonContext()
|
||||||
|
super(NonDaemonPool, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def _spider(url, visited, root, depth, max_depth, raise_on_error):
|
def _spider(url, visited, root, depth, max_depth, raise_on_error):
|
||||||
@ -310,7 +322,7 @@ def find_versions_of_archive(archive_urls, list_url=None, list_depth=0):
|
|||||||
# .sha256
|
# .sha256
|
||||||
# .sig
|
# .sig
|
||||||
# However, SourceForge downloads still need to end in '/download'.
|
# However, SourceForge downloads still need to end in '/download'.
|
||||||
url_regex += '(\/download)?$'
|
url_regex += r'(\/download)?$'
|
||||||
|
|
||||||
regexes.append(url_regex)
|
regexes.append(url_regex)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user