[elbe-devel] [PATCH 1/7] Add support for 'append_file' for Filesystem

Torben Hohn torben.hohn at linutronix.de
Fri May 17 14:35:27 CEST 2019


On Fri, May 17, 2019 at 11:16:55AM +0200, dion at linutronix.de wrote:
> From: Olivier Dion <dion at linutronix.de>
> 
> 'append_file' appends content to a file and can optionally change the
> file mode.
> 
> Signed-off-by: Olivier Dion <dion at linutronix.de>
> ---
>  elbepack/filesystem.py | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/elbepack/filesystem.py b/elbepack/filesystem.py
> index 6ced9ddb..5d8c8cea 100644
> --- a/elbepack/filesystem.py
> +++ b/elbepack/filesystem.py
> @@ -154,6 +154,13 @@ class Filesystem(object):
>          f.close()
>          self.chmod(path, mode)
>  
> +    def append_file(self, path, content, mode=None):
> +        f = self.open(path, "a")
> +        f.write(content)
> +        f.close()
> +        if mode is not None

upps... too quick here... missing :

> +            self.chmod(path, mode)
> +
>      def read_file(self, path):
>          fp = self.open(path, "r")
>          retval = fp.read()
> -- 
> 2.21.0
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20190517/c9aaec6e/attachment.sig>


More information about the elbe-devel mailing list