1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

LocalConnection: Support glob patterns in pull

This commit is contained in:
Brendan Jackman 2017-01-27 19:33:43 +00:00
parent 1cb4eb2285
commit b587049eb9

View File

@ -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)