From 590069f01f88194fd9c2cb58fc18503cf36fa125 Mon Sep 17 00:00:00 2001 From: douglas-raillard-arm <douglas.raillard@gmail.com> Date: Thu, 18 Jun 2020 11:23:00 +0100 Subject: [PATCH] target: Add Target.makedirs() Create a directory on the target. --- devlib/target.py | 3 +++ doc/target.rst | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/devlib/target.py b/devlib/target.py index ac92dc9..7996255 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -585,6 +585,9 @@ class Target(object): # files + def makedirs(self, path): + self.execute('mkdir -p {}'.format(quote(folder))) + def file_exists(self, filepath): command = 'if [ -e {} ]; then echo 1; else echo 0; fi' output = self.execute(command.format(quote(filepath)), as_root=self.is_rooted) diff --git a/doc/target.rst b/doc/target.rst index 7f108e6..a7c894e 100644 --- a/doc/target.rst +++ b/doc/target.rst @@ -436,6 +436,10 @@ Target Return a list of :class:`PsEntry` instances for all running processes on the system. +.. method:: Target.makedirs(self, path) + + Create a directory at the given path and all its ancestors if needed. + .. method:: Target.file_exists(self, filepath) Returns ``True`` if the specified path exists on the target and ``False``