mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
target: Handle non-existing /sys/devices/system/node
Some systems (ARM 32bits it seems) don't have this file in sysfs. Assume 1 node in that case.
This commit is contained in:
parent
0aeb5bc409
commit
9661c6bff3
@ -167,10 +167,14 @@ class Target(object):
|
||||
@property
|
||||
@memoized
|
||||
def number_of_nodes(self):
|
||||
num_nodes = 0
|
||||
nodere = re.compile(r'^\./node\d+\s*$')
|
||||
cmd = 'cd /sys/devices/system/node && {busybox} find . -maxdepth 1'.format(busybox=quote(self.busybox))
|
||||
try:
|
||||
output = self.execute(cmd, as_root=self.is_rooted)
|
||||
except TargetStableError:
|
||||
return 1
|
||||
else:
|
||||
nodere = re.compile(r'^\./node\d+\s*$')
|
||||
num_nodes = 0
|
||||
for entry in output.splitlines():
|
||||
if nodere.match(entry):
|
||||
num_nodes += 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user