summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2013-08-10 22:04:16 +0200
committerStefan Behnel <stefan_ml@behnel.de>2013-08-10 22:04:16 +0200
commitff8734139314ebead1626c6e84e78416b098cdaf (patch)
tree7d5309bfca4d6ec40be7ddcc943c6e287e6c8117 /bin
parent30a8a314e30d6a4c0295b64e8f0d239f71a71bbe (diff)
downloadcython-ff8734139314ebead1626c6e84e78416b098cdaf.tar.gz
provide serialised fallback if parallel processing fails
Diffstat (limited to 'bin')
-rwxr-xr-xbin/cythonize16
1 files changed, 15 insertions, 1 deletions
diff --git a/bin/cythonize b/bin/cythonize
index f1fa6ba6c..5d8d1d477 100755
--- a/bin/cythonize
+++ b/bin/cythonize
@@ -18,6 +18,17 @@ except ImportError:
parallel_compiles = 0
+class _FakePool(object):
+ def map_async(self, func, args):
+ from itertools import imap
+ for _ in imap(func, args):
+ pass
+
+ def close(self): pass
+ def terminate(self): pass
+ def join(self): pass
+
+
def parse_directives(option, name, value, parser):
dest = option.dest
old_directives = dict(getattr(parser.values, dest,
@@ -87,7 +98,10 @@ def cython_compile(path_pattern, options):
if options.build:
if len(ext_modules) > 1 and options.parallel:
if pool is None:
- pool = multiprocessing.Pool(options.parallel)
+ try:
+ pool = multiprocessing.Pool(options.parallel)
+ except OSError:
+ pool = _FakePool()
pool.map_async(run_distutils, [
(base_dir, [ext]) for ext in ext_modules])
else: