userland: move more userland/arch/ logic into property tree

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-05-05 00:00:00 +00:00
parent d15714641f
commit 1ca732bf75
5 changed files with 102 additions and 72 deletions

View File

@@ -180,6 +180,14 @@ class ShellHelpers:
f.write(cmd_string)
self.chmod(cmd_file)
def rmrf(self, path):
self.print_cmd(['rm', '-r', '-f', path, LF])
if not self.dry_run and os.path.exists(path):
if os.path.isdir(path):
shutil.rmtree(path)
else:
os.unlink(path)
def run_cmd(
self,
cmd,
@@ -309,14 +317,6 @@ class ShellHelpers:
else:
return [x for x in cmd if x != LF]
def rmrf(self, path):
self.print_cmd(['rm', '-r', '-f', path, LF])
if not self.dry_run and os.path.exists(path):
if os.path.isdir(path):
shutil.rmtree(path)
else:
os.unlink(path)
def walk(self, root):
'''
Extended walk that can take files or directories.