Merge pull request #1413 from wiredfool/single_threaded_build

Single threaded build for pypy3, refactor. Workaround for #1176
This commit is contained in:
Hugo van Kemenade 2015-09-10 17:05:20 +03:00
commit f6d57418cd

View File

@ -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 *all* object filenames, not just the ones we just built.
return objects return objects
# explicitly don't enable if environment says 1 processor
if MAX_PROCS != 1 and not sys.platform.startswith('win'): def install():
try:
# bug, only enable if we can make a Pool. see issue #790 and fl_pypy3 = hasattr(sys, 'pypy_version_info') and sys.version_info > (3,0)
# http://stackoverflow.com/questions/6033599/oserror-38-errno-38-with-multiprocessing fl_win = sys.platform.startswith('win')
pool = Pool(2)
CCompiler.compile = _mp_compile if fl_pypy3:
except Exception as msg: # see https://github.com/travis-ci/travis-ci/issues/3587
print("Exception installing mp_compile, proceeding without: %s" % msg) print("Single threaded build for pypy3")
else: return
print("Single threaded build, not installing mp_compile: %s processes" %
MAX_PROCS) 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()