mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-04 07:51:21 +00:00 
			
		
		
		
	Target: Modified get_installed search order
Changed get_installed to search self.executables_directory first. This means that user provided binaries will be used over system ones. Also added the option to not search system folders for a binary.
This commit is contained in:
		@@ -421,16 +421,19 @@ class Target(object):
 | 
			
		||||
    def uninstall(self, name):
 | 
			
		||||
        raise NotImplementedError()
 | 
			
		||||
 | 
			
		||||
    def get_installed(self, name):
 | 
			
		||||
    def get_installed(self, name, search_system_binaries=True):
 | 
			
		||||
        # Check user installed binaries first
 | 
			
		||||
        if self.file_exists(self.executables_directory):
 | 
			
		||||
            if name in self.list_directory(self.executables_directory):
 | 
			
		||||
                return self.path.join(self.executables_directory, name)
 | 
			
		||||
        # Fall back to binaries in PATH
 | 
			
		||||
        if search_system_binaries:
 | 
			
		||||
            for path in self.getenv('PATH').split(self.path.pathsep):
 | 
			
		||||
                try:
 | 
			
		||||
                    if name in self.list_directory(path):
 | 
			
		||||
                        return self.path.join(path, name)
 | 
			
		||||
                except TargetError:
 | 
			
		||||
                    pass  # directory does not exist or no executable premssions
 | 
			
		||||
        if self.file_exists(self.executables_directory):
 | 
			
		||||
            if name in self.list_directory(self.executables_directory):
 | 
			
		||||
                return self.path.join(self.executables_directory, name)
 | 
			
		||||
 | 
			
		||||
    which = get_installed
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user