diff options
author | Erik Skultety <eskultet@redhat.com> | 2020-08-04 17:27:21 +0200 |
---|---|---|
committer | Erik Skultety <eskultet@redhat.com> | 2020-08-05 13:11:16 +0200 |
commit | 3a29b2fb7995d9a365c95a07561bdeee2adbaf2c (patch) | |
tree | 74611948f85a413dc5b16c2889cd5e34ef9713d3 /scripts | |
parent | 2edd63a0dbd445112db23596ee0128521e8f1ff5 (diff) | |
download | libvirt-3a29b2fb7995d9a365c95a07561bdeee2adbaf2c.tar.gz |
scripts: Fix meson-install-symlink.py overwriting existing links
By default, symlink re-creation fails if the link already exists, more
specifically in case of meson-install-symlink.py:
Traceback (most recent call last):
File "/<path_to_libvirt_repo>/scripts/meson-install-symlink.py",
line 15, in <module>
os.symlink(target, link)
FileExistsError: File exists: '../default.xml' -> 'default.xml'
Unfortunately, Python can't mimic "ln -sf", so we have to fix this
differently - remove the existing link first and then try re-creating
it.
Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/meson-install-symlink.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/meson-install-symlink.py b/scripts/meson-install-symlink.py index e38507072d..d8817fb9be 100644 --- a/scripts/meson-install-symlink.py +++ b/scripts/meson-install-symlink.py @@ -12,4 +12,8 @@ workdir = os.path.join(destdir, dirname.strip(os.sep)) os.makedirs(workdir, exist_ok=True) os.chdir(workdir) + +if os.path.exists(link): + os.remove(link) + os.symlink(target, link) |