From f6407f296178a4b2e4d37471cfcabf75e7c15488 Mon Sep 17 00:00:00 2001 From: "Kacper Kowalik (Xarthisius)" Date: Mon, 3 Feb 2020 13:48:35 -0600 Subject: [PATCH] Don't build in parallel on windows --- setup.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index e28972eef59..001883db5f0 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ import os import multiprocessing +import platform from concurrent.futures import ThreadPoolExecutor as Pool import glob import sys @@ -19,11 +20,8 @@ def _get_cpu_count(): - try: - nthreads = os.cpu_count() - except AttributeError: - nthreads = multiprocessing.cpu_count() - return nthreads + if platform.system() != "Windows": + return os.cpu_count() def _compile( self, sources, output_dir=None, macros=None, include_dirs=None, @@ -378,8 +376,11 @@ def finalize_options(self): def build_extensions(self): self.check_extensions_list(self.extensions) - with Pool(_get_cpu_count()) as pool: - pool.map(self.build_extension, self.extensions) + if _get_cpu_count(): + with Pool(_get_cpu_count()) as pool: + pool.map(self.build_extension, self.extensions) + else: + super().build_extensions() class sdist(_sdist):