Skip to content

Commit

Permalink
Don't build in parallel on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Xarthisius committed Feb 3, 2020
1 parent b603db7 commit f6407f2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import multiprocessing
import platform
from concurrent.futures import ThreadPoolExecutor as Pool
import glob
import sys
Expand All @@ -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,
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit f6407f2

Please sign in to comment.