mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-03 23:41:21 +00:00 
			
		
		
		
	target: Remove use of ls
Using "ls" in scripts is highly discouraged: http://mywiki.wooledge.org/ParsingLs
This commit is contained in:
		
				
					committed by
					
						
						Marc Bonnici
					
				
			
			
				
	
			
			
			
						parent
						
							a5640502ac
						
					
				
				
					commit
					0aeb5bc409
				
			@@ -168,9 +168,10 @@ class Target(object):
 | 
				
			|||||||
    @memoized
 | 
					    @memoized
 | 
				
			||||||
    def number_of_nodes(self):
 | 
					    def number_of_nodes(self):
 | 
				
			||||||
        num_nodes = 0
 | 
					        num_nodes = 0
 | 
				
			||||||
        nodere = re.compile(r'^\s*node\d+\s*$')
 | 
					        nodere = re.compile(r'^\./node\d+\s*$')
 | 
				
			||||||
        output = self.execute('ls /sys/devices/system/node', as_root=self.is_rooted)
 | 
					        cmd = 'cd /sys/devices/system/node && {busybox} find . -maxdepth 1'.format(busybox=quote(self.busybox))
 | 
				
			||||||
        for entry in output.split():
 | 
					        output = self.execute(cmd, as_root=self.is_rooted)
 | 
				
			||||||
 | 
					        for entry in output.splitlines():
 | 
				
			||||||
            if nodere.match(entry):
 | 
					            if nodere.match(entry):
 | 
				
			||||||
                num_nodes += 1
 | 
					                num_nodes += 1
 | 
				
			||||||
        return num_nodes
 | 
					        return num_nodes
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user