aboutsummaryrefslogtreecommitdiffstats
path: root/build_scripts/utils.py
diff options
context:
space:
mode:
authorAleksandr Mezin <mezin.alexander@gmail.com>2018-09-17 05:17:38 +0600
committerAleksandr Mezin <mezin.alexander@gmail.com>2018-09-18 22:36:22 +0000
commit99bfe460b85ccb3562e10f12972852233870e649 (patch)
treef9e1a9563c7fbc6a585411cd4a2fcb91a97752fc /build_scripts/utils.py
parentf53e7180936a2bf4f5d19c36e0abead44712af88 (diff)
setup.py: parallel build by default
If '--jobs' option is not specified and environment variable isn't set, set it to the number of logical CPUs if possible. I'm adding the option almost every time I run 'setup.py', and probably other people do it too. So maybe it's a good idea to enable parallel build by default. I don't know why anyone would want a non-parallel build, but it's still possible with '--jobs=1'. Change-Id: Id593b7d472588d33f01c52a21afa1a08eacb04a6 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'build_scripts/utils.py')
-rw-r--r--build_scripts/utils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/build_scripts/utils.py b/build_scripts/utils.py
index 7160630d1..1b941aea9 100644
--- a/build_scripts/utils.py
+++ b/build_scripts/utils.py
@@ -1124,3 +1124,10 @@ def acceptCITestConfiguration(hostOS, hostOSVer, targetArch, compiler):
print("Disabled " + compiler + " to " + targetArch + " from Coin configuration")
return False
return True
+
+def cpu_count():
+ try:
+ import multiprocessing
+ return multiprocessing.cpu_count()
+ except (ImportError, NotImplementedError, AttributeError):
+ return 1