summaryrefslogtreecommitdiff
path: root/mesonbuild/scripts/externalproject.py
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2024-11-20 08:58:10 +0100
committerDylan Baker <dylan@pnwbakers.com>2024-12-19 09:25:20 -0800
commit8b9846d9a9d29b427860891c9b699eb4305e348b (patch)
tree16e602e2e56fc175177eab9c56a0cbf97d5cda33 /mesonbuild/scripts/externalproject.py
parenteb35d1a05f08f6969851cea81889e3beffdb9ec2 (diff)
downloadmeson-8b9846d9a9d29b427860891c9b699eb4305e348b.tar.gz
mtest: move determine_worker_count to utils, generalize
It is useful to apply a limit to the number of processes even outside "meson test", and specifically for clang tools. In preparation for this, generalize determine_worker_count() to accept a variable MESON_NUM_PROCESSES instead of MESON_TESTTHREADS, and use it throughout instead of multiprocessing.cpu_count(). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild/scripts/externalproject.py')
-rw-r--r--mesonbuild/scripts/externalproject.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/mesonbuild/scripts/externalproject.py b/mesonbuild/scripts/externalproject.py
index ce49fbcbf..4013b0acf 100644
--- a/mesonbuild/scripts/externalproject.py
+++ b/mesonbuild/scripts/externalproject.py
@@ -5,12 +5,11 @@ from __future__ import annotations
import os
import argparse
-import multiprocessing
import subprocess
from pathlib import Path
import typing as T
-from ..mesonlib import Popen_safe, split_args
+from ..mesonlib import Popen_safe, split_args, determine_worker_count
class ExternalProject:
def __init__(self, options: argparse.Namespace):
@@ -48,7 +47,7 @@ class ExternalProject:
def build(self) -> int:
make_cmd = self.make.copy()
if self.supports_jobs_flag():
- make_cmd.append(f'-j{multiprocessing.cpu_count()}')
+ make_cmd.append(f'-j{determine_worker_count()}')
rc = self._run('build', make_cmd)
if rc != 0:
return rc