From 772d470f30683af27bb6dc7cc7f8bf9f4560d585 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Wed, 9 Sep 2015 21:07:03 +0100 Subject: [PATCH] Single threaded build for pypy3, refactor. Workaround for #1176 --- mp_compile.py | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/mp_compile.py b/mp_compile.py index a930f4245..229f9993d 100644 --- a/mp_compile.py +++ b/mp_compile.py @@ -51,15 +51,33 @@ def _mp_compile(self, sources, output_dir=None, macros=None, # Return *all* object filenames, not just the ones we just built. return objects -# explicitly don't enable if environment says 1 processor -if MAX_PROCS != 1 and not sys.platform.startswith('win'): - try: - # bug, only enable if we can make a Pool. see issue #790 and - # http://stackoverflow.com/questions/6033599/oserror-38-errno-38-with-multiprocessing - pool = Pool(2) - CCompiler.compile = _mp_compile - except Exception as msg: - print("Exception installing mp_compile, proceeding without: %s" % msg) -else: - print("Single threaded build, not installing mp_compile: %s processes" % - MAX_PROCS) + +def install(): + + fl_pypy3 = hasattr(sys, 'pypy_version_info') and sys.version_info > (3,0) + fl_win = sys.platform.startswith('win') + + if fl_pypy3: + # see https://github.com/travis-ci/travis-ci/issues/3587 + print("Single threaded build for pypy3") + return + + if fl_win: + #windows barfs on multiprocessing installs + print("Single threaded build for windows") + return + + if MAX_PROCS != 1: + # explicitly don't enable if environment says 1 processor + try: + # bug, only enable if we can make a Pool. see issue #790 and + # http://stackoverflow.com/questions/6033599/oserror-38-errno-38-with-multiprocessing + pool = Pool(2) + CCompiler.compile = _mp_compile + except Exception as msg: + print("Exception installing mp_compile, proceeding without: %s" % msg) + else: + print("Single threaded build, not installing mp_compile: %s processes" % + MAX_PROCS) + +install()