1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Dominik Riebeling 2020-06-13 20:55:40 +02:00
parent ee4e6d2fba
commit a9c7bc7c9a

View file

@ -44,16 +44,11 @@ import time
import hashlib import hashlib
import tempfile import tempfile
from datetime import datetime from datetime import datetime
import multiprocessing
import gitscraper import gitscraper
# modules that are not part of python itself. CPUS = multiprocessing.cpu_count()
cpus = 1 print("Info: %s cores found." % CPUS)
try:
import multiprocessing
cpus = multiprocessing.cpu_count()
print("Info: %s cores found." % cpus)
except ImportError:
print("Warning: multiprocessing module not found. Assuming 1 core.")
# == Global stuff == # == Global stuff ==
# DLL files to ignore when searching for required DLL files. # DLL files to ignore when searching for required DLL files.
@ -216,9 +211,9 @@ def build(wd=".", platform=sys.platform, cross=""):
print("Building ...") print("Building ...")
# use the current platforms make here, cross compiling uses the native make. # use the current platforms make here, cross compiling uses the native make.
command = [make[sys.platform]] command = [make[sys.platform]]
if cpus > 1: if CPUS > 1:
command.append("-j") command.append("-j")
command.append(str(cpus)) command.append(str(CPUS))
output = subprocess.Popen(command, stdout=subprocess.PIPE, cwd=wd) output = subprocess.Popen(command, stdout=subprocess.PIPE, cwd=wd)
while True: while True:
c = output.stdout.readline() c = output.stdout.readline()