Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[setup] return 0 as number of cpus on windows to disable parallel build #2441

Merged
merged 2 commits into from
Feb 5, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
def _get_cpu_count():
if platform.system() != "Windows":
return os.cpu_count()
return 0


def _compile(
self, sources, output_dir=None, macros=None, include_dirs=None,
Expand Down Expand Up @@ -376,8 +378,9 @@ def finalize_options(self):
def build_extensions(self):
self.check_extensions_list(self.extensions)

if _get_cpu_count():
with Pool(_get_cpu_count()) as pool:
ncpus = _get_cpu_count()
if ncpus > 0:
with Pool(ncpus) as pool:
pool.map(self.build_extension, self.extensions)
else:
super().build_extensions()
Expand Down