mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
Added quotes around commands using raw paths
This fixes issues with spaces in path names.
This commit is contained in:
parent
aab487c1ac
commit
1424cebb90
@ -772,17 +772,17 @@ class AndroidTarget(Target):
|
|||||||
self.conn.push(source, dest, timeout=timeout)
|
self.conn.push(source, dest, timeout=timeout)
|
||||||
else:
|
else:
|
||||||
device_tempfile = self.path.join(self._file_transfer_cache, source.lstrip(self.path.sep))
|
device_tempfile = self.path.join(self._file_transfer_cache, source.lstrip(self.path.sep))
|
||||||
self.execute('mkdir -p {}'.format(self.path.dirname(device_tempfile)))
|
self.execute("mkdir -p '{}'".format(self.path.dirname(device_tempfile)))
|
||||||
self.conn.push(source, device_tempfile, timeout=timeout)
|
self.conn.push(source, device_tempfile, timeout=timeout)
|
||||||
self.execute('cp {} {}'.format(device_tempfile, dest), as_root=True)
|
self.execute("cp '{}' '{}'".format(device_tempfile, dest), as_root=True)
|
||||||
|
|
||||||
def pull(self, source, dest, as_root=False, timeout=None): # pylint: disable=arguments-differ
|
def pull(self, source, dest, as_root=False, timeout=None): # pylint: disable=arguments-differ
|
||||||
if not as_root:
|
if not as_root:
|
||||||
self.conn.pull(source, dest, timeout=timeout)
|
self.conn.pull(source, dest, timeout=timeout)
|
||||||
else:
|
else:
|
||||||
device_tempfile = self.path.join(self._file_transfer_cache, source.lstrip(self.path.sep))
|
device_tempfile = self.path.join(self._file_transfer_cache, source.lstrip(self.path.sep))
|
||||||
self.execute('mkdir -p {}'.format(self.path.dirname(device_tempfile)))
|
self.execute("mkdir -p '{}'".format(self.path.dirname(device_tempfile)))
|
||||||
self.execute('cp {} {}'.format(source, device_tempfile), as_root=True)
|
self.execute("cp '{}' '{}'".format(source, device_tempfile), as_root=True)
|
||||||
self.conn.pull(device_tempfile, dest, timeout=timeout)
|
self.conn.pull(device_tempfile, dest, timeout=timeout)
|
||||||
|
|
||||||
# Android-specific
|
# Android-specific
|
||||||
@ -829,7 +829,7 @@ class AndroidTarget(Target):
|
|||||||
def install_apk(self, filepath, timeout=None): # pylint: disable=W0221
|
def install_apk(self, filepath, timeout=None): # pylint: disable=W0221
|
||||||
ext = os.path.splitext(filepath)[1].lower()
|
ext = os.path.splitext(filepath)[1].lower()
|
||||||
if ext == '.apk':
|
if ext == '.apk':
|
||||||
return adb_command(self.adb_name, "install {}".format(filepath), timeout=timeout)
|
return adb_command(self.adb_name, "install '{}'".format(filepath), timeout=timeout)
|
||||||
else:
|
else:
|
||||||
raise TargetError('Can\'t install {}: unsupported format.'.format(filepath))
|
raise TargetError('Can\'t install {}: unsupported format.'.format(filepath))
|
||||||
|
|
||||||
@ -842,7 +842,7 @@ class AndroidTarget(Target):
|
|||||||
if on_device_file != on_device_executable:
|
if on_device_file != on_device_executable:
|
||||||
self.execute('cp {} {}'.format(on_device_file, on_device_executable), as_root=self.is_rooted)
|
self.execute('cp {} {}'.format(on_device_file, on_device_executable), as_root=self.is_rooted)
|
||||||
self.remove(on_device_file, as_root=self.is_rooted)
|
self.remove(on_device_file, as_root=self.is_rooted)
|
||||||
self.execute('chmod 0777 {}'.format(on_device_executable), as_root=self.is_rooted)
|
self.execute("chmod 0777 '{}'".format(on_device_executable), as_root=self.is_rooted)
|
||||||
self._installed_binaries[executable_name] = on_device_executable
|
self._installed_binaries[executable_name] = on_device_executable
|
||||||
return on_device_executable
|
return on_device_executable
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ class AdbConnection(object):
|
|||||||
def push(self, source, dest, timeout=None):
|
def push(self, source, dest, timeout=None):
|
||||||
if timeout is None:
|
if timeout is None:
|
||||||
timeout = self.timeout
|
timeout = self.timeout
|
||||||
command = 'push {} {}'.format(source, dest)
|
command = "push '{}' '{}'".format(source, dest)
|
||||||
return adb_command(self.device, command, timeout=timeout)
|
return adb_command(self.device, command, timeout=timeout)
|
||||||
|
|
||||||
def pull(self, source, dest, timeout=None):
|
def pull(self, source, dest, timeout=None):
|
||||||
@ -179,10 +179,10 @@ class AdbConnection(object):
|
|||||||
command = 'shell ls {}'.format(source)
|
command = 'shell ls {}'.format(source)
|
||||||
output = adb_command(self.device, command, timeout=timeout)
|
output = adb_command(self.device, command, timeout=timeout)
|
||||||
for line in output.splitlines():
|
for line in output.splitlines():
|
||||||
command = 'pull {} {}'.format(line, dest)
|
command = "pull '{}' '{}'".format(line, dest)
|
||||||
adb_command(self.device, command, timeout=timeout)
|
adb_command(self.device, command, timeout=timeout)
|
||||||
return
|
return
|
||||||
command = 'pull {} {}'.format(source, dest)
|
command = "pull '{}' '{}'".format(source, dest)
|
||||||
return adb_command(self.device, command, timeout=timeout)
|
return adb_command(self.device, command, timeout=timeout)
|
||||||
|
|
||||||
def execute(self, command, timeout=None, check_exit_code=False, as_root=False):
|
def execute(self, command, timeout=None, check_exit_code=False, as_root=False):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user