[rtems-tools commit] rtemstoolkit/linux: Fix the host support
Chris Johns
chrisj at rtems.org
Fri Oct 2 22:55:07 UTC 2020
Module: rtems-tools
Branch: 4.11
Commit: af8c3926b4b0872f839959ae202f2833bb92ccb6
Changeset: http://git.rtems.org/rtems-tools/commit/?id=af8c3926b4b0872f839959ae202f2833bb92ccb6
Author: Chris Johns <chrisj at rtems.org>
Date: Fri Oct 2 18:41:10 2020 +1000
rtemstoolkit/linux: Fix the host support
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
More information about the vc
mailing list