From 552ea2a1bb7ec0ca49ed825d04fe02aa4d7c92a4 Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Mon, 5 Oct 2015 16:30:33 +0100 Subject: [PATCH] fix: moving is_file and is_directory into BaseLinuxDevice, as relied on by get_properties. --- wlauto/common/linux/device.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/wlauto/common/linux/device.py b/wlauto/common/linux/device.py index b1364559..435aa956 100644 --- a/wlauto/common/linux/device.py +++ b/wlauto/common/linux/device.py @@ -189,6 +189,18 @@ class BaseLinuxDevice(Device): # pylint: disable=abstract-method else: self.busybox = 'busybox' + def is_file(self, filepath): + output = self.execute('if [ -f \'{}\' ]; then echo 1; else echo 0; fi'.format(filepath)) + # output from ssh my contain part of the expression in the buffer, + # split out everything except the last word. + return boolean(output.split()[-1]) # pylint: disable=maybe-no-member + + def is_directory(self, filepath): + output = self.execute('if [ -d \'{}\' ]; then echo 1; else echo 0; fi'.format(filepath)) + # output from ssh my contain part of the expression in the buffer, + # split out everything except the last word. + return boolean(output.split()[-1]) # pylint: disable=maybe-no-member + def get_properties(self, context): for propfile in self.property_files: try: @@ -726,18 +738,6 @@ class LinuxDevice(BaseLinuxDevice): # split out everything except the last word. return boolean(output.split()[-1]) # pylint: disable=maybe-no-member - def is_file(self, filepath): - output = self.execute('if [ -f \'{}\' ]; then echo 1; else echo 0; fi'.format(filepath)) - # output from ssh my contain part of the expression in the buffer, - # split out everything except the last word. - return boolean(output.split()[-1]) # pylint: disable=maybe-no-member - - def is_directory(self, filepath): - output = self.execute('if [ -d \'{}\' ]; then echo 1; else echo 0; fi'.format(filepath)) - # output from ssh my contain part of the expression in the buffer, - # split out everything except the last word. - return boolean(output.split()[-1]) # pylint: disable=maybe-no-member - def listdir(self, path, as_root=False, **kwargs): contents = self.execute('ls -1 {}'.format(path), as_root=as_root).strip() if not contents: