summaryrefslogtreecommitdiffstats
path: root/utils/common/deploy.py
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2010-12-19 20:10:22 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2010-12-19 20:10:22 +0000
commitee3fc61a48975c90b72cc4089b4f0e47495c1345 (patch)
tree21e2fd0bc94fae87790e700990d5a4f4a8f15105 /utils/common/deploy.py
parent8205e54abdb7e3760af6efb6881bbd3254634035 (diff)
downloadrockbox-ee3fc61a48975c90b72cc4089b4f0e47495c1345.tar.gz
rockbox-ee3fc61a48975c90b72cc4089b4f0e47495c1345.tar.bz2
rockbox-ee3fc61a48975c90b72cc4089b4f0e47495c1345.zip
Use more than one core in deployment script.
Try to detect the number of cores in the system and use that value for make -j. Gives a noticable speedup depending on the system (OS X doesn't seem to benefit from it). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28859 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/common/deploy.py')
-rwxr-xr-xutils/common/deploy.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/utils/common/deploy.py b/utils/common/deploy.py
index fd1dcb4125..5d66072a4b 100755
--- a/utils/common/deploy.py
+++ b/utils/common/deploy.py
@@ -59,6 +59,13 @@ except ImportError:
print "Fatal: This script requires the which package to run."
print " See http://code.google.com/p/which/."
sys.exit(-5)
+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."
# == Global stuff ==
# Windows nees some special treatment. Differentiate between program name
@@ -223,7 +230,11 @@ def qmake(qmake="qmake", projfile=project, wd=".", static=True):
def build(wd="."):
# make
print "Building ..."
- output = subprocess.Popen([make], stdout=subprocess.PIPE, cwd=wd)
+ command = [make]
+ if cpus > 1:
+ command.append("-j")
+ command.append(str(cpus))
+ output = subprocess.Popen(command, stdout=subprocess.PIPE, cwd=wd)
while True:
c = output.stdout.readline()
sys.stdout.write(".")