[elbe-devel] [PATCH v1 7/8] Change to 'lexist' for "/etc/apt/{sources.list, preferences}"
Torben Hohn
torben.hohn at linutronix.de
Thu May 23 17:18:45 CEST 2019
On Wed, May 22, 2019 at 03:33:47PM +0200, dion at linutronix.de wrote:
> From: Olivier Dion <dion at linutronix.de>
>
> Signed-off-by: Olivier Dion <dion at linutronix.de>
Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>
> ---
> elbepack/virtapt.py | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/elbepack/virtapt.py b/elbepack/virtapt.py
> index 8be68b0a..901ea054 100644
> --- a/elbepack/virtapt.py
> +++ b/elbepack/virtapt.py
> @@ -215,22 +215,20 @@ class VirtApt(object):
> def create_apt_sources_list(self, mirror):
> filename = os.path.join(self.projectpath, "etc/apt/sources.list")
>
> - if os.path.exists(filename):
> + if os.path.lexists(filename):
> os.remove(filename)
>
> - file = open(filename, "w")
> - file.write(mirror)
> - file.close()
> + with open(filename, "w") as f:
> + f.write(mirror)
>
> def create_apt_prefs(self, prefs):
> filename = os.path.join(self.projectpath, "etc/apt/preferences")
>
> - if os.path.exists(filename):
> + if os.path.lexists(filename):
> os.remove(filename)
>
> - file = open(filename, "w")
> - file.write(prefs)
> - file.close()
> + with open(filename, "w") as f:
> + f.write(prefs)
>
> def get_uri(self, target_pkg, incl_deps=False):
>
> --
> 2.11.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
More information about the elbe-devel
mailing list