未验证 提交 f1c6d8f5 编写于 作者: L Lukáš Doktor

Merging pull request 1238

* https://github.com/avocado-framework/avocado:
  add -j option to make
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
# Copyright: Red Hat Inc. 2013-2014 # Copyright: Red Hat Inc. 2013-2014
# Author: Lucas Meneghel Rodrigues <lmr@redhat.com> # Author: Lucas Meneghel Rodrigues <lmr@redhat.com>
import multiprocessing
import os import os
from . import process from . import process
...@@ -41,6 +42,15 @@ def make(path, make='make', env=None, extra_args='', ignore_status=False, allow_ ...@@ -41,6 +42,15 @@ def make(path, make='make', env=None, extra_args='', ignore_status=False, allow_
cwd = os.getcwd() cwd = os.getcwd()
os.chdir(path) os.chdir(path)
cmd = make cmd = make
# Set default number of jobs as ncpus + 1
if "-j" not in os.environ.get("MAKEFLAGS", ""):
jobs = multiprocessing.cpu_count() + 1
if not env:
env = {"MAKEFLAGS": "-j%s" % jobs}
elif "-j" not in env:
env["MAKEFLAGS"] = "-j%s" % jobs
makeopts = os.environ.get('MAKEOPTS', '') makeopts = os.environ.get('MAKEOPTS', '')
if makeopts: if makeopts:
cmd += ' %s' % makeopts cmd += ' %s' % makeopts
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册