summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2020-10-02 18:41:10 +1000
committerChris Johns <chrisj@rtems.org>2020-10-02 19:09:28 +1000
commitaf8c3926b4b0872f839959ae202f2833bb92ccb6 (patch)
tree9f1fe595815d980b4fa6ec8f47a6968ff949ce0e
parentwaf: Update waf to the latest for better Python support (diff)
downloadrtems-tools-af8c3926b4b0872f839959ae202f2833bb92ccb6.tar.bz2
rtemstoolkit/linux: Fix the host support
Updates #4111
-rw-r--r--rtemstoolkit/linux.py20
1 files 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