From d53fcd22c6fb0489ebd88480dc26c55fc24f32a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= Date: Tue, 12 Jun 2018 16:36:32 +0200 Subject: [PATCH] gen_eh_elf: symlinks: remove if present --- generate_eh_elf.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/generate_eh_elf.py b/generate_eh_elf.py index 7e73343..0cd9e3e 100755 --- a/generate_eh_elf.py +++ b/generate_eh_elf.py @@ -198,6 +198,12 @@ def gen_eh_elf(obj_path, config): # Re-create symlinks for elt in link_chain: + if os.path.exists(elt[0]): + if not os.path.islink(elt[0]): + raise Exception( + "{}: file already exists and is not a symlink.".format( + elt[0])) + os.remove(elt[0]) os.symlink(elt[1], elt[0])