mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-03 15:31:20 +00:00 
			
		
		
		
	LocalConnection: Support glob patterns in pull
This commit is contained in:
		@@ -12,6 +12,7 @@
 | 
			
		||||
# See the License for the specific language governing permissions and
 | 
			
		||||
# limitations under the License.
 | 
			
		||||
#
 | 
			
		||||
from glob import iglob
 | 
			
		||||
import os
 | 
			
		||||
import shutil
 | 
			
		||||
import subprocess
 | 
			
		||||
@@ -41,7 +42,12 @@ class LocalConnection(object):
 | 
			
		||||
 | 
			
		||||
    def pull(self, source, dest, timeout=None, as_root=False): # pylint: disable=unused-argument
 | 
			
		||||
        self.logger.debug('cp {} {}'.format(source, dest))
 | 
			
		||||
        shutil.copy(source, dest)
 | 
			
		||||
        if ('*' in source or '?' in source) and os.path.isdir(dest):
 | 
			
		||||
            # Pull all files matching a wildcard expression
 | 
			
		||||
            for each_source in iglob(source):
 | 
			
		||||
                shutil.copy(each_source, dest)
 | 
			
		||||
        else:
 | 
			
		||||
            shutil.copy(source, dest)
 | 
			
		||||
 | 
			
		||||
    def execute(self, command, timeout=None, check_exit_code=True, as_root=False):
 | 
			
		||||
        self.logger.debug(command)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user