[PATCH 3/3] rtemstoolkit/linux: Fix the host support
chrisj at rtems.org
chrisj at rtems.org
Fri Oct 2 09:10:05 UTC 2020
From: Chris Johns <chrisj at rtems.org>
Updates #4111
---
rtemstoolkit/linux.py | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/rtemstoolkit/linux.py b/rtemstoolkit/linux.py
index 15c6132..1ce6739 100644
--- a/rtemstoolkit/linux.py
+++ b/rtemstoolkit/linux.py
@@ -33,6 +33,7 @@
# RTEMS project's spec files.
#
+import multiprocessing
import pprint
import os
import platform
@@ -42,28 +43,14 @@ import platform
# If there is a better way to let us know.
#
try:
- from . import execute
from . import path
except (ValueError, SystemError):
- 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)
+ ncpus = str(multiprocessing.cpu_count())
if uname[4].startswith('arm'):
cpu = 'arm'
else:
@@ -89,8 +76,9 @@ def load():
try:
distro = platform.dist()[0]
distro_ver = float(platform.dist()[1])
- except ValueError:
+ except (AttributeError, ValueError):
# Non LSB distro found, use failover"
+ distro = ''
pass
# Non LSB - fail over to issue
--
2.24.1
More information about the devel
mailing list