mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 02:45:33 +08:00
Add argument to specify the number of jobs
Using the python method 'cpu_count()' is not working everywhere. In Linux containers, 'multiprocessing.cpu_count()' returns the number of cpu's of the host machine, not the number assigned to the linux container.
This commit is contained in:
committed by
Mathew Sutcliffe
parent
bb67c721bb
commit
49cd6a117f
@@ -35,7 +35,7 @@ class Builder:
|
|||||||
os.environ['PATH'] += os.pathsep + self._get_qt_binary_path()
|
os.environ['PATH'] += os.pathsep + self._get_qt_binary_path()
|
||||||
self._specific_prepare()
|
self._specific_prepare()
|
||||||
|
|
||||||
def build(self, dev_build):
|
def build(self, jobs, dev_build):
|
||||||
"""
|
"""
|
||||||
Run the build itself. Pass dev_build=True to enable a dev build
|
Run the build itself. Pass dev_build=True to enable a dev build
|
||||||
"""
|
"""
|
||||||
@@ -50,8 +50,10 @@ class Builder:
|
|||||||
qmake_call += ['-r', os.pardir]
|
qmake_call += ['-r', os.pardir]
|
||||||
subprocess.check_call(qmake_call, env=dict(os.environ))
|
subprocess.check_call(qmake_call, env=dict(os.environ))
|
||||||
|
|
||||||
job_arg = '-j{0}'.format(multiprocessing.cpu_count())
|
if not jobs:
|
||||||
subprocess.check_call([self.make_cmd, job_arg], env=dict(os.environ))
|
jobs = multiprocessing.cpu_count()
|
||||||
|
jobs_arg = '-j{0}'.format(jobs)
|
||||||
|
subprocess.check_call([self.make_cmd, jobs_arg], env=dict(os.environ))
|
||||||
|
|
||||||
def checks(self):
|
def checks(self):
|
||||||
"""
|
"""
|
||||||
@@ -327,9 +329,10 @@ def main(argv):
|
|||||||
word_size = ''
|
word_size = ''
|
||||||
tool_chain = ''
|
tool_chain = ''
|
||||||
dev_build = False
|
dev_build = False
|
||||||
|
jobs = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(argv, 'hc:w:t:d', ['config=', 'wordsize=', 'toolchain=', 'dev'])
|
opts, args = getopt.getopt(argv, 'hc:w:t:j:d', ['config=', 'wordsize=', 'toolchain=', 'jobs=', 'dev'])
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
print_help()
|
print_help()
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@@ -351,6 +354,8 @@ def main(argv):
|
|||||||
word_size = arg
|
word_size = arg
|
||||||
elif opt in ('-t', '--toolchain'):
|
elif opt in ('-t', '--toolchain'):
|
||||||
tool_chain = arg
|
tool_chain = arg
|
||||||
|
elif opt in ('-j', '--jobs'):
|
||||||
|
jobs = arg
|
||||||
elif opt in ('-d', '--dev'):
|
elif opt in ('-d', '--dev'):
|
||||||
dev_build = True
|
dev_build = True
|
||||||
|
|
||||||
@@ -375,7 +380,7 @@ def main(argv):
|
|||||||
builder = builders[platform.system()][tool_chain](config_file, word_size)
|
builder = builders[platform.system()][tool_chain](config_file, word_size)
|
||||||
|
|
||||||
builder.prepare()
|
builder.prepare()
|
||||||
builder.build(dev_build)
|
builder.build(jobs, dev_build)
|
||||||
builder.checks()
|
builder.checks()
|
||||||
builder.install()
|
builder.install()
|
||||||
builder.package_xswiftbus()
|
builder.package_xswiftbus()
|
||||||
|
|||||||
Reference in New Issue
Block a user