summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2020-06-13 20:55:40 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2020-07-26 09:56:20 +0200
commita9c7bc7c9aa81fa394a1bf46aa6ff7ac536afe88 (patch)
treee47ca8084b74812ec7a58a6006045439bf239611 /utils
parentee4e6d2fbaf545ad9c1405cb804c6dce1cc13d5f (diff)
deploy: Simplify retrieving CPU count.
The multiprocessing module is part of Python since 2.6, so no need to do an extra check here. Change-Id: If1c223edf9f04b6de8fdf757ba00f79897783a53
Diffstat (limited to 'utils')
-rwxr-xr-xutils/common/deploy.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/utils/common/deploy.py b/utils/common/deploy.py
index 1dbeb494dd..04eef0b7d5 100755
--- a/utils/common/deploy.py
+++ b/utils/common/deploy.py
@@ -44,16 +44,11 @@ import time
import hashlib
import tempfile
from datetime import datetime
+import multiprocessing
import gitscraper
-# modules that are not part of python itself.
-cpus = 1
-try:
- import multiprocessing
- cpus = multiprocessing.cpu_count()
- print("Info: %s cores found." % cpus)
-except ImportError:
- print("Warning: multiprocessing module not found. Assuming 1 core.")
+CPUS = multiprocessing.cpu_count()
+print("Info: %s cores found." % CPUS)
# == Global stuff ==
# DLL files to ignore when searching for required DLL files.
@@ -216,9 +211,9 @@ def build(wd=".", platform=sys.platform, cross=""):
print("Building ...")
# use the current platforms make here, cross compiling uses the native make.
command = [make[sys.platform]]
- if cpus > 1:
+ if CPUS > 1:
command.append("-j")
- command.append(str(cpus))
+ command.append(str(CPUS))
output = subprocess.Popen(command, stdout=subprocess.PIPE, cwd=wd)
while True:
c = output.stdout.readline()