summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/util/web.py26
1 files changed, 19 insertions, 7 deletions
diff --git a/lib/spack/spack/util/web.py b/lib/spack/spack/util/web.py
index f04507dae7..b403e44d18 100644
--- a/lib/spack/spack/util/web.py
+++ b/lib/spack/spack/util/web.py
@@ -60,18 +60,30 @@ class LinkParser(HTMLParser):
class NonDaemonProcess(multiprocessing.Process):
"""Process tha allows sub-processes, so pools can have sub-pools."""
- def _get_daemon(self):
+ @property
+ def daemon(self):
return False
- def _set_daemon(self, value):
+ @daemon.setter
+ def daemon(self, value):
pass
- daemon = property(_get_daemon, _set_daemon)
+if sys.version_info[0] < 3:
+ class NonDaemonPool(multiprocessing.pool.Pool):
+ """Pool that uses non-daemon processes"""
+ Process = NonDaemonProcess
+else:
-class NonDaemonPool(multiprocessing.pool.Pool):
- """Pool that uses non-daemon processes"""
- Process = NonDaemonProcess
+ 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):
@@ -310,7 +322,7 @@ def find_versions_of_archive(archive_urls, list_url=None, list_depth=0):
# .sha256
# .sig
# However, SourceForge downloads still need to end in '/download'.
- url_regex += '(\/download)?$'
+ url_regex += r'(\/download)?$'
regexes.append(url_regex)