summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-03-05 10:36:08 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-03-05 10:59:16 +0100
commite0394a5c709ede13420dca0ea95b39157847c94c (patch)
treeebb19536f4ef1497c6f5dd62e55fae4472d1bf4c
parentBump RSB to the latest rtems-tools to get mkimage.py (diff)
downloadrtems-source-builder-e0394a5c709ede13420dca0ea95b39157847c94c.tar.bz2
sb: Use multiprocessing.cpu_count()
The previous implementation does not work on some Linux distributions, e.g. Debian on sparc64. Use a standard function instead.
-rw-r--r--source-builder/sb/linux.py18
1 files changed, 2 insertions, 16 deletions
diff --git a/source-builder/sb/linux.py b/source-builder/sb/linux.py
index 43a6d1d..c3059a9 100644
--- a/source-builder/sb/linux.py
+++ b/source-builder/sb/linux.py
@@ -22,29 +22,15 @@
# RTEMS project's spec files.
#
+import multiprocessing
import pprint
import os
import platform
-import execute
import path
def load():
uname = os.uname()
- smp_mflags = ''
- processors = '/bin/grep processor /proc/cpuinfo'
- e = execute.capture_execution()
- exit_code, proc, output = e.shell(processors)
- ncpus = 0
- if exit_code == 0:
- try:
- for l in output.split('\n'):
- count = l.split(':')[1].strip()
- if int(count) > ncpus:
- ncpus = int(count)
- except:
- pass
- ncpus = str(ncpus + 1)
if uname[4].startswith('arm'):
cpu = 'arm'
else:
@@ -52,7 +38,7 @@ def load():
version = uname[2]
defines = {
- '_ncpus': ('none', 'none', ncpus),
+ '_ncpus': ('none', 'none', str(multiprocessing.cpu_count())),
'_os': ('none', 'none', 'linux'),
'_host': ('triplet', 'required', cpu + '-linux-gnu'),
'_host_vendor': ('none', 'none', 'gnu'),